LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
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 11:18:37 -0800	[thread overview]
Message-ID: <47CEF20D.5070608@goop.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0803051721200.13410@blonde.site>

Hugh Dickins wrote:
> On Wed, 5 Mar 2008, Jeremy Fitzhardinge wrote:
>   
>> 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).
>>     
>
> Right, thanks, because __flush_tlb_one opts out of the full active_mm
> checking which goes on for userspace mms (which covers, for example,
> the case of preemption before dup_mmap's flush_tlb_mm).
>
> But is there actually a case where there's a problem?  So far as I can see,
> set_pmd_pfn is there solely for discontig_32's __init remap_numa_kva; and
> set_pte_pfn is there solely for set_fixmap, which operates on a per-cpu
> area of pagetable, which would already be in bigger trouble if preemption
> to another cpu were possible.

Yes, I meant set_pte_pfn; set_pmd_pfn is a typo.

Fixmap slots are global, not percpu; you may be thinking of kmap_atomic, 
which reserves percpu fixmap slots for its use.  Most uses of set_fixmap 
are early in boot, where preemption (or other CPUs) isn't a factor.  The 
exception is mapping the compat vdso global mapping.   However, that is 
special-cased anyway, since the set_fixmap is followed by an explicit 
all-cpu tlb flush.

It seems to me that the correct fix is to just make __set_fixmap disable 
preemption for its duration; it probably doesn't make much difference 
for the native case, and it makes Xen happy.

    J

  reply	other threads:[~2008-03-05 19:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-04 21:13 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
2008-03-05 17:38           ` Hugh Dickins
2008-03-05 19:18             ` Jeremy Fitzhardinge [this message]
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=47CEF20D.5070608@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 \
    --subject='Re: preempt bug in set_pmd_pfn?' \
    /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

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).