* [PATCH 1/1] uas: leave can_queue as MAX_CMNDS if device reports larger qdepth
@ 2016-05-23 16:02 ` tom.ty89
0 siblings, 0 replies; 9+ messages in thread
From: tom.ty89-Re5JQEeQqe8AvxtiuMwx3w @ 2016-05-23 16:02 UTC (permalink / raw)
To: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r
Cc: kraxel-H+wXaHxf7aLQT0dZR+AlfA,
stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-scsi-u79uwXL29TY76Z2rM5mHXA, stable-u79uwXL29TY76Z2rM5mHXA,
hdegoede-H+wXaHxf7aLQT0dZR+AlfA, Tom Yan
From: Tom Yan <tom.ty89-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Commit 198de51dbc34 ("USB: uas: Limit qdepth at the scsi-host level") made
qdepth limit set in host template (`.can_queue = MAX_CMNDS`) useless.
Instead of removing the template limit, now we only change limit according
to the qdepth reported by the device if it is smaller than MAX_CMNDS.
Signed-off-by: Tom Yan <tom.ty89-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 4d49fce..d7790e6 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -972,7 +972,8 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id)
* 1 tag is reserved for untagged commands +
* 1 tag to avoid off by one errors in some bridge firmwares
*/
- shost->can_queue = devinfo->qdepth - 2;
+ if (devinfo->qdepth - 2 < MAX_CMNDS)
+ shost->can_queue = devinfo->qdepth - 2;
usb_set_intfdata(intf, shost);
result = scsi_add_host(shost, &intf->dev);
--
2.8.2
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 1/1] uas: leave can_queue as MAX_CMNDS if device reports larger qdepth @ 2016-05-23 16:02 ` tom.ty89 0 siblings, 0 replies; 9+ messages in thread From: tom.ty89 @ 2016-05-23 16:02 UTC (permalink / raw) To: gregkh; +Cc: kraxel, stern, linux-usb, linux-scsi, stable, hdegoede, Tom Yan From: Tom Yan <tom.ty89@gmail.com> Commit 198de51dbc34 ("USB: uas: Limit qdepth at the scsi-host level") made qdepth limit set in host template (`.can_queue = MAX_CMNDS`) useless. Instead of removing the template limit, now we only change limit according to the qdepth reported by the device if it is smaller than MAX_CMNDS. Signed-off-by: Tom Yan <tom.ty89@gmail.com> diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 4d49fce..d7790e6 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -972,7 +972,8 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) * 1 tag is reserved for untagged commands + * 1 tag to avoid off by one errors in some bridge firmwares */ - shost->can_queue = devinfo->qdepth - 2; + if (devinfo->qdepth - 2 < MAX_CMNDS) + shost->can_queue = devinfo->qdepth - 2; usb_set_intfdata(intf, shost); result = scsi_add_host(shost, &intf->dev); -- 2.8.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] uas: leave can_queue as MAX_CMNDS if device reports larger qdepth 2016-05-23 16:02 ` tom.ty89 (?) @ 2016-05-23 17:00 ` Greg KH [not found] ` <20160523170025.GA3309-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org> -1 siblings, 1 reply; 9+ messages in thread From: Greg KH @ 2016-05-23 17:00 UTC (permalink / raw) To: tom.ty89; +Cc: kraxel, stern, linux-usb, linux-scsi, stable, hdegoede On Tue, May 24, 2016 at 12:02:43AM +0800, tom.ty89@gmail.com wrote: > From: Tom Yan <tom.ty89@gmail.com> > > Commit 198de51dbc34 ("USB: uas: Limit qdepth at the scsi-host level") made > qdepth limit set in host template (`.can_queue = MAX_CMNDS`) useless. > > Instead of removing the template limit, now we only change limit according > to the qdepth reported by the device if it is smaller than MAX_CMNDS. > > Signed-off-by: Tom Yan <tom.ty89@gmail.com> > > diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c > index 4d49fce..d7790e6 100644 > --- a/drivers/usb/storage/uas.c > +++ b/drivers/usb/storage/uas.c > @@ -972,7 +972,8 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) > * 1 tag is reserved for untagged commands + > * 1 tag to avoid off by one errors in some bridge firmwares > */ > - shost->can_queue = devinfo->qdepth - 2; > + if (devinfo->qdepth - 2 < MAX_CMNDS) > + shost->can_queue = devinfo->qdepth - 2; What's wrong with Hans's patch for this issue instead? ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <20160523170025.GA3309-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 1/1] uas: leave can_queue as MAX_CMNDS if device reports larger qdepth 2016-05-23 17:00 ` Greg KH @ 2016-05-23 17:23 ` Tom Yan 0 siblings, 0 replies; 9+ messages in thread From: Tom Yan @ 2016-05-23 17:23 UTC (permalink / raw) To: Greg KH Cc: Gerd Hoffmann, Alan Stern, linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-scsi-u79uwXL29TY76Z2rM5mHXA, stable-u79uwXL29TY76Z2rM5mHXA, hdegoede-H+wXaHxf7aLQT0dZR+AlfA Nothing wrong. It's just .can_queue = MAX_CMNDS in the host template is no longer neceesary, since with his patch, uas will set can_queue again later (to devinfo->qdepth - 2). Originally I thought .can_queue = MAX_CMNDS can hence be removed; but after a second thought, I think it might probably be better if we leave it there and make use of it, in case certain device somehow inapproriately reports an enormous qdepth (i.e. larger than MAX_CMNDS). (According to the commit message of 55ff8cfbc4e1 ("USB: uas: Reduce can_queue to MAX_CMNDS"), "The uas driver can never queue more then MAX_CMNDS...") On 24 May 2016 at 01:00, Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> wrote: > On Tue, May 24, 2016 at 12:02:43AM +0800, tom.ty89-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: >> From: Tom Yan <tom.ty89-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> >> Commit 198de51dbc34 ("USB: uas: Limit qdepth at the scsi-host level") made >> qdepth limit set in host template (`.can_queue = MAX_CMNDS`) useless. >> >> Instead of removing the template limit, now we only change limit according >> to the qdepth reported by the device if it is smaller than MAX_CMNDS. >> >> Signed-off-by: Tom Yan <tom.ty89-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> >> diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c >> index 4d49fce..d7790e6 100644 >> --- a/drivers/usb/storage/uas.c >> +++ b/drivers/usb/storage/uas.c >> @@ -972,7 +972,8 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) >> * 1 tag is reserved for untagged commands + >> * 1 tag to avoid off by one errors in some bridge firmwares >> */ >> - shost->can_queue = devinfo->qdepth - 2; >> + if (devinfo->qdepth - 2 < MAX_CMNDS) >> + shost->can_queue = devinfo->qdepth - 2; > > What's wrong with Hans's patch for this issue instead? > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] uas: leave can_queue as MAX_CMNDS if device reports larger qdepth @ 2016-05-23 17:23 ` Tom Yan 0 siblings, 0 replies; 9+ messages in thread From: Tom Yan @ 2016-05-23 17:23 UTC (permalink / raw) To: Greg KH; +Cc: Gerd Hoffmann, Alan Stern, linux-usb, linux-scsi, stable, hdegoede Nothing wrong. It's just .can_queue = MAX_CMNDS in the host template is no longer neceesary, since with his patch, uas will set can_queue again later (to devinfo->qdepth - 2). Originally I thought .can_queue = MAX_CMNDS can hence be removed; but after a second thought, I think it might probably be better if we leave it there and make use of it, in case certain device somehow inapproriately reports an enormous qdepth (i.e. larger than MAX_CMNDS). (According to the commit message of 55ff8cfbc4e1 ("USB: uas: Reduce can_queue to MAX_CMNDS"), "The uas driver can never queue more then MAX_CMNDS...") On 24 May 2016 at 01:00, Greg KH <gregkh@linuxfoundation.org> wrote: > On Tue, May 24, 2016 at 12:02:43AM +0800, tom.ty89@gmail.com wrote: >> From: Tom Yan <tom.ty89@gmail.com> >> >> Commit 198de51dbc34 ("USB: uas: Limit qdepth at the scsi-host level") made >> qdepth limit set in host template (`.can_queue = MAX_CMNDS`) useless. >> >> Instead of removing the template limit, now we only change limit according >> to the qdepth reported by the device if it is smaller than MAX_CMNDS. >> >> Signed-off-by: Tom Yan <tom.ty89@gmail.com> >> >> diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c >> index 4d49fce..d7790e6 100644 >> --- a/drivers/usb/storage/uas.c >> +++ b/drivers/usb/storage/uas.c >> @@ -972,7 +972,8 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) >> * 1 tag is reserved for untagged commands + >> * 1 tag to avoid off by one errors in some bridge firmwares >> */ >> - shost->can_queue = devinfo->qdepth - 2; >> + if (devinfo->qdepth - 2 < MAX_CMNDS) >> + shost->can_queue = devinfo->qdepth - 2; > > What's wrong with Hans's patch for this issue instead? > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] uas: leave can_queue as MAX_CMNDS if device reports larger qdepth 2016-05-23 17:23 ` Tom Yan (?) @ 2016-05-23 17:27 ` James Bottomley [not found] ` <1464024457.2331.10.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org> -1 siblings, 1 reply; 9+ messages in thread From: James Bottomley @ 2016-05-23 17:27 UTC (permalink / raw) To: Tom Yan, Greg KH Cc: Gerd Hoffmann, Alan Stern, linux-usb, linux-scsi, stable, hdegoede On Tue, 2016-05-24 at 01:23 +0800, Tom Yan wrote: > Nothing wrong. It's just .can_queue = MAX_CMNDS in the host template > is no longer neceesary, since with his patch, uas will set can_queue > again later (to devinfo->qdepth - 2). > > Originally I thought .can_queue = MAX_CMNDS can hence be removed; but > after a second thought, I think it might probably be better if we > leave it there and make use of it, in case certain device somehow > inapproriately reports an enormous qdepth (i.e. larger than > MAX_CMNDS). (According to the commit message of 55ff8cfbc4e1 ("USB: > uas: Reduce can_queue to MAX_CMNDS"), "The uas driver can never queue > more then MAX_CMNDS...") OK, so try this as an exercise: Why would this not be the right thing to do after the host is prepared: It has to do with the streams resources the driver has already created. James ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <1464024457.2331.10.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>]
* Re: [PATCH 1/1] uas: leave can_queue as MAX_CMNDS if device reports larger qdepth 2016-05-23 17:27 ` James Bottomley @ 2016-05-23 18:33 ` Tom Yan 0 siblings, 0 replies; 9+ messages in thread From: Tom Yan @ 2016-05-23 18:33 UTC (permalink / raw) To: James Bottomley Cc: Greg KH, Gerd Hoffmann, Alan Stern, linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-scsi-u79uwXL29TY76Z2rM5mHXA, stable-u79uwXL29TY76Z2rM5mHXA, hdegoede-H+wXaHxf7aLQT0dZR+AlfA I don't quite get what you mean. Are you saying that it is impossible that UAS devices would report inappropriately high qdepth, because of this? https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/storage/uas.c?h=v4.6#n908 In that case should I send another patch that simply has `.can_queue = MAX_CMNDS` in the host template removed? On 24 May 2016 at 01:27, James Bottomley <James.Bottomley-JuX6DAaQMKPCXq6kfMZ53/egYHeGw8Jk@public.gmane.org> wrote: > On Tue, 2016-05-24 at 01:23 +0800, Tom Yan wrote: >> Nothing wrong. It's just .can_queue = MAX_CMNDS in the host template >> is no longer neceesary, since with his patch, uas will set can_queue >> again later (to devinfo->qdepth - 2). >> >> Originally I thought .can_queue = MAX_CMNDS can hence be removed; but >> after a second thought, I think it might probably be better if we >> leave it there and make use of it, in case certain device somehow >> inapproriately reports an enormous qdepth (i.e. larger than >> MAX_CMNDS). (According to the commit message of 55ff8cfbc4e1 ("USB: >> uas: Reduce can_queue to MAX_CMNDS"), "The uas driver can never queue >> more then MAX_CMNDS...") > > OK, so try this as an exercise: Why would this not be the right thing > to do after the host is prepared: It has to do with the streams > resources the driver has already created. > > James > > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] uas: leave can_queue as MAX_CMNDS if device reports larger qdepth @ 2016-05-23 18:33 ` Tom Yan 0 siblings, 0 replies; 9+ messages in thread From: Tom Yan @ 2016-05-23 18:33 UTC (permalink / raw) To: James Bottomley Cc: Greg KH, Gerd Hoffmann, Alan Stern, linux-usb, linux-scsi, stable, hdegoede I don't quite get what you mean. Are you saying that it is impossible that UAS devices would report inappropriately high qdepth, because of this? https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/storage/uas.c?h=v4.6#n908 In that case should I send another patch that simply has `.can_queue = MAX_CMNDS` in the host template removed? On 24 May 2016 at 01:27, James Bottomley <James.Bottomley@hansenpartnership.com> wrote: > On Tue, 2016-05-24 at 01:23 +0800, Tom Yan wrote: >> Nothing wrong. It's just .can_queue = MAX_CMNDS in the host template >> is no longer neceesary, since with his patch, uas will set can_queue >> again later (to devinfo->qdepth - 2). >> >> Originally I thought .can_queue = MAX_CMNDS can hence be removed; but >> after a second thought, I think it might probably be better if we >> leave it there and make use of it, in case certain device somehow >> inapproriately reports an enormous qdepth (i.e. larger than >> MAX_CMNDS). (According to the commit message of 55ff8cfbc4e1 ("USB: >> uas: Reduce can_queue to MAX_CMNDS"), "The uas driver can never queue >> more then MAX_CMNDS...") > > OK, so try this as an exercise: Why would this not be the right thing > to do after the host is prepared: It has to do with the streams > resources the driver has already created. > > James > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] uas: leave can_queue as MAX_CMNDS if device reports larger qdepth 2016-05-23 18:33 ` Tom Yan (?) @ 2016-05-23 19:07 ` James Bottomley -1 siblings, 0 replies; 9+ messages in thread From: James Bottomley @ 2016-05-23 19:07 UTC (permalink / raw) To: Tom Yan Cc: Greg KH, Gerd Hoffmann, Alan Stern, linux-usb, linux-scsi, stable, hdegoede On Tue, 2016-05-24 at 02:33 +0800, Tom Yan wrote: > I don't quite get what you mean. Are you saying that it is impossible > that UAS devices would report inappropriately high qdepth, because of > this? > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/ > drivers/usb/storage/uas.c?h=v4.6#n908 OK, you found the statement, now translate what it means to resource allocation and it will show you why the if you proposed to add would always be true. James > In that case should I send another patch that simply has `.can_queue > = > MAX_CMNDS` in the host template removed? > > On 24 May 2016 at 01:27, James Bottomley > <James.Bottomley@hansenpartnership.com> wrote: > > On Tue, 2016-05-24 at 01:23 +0800, Tom Yan wrote: > > > Nothing wrong. It's just .can_queue = MAX_CMNDS in the host > > > template > > > is no longer neceesary, since with his patch, uas will set > > > can_queue > > > again later (to devinfo->qdepth - 2). > > > > > > Originally I thought .can_queue = MAX_CMNDS can hence be removed; > > > but > > > after a second thought, I think it might probably be better if we > > > leave it there and make use of it, in case certain device somehow > > > inapproriately reports an enormous qdepth (i.e. larger than > > > MAX_CMNDS). (According to the commit message of 55ff8cfbc4e1 > > > ("USB: > > > uas: Reduce can_queue to MAX_CMNDS"), "The uas driver can never > > > queue > > > more then MAX_CMNDS...") > > > > OK, so try this as an exercise: Why would this not be the right > > thing > > to do after the host is prepared: It has to do with the streams > > resources the driver has already created. > > > > James > > > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-scsi" > in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-05-23 19:07 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-23 16:02 [PATCH 1/1] uas: leave can_queue as MAX_CMNDS if device reports larger qdepth tom.ty89-Re5JQEeQqe8AvxtiuMwx3w
2016-05-23 16:02 ` tom.ty89
2016-05-23 17:00 ` Greg KH
[not found] ` <20160523170025.GA3309-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2016-05-23 17:23 ` Tom Yan
2016-05-23 17:23 ` Tom Yan
2016-05-23 17:27 ` James Bottomley
[not found] ` <1464024457.2331.10.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2016-05-23 18:33 ` Tom Yan
2016-05-23 18:33 ` Tom Yan
2016-05-23 19:07 ` James Bottomley
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.