From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Harvey Harrison <harvey.harrison@gmail.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andi Kleen <ak@suse.de>
Subject: Re: [PATCH UPDATE] x86: ignore spurious faults
Date: Fri, 25 Jan 2008 10:39:28 -0800 [thread overview]
Message-ID: <479A2CE0.6060206@goop.org> (raw)
In-Reply-To: <20080125180828.GB10993@elte.hu>
Ingo Molnar wrote:
> spurious faults happen all the time on SMP, in the native kernel.
>
> And what i mean is that Linux mprotect currently does not take advantage
> of x86's ability to just change the ptes, because there's no structured
> way to tell mm/mprotect.c that "it's safe to skip the TLB flush here".
>
> The flush happens in mm/mprotect.c's change_protection() function:
>
> flush_tlb_range(vma, start, end);
>
> and that is unnecessary when we increase the protection rights, such as
> in a RO->RW change. (all that is needed is an smp_wmb() instead, to make
> sure all the pte modifications are visible when the syscall returns.)
>
> and it's a really rare case these days that you can find an area where
> Linux does not make use of a hardware MMU feature - so we should fix
> this ;-)
Well, I guess this isn't really specific to x86; we could always
legitimately not do a tlb flush after increasing permissions and leave
the fault handler to clean up the mess where needed. But I don't think
that's necessarily much of a win; it's cheaper to just do the tlb flush
rather than take a spurious fault, unless the faults are very rare. If
someone is doing an mprotect on a piece of memory (esp to make it
writable), my guess is that they're going to touch that memory in the
very near future.
The big win for this patch is avoiding cross-cpu tlb invalidation when
changing kernel mappings. mprotect doesn't attempt to do that anyway,
and so can incur spurious faults on other CPUs.
J
next prev parent reply other threads:[~2008-01-25 18:39 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-24 0:05 [PATCH] x86: ignore spurious faults Jeremy Fitzhardinge
2008-01-24 0:18 ` Harvey Harrison
2008-01-24 0:26 ` Jeremy Fitzhardinge
2008-01-24 0:28 ` [PATCH UPDATE] " Jeremy Fitzhardinge
2008-01-24 19:14 ` Matt Mackall
2008-01-24 19:21 ` Jeremy Fitzhardinge
2008-01-24 23:41 ` Nick Piggin
2008-01-25 0:26 ` Jeremy Fitzhardinge
2008-01-25 7:36 ` Keir Fraser
2008-01-25 8:15 ` Jan Beulich
2008-01-25 8:38 ` Nick Piggin
2008-01-25 9:11 ` Andi Kleen
2008-01-25 9:18 ` Keir Fraser
2008-01-25 9:51 ` Andi Kleen
2008-01-25 10:19 ` Andi Kleen
2008-01-25 13:17 ` Keir Fraser
2008-01-25 9:18 ` Jan Beulich
2008-01-25 15:30 ` Ingo Molnar
2008-01-25 15:54 ` Jeremy Fitzhardinge
2008-01-25 18:08 ` Ingo Molnar
2008-01-25 18:39 ` Jeremy Fitzhardinge [this message]
2008-01-24 6:49 ` [PATCH] " Andi Kleen
2008-01-24 7:02 ` Jeremy Fitzhardinge
2008-01-24 7:11 ` 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=479A2CE0.6060206@goop.org \
--to=jeremy@goop.org \
--cc=ak@suse.de \
--cc=harvey.harrison@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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