From: James Bottomley <James.Bottomley@steeleye.com>
To: Andi Kleen <ak@suse.de>
Cc: "David S. Miller" <davem@redhat.com>,
Linux Kernel <linux-kernel@vger.kernel.org>,
SCSI Mailing List <linux-scsi@vger.kernel.org>,
gibbs@scsiguy.com
Subject: Re: [BUG] x86_64 pci_map_sg modifies sg list - fails multiple map/unmaps
Date: 05 Jan 2004 18:05:47 -0600 [thread overview]
Message-ID: <1073347548.2439.33.camel@mulgrave> (raw)
In-Reply-To: <20040105223158.3364a676.ak@suse.de>
On Mon, 2004-01-05 at 15:31, Andi Kleen wrote:
> For the sake of bug-to-bug compatibility to the SCSI layer this patch may
> work. I haven't tested it so no guarantees if it won't eat your file systems.
> Feedback welcome anyways.
This isn't a bug in SCSI, it's a deliberate design feature. SCSI has
certain events, like QUEUE full that cause us to re-queue the pending
I/O. Other block layer drivers that can get these EAGAIN type queueing
problems from the device also follow this model.
The reason for doing this is the prep/request model for block drivers
(although the behaviour pre-dates the bio model). As part of the prep
function, we prepare the mapping list that is later passed to
dma_map_sg(). Requeueing is done from the request function; by design,
we don't re-prepare the requests (and hence don't free and rebuild the
sg list).
Like Dave says, we rely on the sequence map/unmap/map to produce a
correct SG list. This does give you slightly more leeway, since we
never look at the sg list after the unmap, for SCSI it doesn't have to
be returned to the pre-map state as long as re-mapping it is correct.
As to the idempotence of map/unmap: I'm ambivalent. If it's going to be
a performance hit to return the sg list to its prior state in unmap,
then it does seem a waste given that for most of our I/O transactions we
simply free the sg list after the unmap.
It looks like we're down to a choice of three
1. Fix the x86_64 mapping layer as your patch proposes (how much of a
performance hit on every transaction will this be)?
2. Change SCSI (and every other block driver) to re-prepare requeued
I/O. This will incur a free/setup overhead penalty, but only in the
requeue path.
3. Don't unmap the I/O in the requeue case. I like this least because
the LLD is responsible for map/unmap and the mid-layer is responsible
for requeueing, so it's a layering violation (as well as a waste of
potentially valuable mapping resources).
On the whole, I prefer 1. Partly because it doesn't involve extra work
for me ;-) but also because idempotence is an appealing property from a
layering point of view.
If we're agreed on this, I can add it to the DMA docs.
James
next prev parent reply other threads:[~2004-01-06 0:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200401051929.i05JTsM0000014248@mudpuddle.cs.wustl.edu.suse.lists.linux.kernel>
[not found] ` <20040105112800.7a9f240b.davem@redhat.com.suse.lists.linux.kernel>
2004-01-05 21:02 ` [BUG] x86_64 pci_map_sg modifies sg list - fails multiple map/unmaps Andi Kleen
2004-01-05 21:01 ` David S. Miller
2004-01-05 21:31 ` Andi Kleen
2004-01-05 21:40 ` [BUG] x86_64 pci_map_sg modifies sg list - fails multiple map/unmaps II Andi Kleen
2004-01-06 0:05 ` James Bottomley [this message]
2004-01-06 3:06 ` [BUG] x86_64 pci_map_sg modifies sg list - fails multiple map/unmaps Andi Kleen
2004-01-06 3:04 ` David S. Miller
2004-01-06 3:14 ` James Bottomley
2004-01-07 16:33 Berkley Shands
-- strict thread matches above, loose matches on Subject: below --
2004-01-07 15:35 Berkley Shands
2004-01-07 19:19 ` badari
[not found] <2938942704.1073325455@aslan.btc.adaptec.com.suse.lists.linux.kernel>
[not found] ` <m3brpi41q0.fsf@averell.firstfloor.org.suse.lists.linux.kernel>
[not found] ` <2997092704.1073333041@aslan.btc.adaptec.com.suse.lists.linux.kernel>
2004-01-05 20:58 ` Andi Kleen
2004-01-05 20:00 Berkley Shands
2004-01-05 19:29 Berkley Shands
2004-01-05 19:28 ` David S. Miller
2004-01-05 17:57 Justin T. Gibbs
2004-01-05 19:22 ` David S. Miller
2004-01-05 19:41 ` Badari Pulavarty
2004-01-05 19:47 ` Andi Kleen
2004-01-05 20:04 ` Justin T. Gibbs
2004-01-05 20:35 ` David S. Miller
2004-01-05 21:10 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1073347548.2439.33.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=ak@suse.de \
--cc=davem@redhat.com \
--cc=gibbs@scsiguy.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox