From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH v2] prevent top pte being overwritten before flushing
Date: Wed, 17 Oct 2012 10:39:16 +0100 [thread overview]
Message-ID: <20121017093916.GA5973@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <CANj_sbCbdfvgkKXJjk4L_5Rk-4mQ-zqDqMErry-AzHddDb8WYA@mail.gmail.com>
On Wed, Oct 17, 2012 at 09:42:19AM +0100, Andrew Yan-Pai Chen wrote:
> On Mon, Oct 15, 2012 at 1:42 AM, Andrew Yan-Pai Chen
> <yanpai.chen@gmail.com> wrote:
> > +static DEFINE_RAW_SPINLOCK(flush_lock);
> > +
> > +/* Beware that this function is not to be called for SMP setups. */
> > static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr)
> > {
> > unsigned long to = FLUSH_ALIAS_START + (CACHE_COLOUR(vaddr) <<
> > PAGE_SHIFT);
> > const int zero = 0;
> >
> > + preempt_disable();
> > set_top_pte(to, pfn_pte(pfn, PAGE_KERNEL));
> >
> > asm( "mcrr p15, 0, %1, %0, c14\n"
> > @@ -34,6 +39,8 @@ static void flush_pfn_alias(unsigned long pfn, unsigned
> > long vaddr)
> > :
> > : "r" (to), "r" (to + PAGE_SIZE - L1_CACHE_BYTES), "r" (zero)
> > : "cc");
> > +
> > + preempt_enable();
> > }
> >
> > static void flush_icache_alias(unsigned long pfn, unsigned long vaddr,
> > unsigned long len)
> > @@ -42,9 +49,13 @@ static void flush_icache_alias(unsigned long pfn,
> > unsigned long vaddr, unsigned
> > unsigned long offset = vaddr & (PAGE_SIZE - 1);
> > unsigned long to;
> >
> > + raw_spin_lock(&flush_lock);
> > +
> > set_top_pte(va, pfn_pte(pfn, PAGE_KERNEL));
> > to = va + offset;
> > flush_icache_range(to, to + len);
> > +
> > + raw_spin_unlock(&flush_lock);
> > }
> >
> > void flush_cache_mm(struct mm_struct *mm)
> > --
> > 1.7.4.1
> >
>
> Hi all,
>
> Any ideas?
I wonder if we could use different ptes for each CPU (by hacking
pte_offset_kernel) and then get away with just disabling preemption in both
cases?
Will
next prev parent reply other threads:[~2012-10-17 9:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-14 17:42 [RFC PATCH v2] prevent top pte being overwritten before flushing Andrew Yan-Pai Chen
2012-10-17 8:42 ` Andrew Yan-Pai Chen
2012-10-17 9:39 ` Will Deacon [this message]
2012-10-17 9:54 ` Jason Lin
2012-10-17 9:57 ` Will Deacon
2012-10-22 8:35 ` Andrew Yan-Pai Chen
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=20121017093916.GA5973@mudshark.cambridge.arm.com \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).