From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: John David Anglin <dave.anglin@bell.net>
Cc: Helge Deller <deller@gmx.de>,
linux-parisc@vger.kernel.org, Benjamin LaHaise <bcrl@kvack.org>,
Simon Baatz <gmbnomis@gmail.com>,
linux-aio@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] aio: fix D-cache aliasing issues
Date: Sun, 17 Nov 2013 17:50:57 -0800 [thread overview]
Message-ID: <1384739457.2050.28.camel@dabdike.int.hansenpartnership.com> (raw)
In-Reply-To: <BLU0-SMTP3886F78E435CD570327E2797E40@phx.gbl>
On Sun, 2013-11-17 at 20:15 -0500, John David Anglin wrote:
> On 17-Nov-13, at 7:52 PM, James Bottomley wrote:
>
> >> +void flush_user_dcache_page(struct page *page);
> >> +
> >
> > The split into flush_kernel.. and flush_user.. is pointless. We
> > have no
> > use for a flush_user_.. API because it's not part of the standard
> > linux
> > one. Plus it's going to confuse those who come after us no end
> > because
> > now we're different from every other architecture.
>
> I introduced it because it seemed to be what was needed on parisc when
> we map a kernel page on PA8800/PA8900. We need this to ensure what the
> kernel sees is up to date and also to ensure that we don't create
> inequivalent
> aliases between the user and kernel mappings.
>
> >
> >> #define flush_kernel_dcache_range(start,size) \
> >> flush_kernel_dcache_range_asm((start), (start)+(size));
> >> /* vmap range flushes and invalidates. Architecturally, we don't
> >> need
> >> @@ -125,18 +127,27 @@ flush_anon_page(struct vm_area_struct *vma,
> >> struct page *page, unsigned long vma
> >> void mark_rodata_ro(void);
> >> #endif
> >>
> >> -#ifdef CONFIG_PA8X00
> >> -/* Only pa8800, pa8900 needs this */
> >> -
> >> #include <asm/kmap_types.h>
> >>
> >> #define ARCH_HAS_KMAP
> >>
> >> -void kunmap_parisc(void *addr);
> >> +static inline void kmap_parisc(struct page *page)
> >> +{
> >> + if (parisc_requires_coherency())
> >> + flush_user_dcache_page(page);
> >> +}
> >
> > No ... if we're genuinely moving coherency into kmap/kunmap, this
> > has to
> > become
> >
> > flush_dcache_page(page);
> >
> > unconditionally.
>
> There are two things about flush_dcache_page(page):
>
> 1) The flush could be deferred. I don't think we want that.
Our deferred flush logic seems a bit bogus to me. We set a flag that
causes a kernel page flush in invalidate_kernel_vmap_range(). However,
when that function is called we checked this on a page by page bases and
if set we flush the page then we then go and do a dcache flush on the
entire range ... that's got to be wrong. I also can't really see what
the check for mapping && !mapping_mapped() is about. Mapping != NULL
means shared mappings with user space !mapping_mapped() means no file
backing (so they must be some form of anonymous vma). Even if we got
the deferred logic right, I don't think we can avoid flushing in the
anon_vma case
> 2) It seems to unnecessarily call flush_kernel_dcache_page().
Remember flush on parisc is flush and invalidate. We do need to
invalidate the kernel page in flush_dcache_page() just in case there are
any read only speculated cache lines above it. I agree there shouldn't
be any dirty cache lines above it in kernel space.
James
next prev parent reply other threads:[~2013-11-18 1:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-15 22:05 Helge Deller
2013-11-15 22:42 ` James Bottomley
2013-11-16 20:07 ` Simon Baatz
2013-11-16 20:09 ` Benjamin LaHaise
2013-11-17 21:23 ` Helge Deller
2013-11-17 21:49 ` James Bottomley
2013-11-17 23:47 ` Helge Deller
2013-11-18 0:52 ` James Bottomley
2013-11-18 1:15 ` John David Anglin
2013-11-18 1:50 ` James Bottomley [this message]
2013-11-18 1:03 ` John David Anglin
2013-11-18 10:54 ` Simon Baatz
2013-11-18 11:24 ` Aw: " Helge Deller
2013-11-16 22:06 ` James Bottomley
2013-11-16 22:32 ` John David Anglin
2013-11-16 22:37 ` James Bottomley
2013-11-16 22:49 ` John David Anglin
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=1384739457.2050.28.camel@dabdike.int.hansenpartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=bcrl@kvack.org \
--cc=dave.anglin@bell.net \
--cc=deller@gmx.de \
--cc=gmbnomis@gmail.com \
--cc=linux-aio@kvack.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@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
all inboxes | Powered by JetHome®