From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Hugh Dickins <hugh@veritas.com>
Cc: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
Andi Kleen <ak@suse.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: preempt bug in set_pmd_pfn?
Date: Wed, 05 Mar 2008 08:48:41 -0800 [thread overview]
Message-ID: <47CECEE9.3000801@goop.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0803051407310.22243@blonde.site>
Hugh Dickins wrote:
> Please, Ingo, could you give an example of where such additional locking
> is actually necessary?
>
> I ask because I went over those places when splitting the page_table_lock
> for userspace in 2.6.15. Some things took init_mm.page_table_lock and
> some things didn't, and I concluded that actually none of them needed it.
>
> With the userspace pagetables, we need to guard against racing threads
> and vmscan/rmap. But with the kernel pagetables, we'd already be in
> serious trouble if two cpus could be modifying the same pte at the
> same time - there needs to be other serialization already e.g. vmalloc
> has its own locking for parcelling out areas to different uses, so down
> at the page table level there should be no conflict.
>
> Allocation of new page tables, yes, that needs locking, and does use
> the page_table_lock for kernel space just as for user space.
>
> That was all two years ago, I may have been wrong then, or a lot may
> have changed since. But I've heard of a grand total of 0 problems
> from not having such locking.
>
It's not obvious to me what problems might arise, but the Xen set_pte
operations do currently rely on preemption being inhibited. At worst I
can add preempt_disable/enable calls to them.
> And on the original topic of flush TLB without preemption disabled:
> again I'm not sure there's a bug there, but it's less clear. Aren't
> some of those __flush_tlb_ones just unnecessary, we're simply filling
> a previously empty slot? And if there's a guarantee that preemption
> will itself involve a TLB flush (maybe there's no such guarantee for
> these kernel entries, it's quite a different case from the userspace
> one, and you'll be worrying about the global bit), if, then it'd be
> okay to __flush_tlb_one without disabling preemption.
If a thread goes from processor A -> B -> A, where A is first preempted
between a pagetable update and a tlb flush, then the second time the
thread runs on A may run with a stale tlb (if in the meantime A has
either been idle or only running kernel threads).
J
next prev parent reply other threads:[~2008-03-05 16:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-04 21:13 preempt bug in set_pmd_pfn? Jeremy Fitzhardinge
2008-03-04 21:28 ` Ingo Molnar
2008-03-04 21:27 ` Jeremy Fitzhardinge
2008-03-05 6:48 ` Ingo Molnar
2008-03-05 14:29 ` Hugh Dickins
2008-03-05 16:48 ` Jeremy Fitzhardinge [this message]
2008-03-05 17:38 ` Hugh Dickins
2008-03-05 19:18 ` Jeremy Fitzhardinge
2008-03-05 20:40 ` Hugh Dickins
2008-03-06 12:52 ` Ingo Molnar
2008-03-06 18:19 ` Jeremy Fitzhardinge
2008-03-05 16:45 ` Jeremy Fitzhardinge
2008-03-05 0:06 ` Andi Kleen
2008-03-05 0:07 ` Jeremy Fitzhardinge
2008-03-05 0:16 ` Andi Kleen
2008-03-05 0:19 ` Jeremy Fitzhardinge
2008-03-05 1:28 ` 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=47CECEE9.3000801@goop.org \
--to=jeremy@goop.org \
--cc=ak@suse.de \
--cc=hpa@zytor.com \
--cc=hugh@veritas.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