From: Andrea Arcangeli <andrea@suse.de>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Andrew Morton <akpm@osdl.org>,
Linux Kernel list <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@elte.hu>, Ben LaHaise <bcrl@kvack.org>,
linux-mm@kvack.org,
Architectures Group <linux-arch@vger.kernel.org>
Subject: Re: [PATCH] ppc64: Fix possible race with set_pte on a present PTE
Date: Tue, 25 May 2004 06:20:54 +0200 [thread overview]
Message-ID: <20040525042054.GU29378@dualathlon.random> (raw)
In-Reply-To: <Pine.LNX.4.58.0405242051460.32189@ppc970.osdl.org>
On Mon, May 24, 2004 at 09:00:02PM -0700, Linus Torvalds wrote:
>
>
> On Tue, 25 May 2004, Andrea Arcangeli wrote:
> >
> > The below patch should fix it, the only problem is that it can screwup
> > some arch that might use page-faults to keep track of the accessed bit,
>
> Indeed. At least alpha does this - that's where this code came from. SO
> this will cause infinite page faults on alpha and any other "accessed bit
> in software" architectures.
as you say the alpha has no accessed bit at all in hardware, so
it cannot generate page faults.
"accessed bit in software" is fine with my fix.
the only architecture that has the accessed bit in _hardware_ via page
faults I know is ia64, but I don't know if it has a mode to set it
without page faults and how it is implementing the accessed bit in linux.
Everything else either has it in hardware trasparently set by the cpu
(like x86) in the pte, or in software (like alpha). Either ways it's
fine.
> I suspect we should just make a "ptep_set_bits()" inline function that
> _atomically_ does "set the dirty/accessed bits". On x86, it would be a
> simple
>
> asm("lock ; orl %1,%0"
> :"m" (*ptep)
> :"r" (entry));
>
> and similarly on most other architectures it should be quite easy to do
> the equivalent. You can always do it with a simple compare-and-exchange
> loop, something any SMP-capable architecture should have.
>
> Of course, arguably we can actually optimize this by "knowing" that it is
> safe to set the dirty bit, so then we don't even need an atomic operation,
> we just need one atomic write. So we only actually need the atomic op for
> the accessed bit case, and if we make the write-case be totally separate..
on x86 there's no point to use atomic ops in the write_access path and
there's no point to do anything in the read path.
The only issue are the archs that may generate page faults for young bit
clear and for those we should simply add a:
ptep_atomic_set_young(pte)
right before the pte_unmap, the tlb flush is not needed of course (they
are generating active page faults so they will re-check).
But before adding the above operation, I'd wait to hear if any
architecture is really using _hardware_ page faults for the accessed bit
in linux.
Then it also depends if this is the only buggy place or if there are
others, but certainly this one doesn't need atomic ops on x86* and alpha
(that's the only two I'm 100% sure about ;).
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>
next prev parent reply other threads:[~2004-05-25 4:20 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1085369393.15315.28.camel@gaston>
[not found] ` <Pine.LNX.4.58.0405232046210.25502@ppc970.osdl.org>
[not found] ` <1085371988.15281.38.camel@gaston>
[not found] ` <Pine.LNX.4.58.0405232134480.25502@ppc970.osdl.org>
[not found] ` <1085373839.14969.42.camel@gaston>
2004-05-24 5:10 ` Linus Torvalds
2004-05-24 5:34 ` Benjamin Herrenschmidt
2004-05-24 5:38 ` Benjamin Herrenschmidt
2004-05-24 5:52 ` Benjamin Herrenschmidt
2004-05-24 7:39 ` Ingo Molnar
2004-05-24 5:39 ` Benjamin Herrenschmidt
2004-05-25 3:43 ` Andrea Arcangeli
2004-05-25 4:00 ` Linus Torvalds
2004-05-25 4:17 ` Benjamin Herrenschmidt
2004-05-25 4:37 ` Andrea Arcangeli
2004-05-25 4:40 ` Benjamin Herrenschmidt
2004-05-25 4:20 ` Andrea Arcangeli [this message]
2004-05-25 4:39 ` Linus Torvalds
2004-05-25 4:44 ` Linus Torvalds
2004-05-25 4:59 ` Andrea Arcangeli
2004-05-25 5:09 ` Andrea Arcangeli
2004-05-25 4:50 ` Andrea Arcangeli
2004-05-25 4:59 ` Linus Torvalds
2004-05-25 4:43 ` David Mosberger
2004-05-25 4:53 ` Andrea Arcangeli
2004-05-27 21:56 ` David Mosberger
2004-05-27 22:00 ` Benjamin Herrenschmidt
2004-05-27 22:12 ` David Mosberger
2004-05-25 11:44 ` Matthew Wilcox
2004-05-25 14:48 ` Linus Torvalds
2004-05-25 15:35 ` Keith M Wesolowski
2004-05-25 16:19 ` Linus Torvalds
2004-05-25 17:25 ` David S. Miller
2004-05-25 17:49 ` Linus Torvalds
2004-05-25 17:54 ` David S. Miller
2004-05-25 18:05 ` Linus Torvalds
2004-05-25 20:30 ` Linus Torvalds
2004-05-25 20:35 ` David S. Miller
2004-05-25 20:49 ` Linus Torvalds
2004-05-25 20:57 ` David S. Miller
2004-05-26 6:20 ` Keith M Wesolowski
2004-05-25 21:40 ` Benjamin Herrenschmidt
2004-05-25 21:54 ` Linus Torvalds
2004-05-25 22:00 ` Linus Torvalds
2004-05-25 22:07 ` Benjamin Herrenschmidt
2004-05-25 22:14 ` Linus Torvalds
2004-05-26 0:21 ` Benjamin Herrenschmidt
2004-05-26 0:50 ` Linus Torvalds
2004-05-26 3:25 ` Benjamin Herrenschmidt
2004-05-26 4:08 ` Linus Torvalds
2004-05-26 4:12 ` Benjamin Herrenschmidt
2004-05-26 4:18 ` Benjamin Herrenschmidt
2004-05-26 4:50 ` Linus Torvalds
2004-05-26 4:49 ` Benjamin Herrenschmidt
2004-05-26 4:28 ` Linus Torvalds
2004-05-26 4:46 ` Benjamin Herrenschmidt
2004-05-26 4:54 ` Linus Torvalds
2004-05-26 4:55 ` Benjamin Herrenschmidt
2004-05-26 5:41 ` Benjamin Herrenschmidt
2004-05-26 5:59 ` [PATCH] (signoff) " Benjamin Herrenschmidt
2004-05-26 6:55 ` Benjamin Herrenschmidt
2004-05-25 22:05 ` [PATCH] " Benjamin Herrenschmidt
2004-05-25 22:09 ` Linus Torvalds
2004-05-25 22:19 ` Benjamin Herrenschmidt
2004-05-25 22:24 ` Linus Torvalds
2004-05-25 21:27 ` Andrea Arcangeli
2004-05-25 21:43 ` Linus Torvalds
2004-05-25 21:55 ` Andrea Arcangeli
2004-05-25 22:01 ` Linus Torvalds
2004-05-25 22:18 ` Ivan Kokshaysky
2004-05-25 22:42 ` Andrea Arcangeli
2004-05-26 2:26 ` Linus Torvalds
2004-05-26 7:06 ` Andrea Arcangeli
2004-05-25 21:44 ` Andrea Arcangeli
2004-06-01 12:04 Martin Schwidefsky
2004-06-01 12:10 Martin Schwidefsky
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=20040525042054.GU29378@dualathlon.random \
--to=andrea@suse.de \
--cc=akpm@osdl.org \
--cc=bcrl@kvack.org \
--cc=benh@kernel.crashing.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@elte.hu \
--cc=torvalds@osdl.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