On Wed, Jan 05, 2022 at 06:00:41PM +0000, Martin Wilck wrote: > Hello Ming, Sreekanth, > > I'm observing a problem where mpt3sas fails to allocate the budget_map > for any SCSI device, because attempted allocation is larger than the > maximum possible. The issue is caused by the logic used in 020b0f0a3192 > ("scsi: core: Replace sdev->device_busy with sbitmap") > to calculate the bitmap size. This is observed with 5.16-rc8. > > The controller at hand has properties can_queue=29865 and > cmd_per_lun=7. The way these parameters are used in scsi_alloc_sdev()-> That two parameter looks bad, can_queue is too big, however cmd_per_lun is so small. > sbitmap_init_node(), this results in an sbitmap with 29865 maps, where > only a single bit is used per map. On x86_64, this results in an > attempt to allocate 29865 * 192 = 5734080 bytes for the sbitmap, which > is larger than PAGE_SIZE * (1 << (MAX_ORDER - 1)), and fails. Bart has posted one patch for fixing the issue: https://lore.kernel.org/linux-scsi/20211203231950.193369-2-bvanassche@xxxxxxx/ but it isn't merged yet. Martin, can we merge the above patch for fixing this issue? Thanks, Ming