RE: [PATCH] scsi: storvsc: Cap scsi_driver.can_queue to fix a hang issue during boot
From: Michael Kelley
Date: Wed Oct 06 2021 - 12:08:57 EST
From: John Garry <john.garry@xxxxxxxxxx> Sent: Wednesday, October 6, 2021 9:03 AM
>
> On 06/10/2021 16:01, Michael Kelley wrote:
> > From: John Garry <john.garry@xxxxxxxxxx> Sent: Wednesday, October 6, 2021 1:17 AM
> >>
> >> On 06/10/2021 08:03, Dexuan Cui wrote:
> >>> After commit ea2f0f77538c, a 416-CPU VM running on Hyper-V hangs during
> >>> boot because scsi_add_host_with_dma() sets shost->cmd_per_lun to a
> >>> negative number:
> >>> 'max_outstanding_req_per_channel' is 352,
> >>> 'max_sub_channels' is (416 - 1) / 4 = 103, so in storvsc_probe(),
> >>> scsi_driver.can_queue = 352 * (103 + 1) * (100 - 10) / 100 = 32947, which
> >>> is bigger than SHRT_MAX (i.e. 32767).
> >>
> >> Out of curiosity, are these values realistic? You're capping can_queue
> >> just because of a data size issue, so, if these values are realistic,
> >> seems a weak reason.
> >>
> >
> > The calculated value of can_queue is not realistic. The blk-mq layer
> > caps the number of tags at 10240,
>
> nit: 1024, I think
I was thinking about BLK_MQ_MAX_DEPTH (#define'd as 10240), which
is used to limit the tag set size in blk_mq_alloc_tag_set(). When running
on large VMs on Hyper-V, we can see the "blk-mq: reduced tag depth
to 10240" message. :-(
Michael