* [PATCH V2 08/15] staging: unisys: visorhba: use sg helper to operate sgl [not found] <20190613071335.5679-1-ming.lei@redhat.com> @ 2019-06-13 7:13 ` Ming Lei 2019-06-13 9:52 ` Greg Kroah-Hartman 0 siblings, 1 reply; 6+ messages in thread From: Ming Lei @ 2019-06-13 7:13 UTC (permalink / raw) To: linux-scsi, Martin K . Petersen Cc: Michael Schmitz, devel, Hannes Reinecke, Bart Van Assche, Greg Kroah-Hartman, James Smart, Ewan D . Milne, Jim Gill, James Bottomley, Brian King, Finn Thain, Juergen E . Fischer, Ming Lei, Christoph Hellwig The current way isn't safe for chained sgl, so use sg helper to operate sgl. Cc: devel@driverdev.osuosl.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ming Lei <ming.lei@redhat.com> --- drivers/staging/unisys/visorhba/visorhba_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c index 2dad36a05518..dd979ee4dcf1 100644 --- a/drivers/staging/unisys/visorhba/visorhba_main.c +++ b/drivers/staging/unisys/visorhba/visorhba_main.c @@ -871,12 +871,11 @@ static void do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, return; } - sg = scsi_sglist(scsicmd); - for (i = 0; i < scsi_sg_count(scsicmd); i++) { - this_page_orig = kmap_atomic(sg_page(sg + i)); + scsi_for_each_sg(scsicmd, sg, scsi_sg_count(scsicmd), i) { + this_page_orig = kmap_atomic(sg_page(sg)); this_page = (void *)((unsigned long)this_page_orig | - sg[i].offset); - memcpy(this_page, buf + bufind, sg[i].length); + sg->offset); + memcpy(this_page, buf + bufind, sg->length); kunmap_atomic(this_page_orig); } kfree(buf); -- 2.20.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH V2 08/15] staging: unisys: visorhba: use sg helper to operate sgl 2019-06-13 7:13 ` [PATCH V2 08/15] staging: unisys: visorhba: use sg helper to operate sgl Ming Lei @ 2019-06-13 9:52 ` Greg Kroah-Hartman 2019-06-13 10:04 ` Ming Lei 0 siblings, 1 reply; 6+ messages in thread From: Greg Kroah-Hartman @ 2019-06-13 9:52 UTC (permalink / raw) To: Ming Lei Cc: Michael Schmitz, devel, Hannes Reinecke, linux-scsi, Martin K . Petersen, James Smart, Ewan D . Milne, Jim Gill, James Bottomley, Brian King, Finn Thain, Juergen E . Fischer, Christoph Hellwig, Bart Van Assche On Thu, Jun 13, 2019 at 03:13:28PM +0800, Ming Lei wrote: > The current way isn't safe for chained sgl, so use sg helper to > operate sgl. I can not make any sense out of this changelog. What "isn't safe"? What is a "sgl"? Can this be applied "out of order"? confused, greg k-h ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2 08/15] staging: unisys: visorhba: use sg helper to operate sgl 2019-06-13 9:52 ` Greg Kroah-Hartman @ 2019-06-13 10:04 ` Ming Lei 2019-06-13 10:16 ` Greg Kroah-Hartman 2019-06-13 10:24 ` Dan Carpenter 0 siblings, 2 replies; 6+ messages in thread From: Ming Lei @ 2019-06-13 10:04 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: Michael Schmitz, devel, Hannes Reinecke, linux-scsi, Martin K . Petersen, James Smart, Ewan D . Milne, Jim Gill, James Bottomley, Brian King, Finn Thain, Juergen E . Fischer, Christoph Hellwig, Bart Van Assche On Thu, Jun 13, 2019 at 11:52:14AM +0200, Greg Kroah-Hartman wrote: > On Thu, Jun 13, 2019 at 03:13:28PM +0800, Ming Lei wrote: > > The current way isn't safe for chained sgl, so use sg helper to > > operate sgl. > > I can not make any sense out of this changelog. > > What "isn't safe"? What is a "sgl"? sgl is 'scatterlist' in kernel, and several linear sgl can be chained together, so accessing the sgl in linear way may see a chained sg, which is like a link pointer, then may cause trouble for driver. > > Can this be applied "out of order"? Yes, there isn't any dependency among the 15 patches. Thanks, Ming ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2 08/15] staging: unisys: visorhba: use sg helper to operate sgl 2019-06-13 10:04 ` Ming Lei @ 2019-06-13 10:16 ` Greg Kroah-Hartman 2019-06-13 15:46 ` James Bottomley 2019-06-13 10:24 ` Dan Carpenter 1 sibling, 1 reply; 6+ messages in thread From: Greg Kroah-Hartman @ 2019-06-13 10:16 UTC (permalink / raw) To: Ming Lei Cc: Michael Schmitz, devel, Hannes Reinecke, linux-scsi, Martin K . Petersen, James Smart, Ewan D . Milne, Jim Gill, James Bottomley, Brian King, Finn Thain, Juergen E . Fischer, Christoph Hellwig, Bart Van Assche On Thu, Jun 13, 2019 at 06:04:11PM +0800, Ming Lei wrote: > On Thu, Jun 13, 2019 at 11:52:14AM +0200, Greg Kroah-Hartman wrote: > > On Thu, Jun 13, 2019 at 03:13:28PM +0800, Ming Lei wrote: > > > The current way isn't safe for chained sgl, so use sg helper to > > > operate sgl. > > > > I can not make any sense out of this changelog. > > > > What "isn't safe"? What is a "sgl"? > > sgl is 'scatterlist' in kernel, and several linear sgl can be chained > together, so accessing the sgl in linear way may see a chained sg, which > is like a link pointer, then may cause trouble for driver. What kind of "trouble"? Is this a bug fix that needs to be backported to stable kernels? How can this be triggered? > > Can this be applied "out of order"? > > Yes, there isn't any dependency among the 15 patches. Then perhaps you shouldn't send a numbered patch series with different patches sent to different maintainers, it just causes confusion :) thanks, greg k-h ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2 08/15] staging: unisys: visorhba: use sg helper to operate sgl 2019-06-13 10:16 ` Greg Kroah-Hartman @ 2019-06-13 15:46 ` James Bottomley 0 siblings, 0 replies; 6+ messages in thread From: James Bottomley @ 2019-06-13 15:46 UTC (permalink / raw) To: Greg Kroah-Hartman, Ming Lei Cc: Michael Schmitz, devel, Hannes Reinecke, linux-scsi, Martin K . Petersen, James Smart, Ewan D . Milne, Jim Gill, Brian King, Finn Thain, Juergen E . Fischer, Christoph Hellwig, Bart Van Assche On Thu, 2019-06-13 at 12:16 +0200, Greg Kroah-Hartman wrote: > On Thu, Jun 13, 2019 at 06:04:11PM +0800, Ming Lei wrote: > > On Thu, Jun 13, 2019 at 11:52:14AM +0200, Greg Kroah-Hartman wrote: > > > On Thu, Jun 13, 2019 at 03:13:28PM +0800, Ming Lei wrote: > > > > The current way isn't safe for chained sgl, so use sg helper to > > > > operate sgl. > > > > > > I can not make any sense out of this changelog. > > > > > > What "isn't safe"? What is a "sgl"? > > > > sgl is 'scatterlist' in kernel, and several linear sgl can be > > chained together, so accessing the sgl in linear way may see a > > chained sg, which is like a link pointer, then may cause trouble > > for driver. > > What kind of "trouble"? Is this a bug fix that needs to be > backported to stable kernels? How can this be triggered? OK, stop. I haven't seen the commit log since the original hasn't appeared on the list yet, but the changelog needs to say something like this to prevent questions like the above, as I asked in the last review. Please make it something like this: --- Scsi MQ makes a large static allocation for the first scatter gather list chunk for the driver to use. This is a performance headache we'd like to fix by reducing the size of the allocation to a 2 element array. Doing this will break the current guarantee that any driver using SG_ALL doesn't need to use the scatterlist iterators and can get away with directly dereferencing the array. Thus we need to update all drivers to use the scatterlist iterators and remove direct indexing of the scatterlist array before reducing the initial scatterlist allocation size in SCSI. --- James ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2 08/15] staging: unisys: visorhba: use sg helper to operate sgl 2019-06-13 10:04 ` Ming Lei 2019-06-13 10:16 ` Greg Kroah-Hartman @ 2019-06-13 10:24 ` Dan Carpenter 1 sibling, 0 replies; 6+ messages in thread From: Dan Carpenter @ 2019-06-13 10:24 UTC (permalink / raw) To: Ming Lei Cc: Michael Schmitz, devel, Hannes Reinecke, linux-scsi, Martin K . Petersen, Greg Kroah-Hartman, James Smart, Ewan D . Milne, Jim Gill, James Bottomley, Brian King, Finn Thain, Juergen E . Fischer, Christoph Hellwig, Bart Van Assche On Thu, Jun 13, 2019 at 06:04:11PM +0800, Ming Lei wrote: > On Thu, Jun 13, 2019 at 11:52:14AM +0200, Greg Kroah-Hartman wrote: > > On Thu, Jun 13, 2019 at 03:13:28PM +0800, Ming Lei wrote: > > > The current way isn't safe for chained sgl, so use sg helper to > > > operate sgl. > > > > I can not make any sense out of this changelog. > > > > What "isn't safe"? What is a "sgl"? > > sgl is 'scatterlist' in kernel, and several linear sgl can be chained > together, so accessing the sgl in linear way may see a chained sg, which > is like a link pointer, then may cause trouble for driver. > So from a user perspective it results in an Oops? It would be really cool if you had the copy of the Oops btw so people could grep the git history for it. (You need to resend with the improved commit message). regards, dan carpenter ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-06-13 15:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20190613071335.5679-1-ming.lei@redhat.com>
2019-06-13 7:13 ` [PATCH V2 08/15] staging: unisys: visorhba: use sg helper to operate sgl Ming Lei
2019-06-13 9:52 ` Greg Kroah-Hartman
2019-06-13 10:04 ` Ming Lei
2019-06-13 10:16 ` Greg Kroah-Hartman
2019-06-13 15:46 ` James Bottomley
2019-06-13 10:24 ` Dan Carpenter
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox