From: Catalin Marinas <catalin.marinas@arm.com>
To: James Bottomley <James.Bottomley@suse.de>
Cc: David Miller <davem@davemloft.net>,
jgarzik@pobox.com, akpm@linux-foundation.org, jeff@garzik.org,
linux-ide@vger.kernel.org, stable@kernel.org, tj@kernel.org
Subject: Re: [patch for 2.6.33? 1/1] ata: call flush_dcache_page() around PIO data transfers in libata-aff.c
Date: Wed, 03 Feb 2010 10:18:45 +0000 [thread overview]
Message-ID: <1265192325.1970.28.camel@pc1117.cambridge.arm.com> (raw)
In-Reply-To: <1265153568.2800.815.camel@mulgrave.site>
On Tue, 2010-02-02 at 23:32 +0000, James Bottomley wrote:
> On Tue, 2010-02-02 at 15:21 -0800, David Miller wrote:
> > From: Jeff Garzik <jgarzik@pobox.com>
> > Date: Tue, 02 Feb 2010 18:14:40 -0500
> >
> > > The patch in question only affects PIO transfers, not DMA. Data is
> > > transferred from a kernel buffer to hardware via out[bwl] via
> > >
> > > page data -> CPU register -> out[bwl]
> > >
> > > or, data is transferred from hardware to a kernel buffer via
> > >
> > > in[bwl] -> CPU register -> page data
> > >
> > > So what are the flushing rules given those conditions?
> >
> > Any time you touch a page cache page with the cpu, you have
> > to get it purged from aliasing caches before it gets mapped
> > into userspace or similar.
> >
> > That's the problem on these machines.
> >
> > Actually, sparc64 is probably susceptible to the same problem.
> >
> > And it's not an issue in the IDE layer, know why? :-)
> >
> > In the IDE layer we have arch specific ide_*() interfaces which is
> > where all of this PIO dma flushing stuff deserves to live.
> >
> > ATA should do something similar instead of randomly scattering
> > flush_dcache_page() calls all over the place.
>
> Agree with this, except it shouldn't be ide specific ... any driver that
> does PIO (we have some examples in SCSI) is vulnerable to this issue and
> should have the same fix.
>
> The ide interfaces are very low level .. they're the ide_in/out[sw] APIs
> which aren't necessarily the most useful (some of the SCSI "PIO" stuff
> actually gets fed in via memory transfers to registers rather than port
> in/out).
>
> What it looks like we need is kmap_for_pio() and kunmap_for_pio() which
> take flags (or API extensions) indicating whether we're transferring to
> or from the device, which return the correct kernel address to the page
> (mapping it if it's in highmem) and perform the correct
> flushes/invalidates.
In a similar patch for dealing with a PIO USB HCD driver (ISP1760) I
suggested something like pio_map_single/pio_unmap_single similar to the
dma_* API. The problem with the HCD drivers is that the page information
is lost when they are called. They only have access to a
urb->transfer_buffer pointer and you can never know whether it is a
highmem one or not. Hence I think an API that deals directly with
pointers rather than page structures would be better.
If you are OK with the idea, I'm happy to propose a patch on linux-arch.
Thanks for the feedback so far.
--
Catalin
next prev parent reply other threads:[~2010-02-03 10:32 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-02 22:11 [patch for 2.6.33? 1/1] ata: call flush_dcache_page() around PIO data transfers in libata-aff.c akpm
2010-02-02 22:58 ` James Bottomley
2010-02-02 23:05 ` Andrew Morton
2010-02-02 23:14 ` Jeff Garzik
2010-02-02 23:21 ` James Bottomley
2010-02-02 23:21 ` David Miller
2010-02-02 23:30 ` Alan Cox
2010-02-02 23:32 ` James Bottomley
2010-02-02 23:39 ` David Miller
2010-02-03 10:18 ` Catalin Marinas [this message]
2010-02-03 16:40 ` James Bottomley
2010-02-03 17:00 ` Jeff Garzik
2010-02-03 17:06 ` Andrew Morton
2010-02-03 17:15 ` Jeff Garzik
2010-02-03 17:20 ` Andrew Morton
2010-02-03 17:29 ` Jeff Garzik
2010-02-03 17:39 ` James Bottomley
2010-02-04 14:33 ` Catalin Marinas
2010-02-04 15:01 ` James Bottomley
2010-02-04 15:39 ` Catalin Marinas
2010-02-04 21:36 ` James Bottomley
2010-02-03 17:40 ` Alan Cox
2010-02-03 17:46 ` Alan Cox
2010-02-03 17:52 ` Jeff Garzik
2010-02-03 18:00 ` Alan Cox
2010-02-03 18:12 ` Jeff Garzik
2010-02-03 17:49 ` Catalin Marinas
2010-02-03 17:54 ` Jeff Garzik
2010-02-03 17:09 ` David Miller
2010-02-02 23:14 ` James Bottomley
2010-02-03 10:07 ` Catalin Marinas
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=1265192325.1970.28.camel@pc1117.cambridge.arm.com \
--to=catalin.marinas@arm.com \
--cc=James.Bottomley@suse.de \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=jeff@garzik.org \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--cc=stable@kernel.org \
--cc=tj@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