Re: [PATCH] SPARC64: fix iommu sg chaining

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <jens.axboe@...>
Cc: <fujita.tomonori@...>, <linux-kernel@...>, <linux-scsi@...>
Date: Wednesday, October 17, 2007 - 5:13 am

From: Jens Axboe <jens.axboe@oracle.com>
Date: Wed, 17 Oct 2007 10:45:28 +0200


Unfortunately, that's what the sparc64 code wanted to do, this
transformation in the sparc64 sg chaining patch is not equilavent:

-	struct scatterlist *sg_end = sg + nelems;
+	struct scatterlist *sg_end = sg_last(sg, nelems);
 ...
-			while (sg < sg_end &&
+			while (sg != sg_end &&

No, that's not what the code was doing.  The while loop
has to process the last entry in the list,

We really needed "sg_end" to be "one past the last element",
rather than "the last element".

Since you say that sg_next() on the last entry is illegal,
and that's what this code would have done to try and reach
loop termination (it doesn't actually derefrence that
"end plus one" scatterlist entry) I'll try to code this up
some other way.

Besides, sg_last() is so absurdly expensive, it has to walk the entire
chain in the chaining case.  So better to implement this without it.

I would suggest that other sg_last() uses be audited for the same bug.
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] SPARC64: fix iommu sg chaining, FUJITA Tomonori, (Wed Oct 17, 1:07 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, Jens Axboe, (Wed Oct 17, 3:21 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, David Miller, (Wed Oct 17, 4:33 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, David Miller, (Wed Oct 17, 4:42 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, Jens Axboe, (Wed Oct 17, 4:45 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, David Miller, (Wed Oct 17, 5:13 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, Jens Axboe, (Wed Oct 17, 5:16 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, David Miller, (Wed Oct 17, 6:54 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, Jens Axboe, (Wed Oct 17, 6:58 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, FUJITA Tomonori, (Wed Oct 17, 7:04 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, David Miller, (Wed Oct 17, 7:04 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, Jens Axboe, (Wed Oct 17, 7:04 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, Jens Axboe, (Wed Oct 17, 7:01 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, FUJITA Tomonori, (Wed Oct 17, 7:37 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, FUJITA Tomonori, (Wed Oct 17, 7:01 pm)
Re: [PATCH] SPARC64: fix iommu sg chaining, Jens Axboe, (Wed Oct 17, 7:41 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, FUJITA Tomonori, (Wed Oct 17, 7:57 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, FUJITA Tomonori, (Wed Oct 17, 8:05 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, Jens Axboe, (Wed Oct 17, 10:36 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, David Miller, (Wed Oct 17, 7:10 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, Jens Axboe, (Wed Oct 17, 7:11 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, David Miller, (Wed Oct 17, 7:18 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, Jens Axboe, (Wed Oct 17, 7:27 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, FUJITA Tomonori, (Wed Oct 17, 5:24 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, David Miller, (Wed Oct 17, 5:45 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, FUJITA Tomonori, (Wed Oct 17, 7:08 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, Jens Axboe, (Wed Oct 17, 7:13 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, Jens Axboe, (Wed Oct 17, 7:16 am)
Re: [PATCH] SPARC64: fix iommu sg chaining, Jens Axboe, (Wed Oct 17, 5:27 am)