From: Russell King <rmk+lkml@arm.linux.org.uk>
To: James Bottomley <James.Bottomley@SteelEye.com>
Cc: Tejun Heo <htejun@gmail.com>, Jens Axboe <axboe@suse.de>,
Dave Miller <davem@redhat.com>,
bzolnier@gmail.com, james.steward@dynamicratings.com,
jgarzik@pobox.com, mattjreimer@gmail.com,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
lkml <linux-kernel@vger.kernel.org>,
linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCHSET] block: fix PIO cache coherency bug, take 2
Date: Mon, 5 Jun 2006 15:44:56 +0100 [thread overview]
Message-ID: <20060605144456.GA26666@flint.arm.linux.org.uk> (raw)
In-Reply-To: <1149517656.3489.15.camel@mulgrave.il.steeleye.com>
On Mon, Jun 05, 2006 at 09:27:36AM -0500, James Bottomley wrote:
> On Sun, 2006-06-04 at 23:23 +0100, Russell King wrote:
> > I'll add to this statement that the cache flushing on ARM is only
> > ever required when the page ends up in userspace - if we're reading
> > a page into the page cache to throw it out via NFS or sendfile then
> > the cache flush is a complete waste of time.
>
> Right .. and this is the scenario. There are two cases where devices
> kmap a user page into kernel space and then proceed to read from or
> write to it (flush_dcache_page() is specifically for the latter because
> the user won't see the data the kernel just wrote unless this happens
> because kernel and user addresses aren't congruent on parisc).
>
> The first case is manufactured data (such as command emulation) and the
> second is pio data rather than DMA (such as command re-completion or
> IDE).
When a user program wants to obtain data from a block device, there are
two ways it goes about it:
1. via read(). Read copies the data out of the kernel mapping of the
page cache, so there's no coherency issues as far as PIO is concerned.
2. via a page which has been mmap()'d. In this case, we are performing a
"PIO read from device write" operation to page to fill the page cache
with data, which must complete _before_ we hand the page to userspace.
In neither case will the page be available to the user before the PIO
operation has been completed - if it was, there would be one very big
security hole since the previous data would be visible.
Hence I find your comment "There are two cases where devices kmap a
user page into kernel space and then proceed to read from or write to
it" to be misleading - at the exact point in time that the device
driver is manipulating the data in that page, it is not a user page.
> > In this respect, I continue to believe that the way ARM (in principle)
> > does flush_dcache_page() is what is required here - if the page has
> > not been mapped into userspace, it merely marks the page as containing
> > dirty cache lines, and the resulting cache maintainence will only
> > happen when (and if) the page really does get mapped into userspace.
>
> For this particular scenario, the page is almost always mapped initially
> in user space because the user is requesting the I/O to a given
> userspace address ...
Here we fundamentally disagree - and I'm afraid that it seems that you
didn't actually read what I wrote since there's an obvious disparity
between me saying "if the page has not been mapped into userspace" and
you saying "the page is almost always mapped initially in user space" -
we're _definitely_ talking about different things here.
How can we proceed with this if this kind of misintepretation is rampant?
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
next prev parent reply other threads:[~2006-06-05 14:45 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-04 3:41 [PATCHSET] block: fix PIO cache coherency bug, take 2 Tejun Heo
2006-06-04 3:41 ` [PATCH 1/5] arm: implement flush_kernel_dcache_page() Tejun Heo
2006-06-04 3:49 ` [PATCH 1/5] (REPOST) " Tejun Heo
2006-06-04 6:45 ` [PATCH 1/5] " David Miller
2006-06-04 6:53 ` Tejun Heo
2006-06-04 7:04 ` David Miller
2006-06-04 3:41 ` [PATCH 5/5] md: add cpu cache flushes after kmapping and modifying a page Tejun Heo
2006-06-04 3:41 ` [PATCH 4/5] SCSI: " Tejun Heo
2006-06-04 8:20 ` Christoph Hellwig
2006-06-04 9:13 ` Tejun Heo
2006-06-04 20:24 ` Guennadi Liakhovetski
2006-06-04 3:41 ` [PATCH 2/5] ide: " Tejun Heo
2006-06-04 8:17 ` Christoph Hellwig
2006-06-04 9:09 ` Tejun Heo
2006-06-04 3:41 ` [PATCH 3/5] libata: " Tejun Heo
2006-06-04 20:44 ` [PATCHSET] block: fix PIO cache coherency bug, take 2 Russell King
2006-06-04 22:23 ` Russell King
2006-06-05 14:27 ` James Bottomley
2006-06-05 14:44 ` Russell King [this message]
2006-06-05 15:24 ` James Bottomley
2006-06-05 15:34 ` Russell King
2006-06-05 15:47 ` James Bottomley
2006-06-05 15:48 ` Russell King
2006-06-05 16:16 ` James Bottomley
2006-06-05 16:37 ` Russell King
2006-06-05 13:43 ` James Bottomley
2006-06-06 11:00 ` Miklos Szeredi
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=20060605144456.GA26666@flint.arm.linux.org.uk \
--to=rmk+lkml@arm.linux.org.uk \
--cc=James.Bottomley@SteelEye.com \
--cc=axboe@suse.de \
--cc=bzolnier@gmail.com \
--cc=davem@redhat.com \
--cc=g.liakhovetski@gmx.de \
--cc=htejun@gmail.com \
--cc=james.steward@dynamicratings.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mattjreimer@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).