Re: [PATCH] scsi: core: Cap initial sdev queue depth at shost.can_queue
From: Ming Lei
Date: Thu Apr 22 2021 - 21:54:22 EST
On Thu, Apr 22, 2021 at 05:35:42PM +0100, John Garry wrote:
> On 22/04/2021 02:38, Ming Lei wrote:
> > > I would rather not change the values which are provided from the driver. I
> > > would rather take the original values and try to use them in a sane way.
> > >
> > > I have not seen other places where driver shost config values are modified
> > > by the core code.
>
> Hi Ming,
>
> > Wrt. .cmd_per_lun, I think it is safe to modify it into one correct
> > depth because almost all drivers are just producer of .cmd_per_lun. And
> > except for debug purpose, there are only three consumers of .cmd_per_lun
> > in scsi, and all are for scsi_change_queue_depth():
> >
> > process_message()
> > scsi_alloc_sdev()
> > virtscsi_change_queue_depth()
>
> sg_ioctl_common() also looks to read it, but I can't imagine we could break
> that interface with either suggested change.
Then one bad .cmd_per_lun can be passed to userspace, as your patch
doesn't cover this case.
>
> So I still prefer not to modify shost.cmd_per_lun, but if you feel strongly
> enough then I can look to make that change.
I still suggest to make .cmd_per_lun correct since the beginning,
otherwise you may have to cover anywhere .cmd_per_lun is used.
Thanks,
Ming