]> nv-tegra.nvidia Code Review - linux-2.6.git/commit
x86/mm: do not trigger a kernel warning if user-space disables interrupts and generat...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 12 Oct 2008 20:16:12 +0000 (13:16 -0700)
committerIngo Molnar <mingo@elte.hu>
Mon, 13 Oct 2008 15:46:39 +0000 (17:46 +0200)
commit891cffbd6bcba26409869c19c07ecd4bfc0c2460
treecddf5286aedb76eecffd976101273e66858c4a23
parent4480f15b3306f43bbb0310d461142b4e897ca45b
x86/mm: do not trigger a kernel warning if user-space disables interrupts and generates a page fault

Arjan reported a spike in the following bug pattern in v2.6.27:

   http://www.kerneloops.org/searchweek.php?search=lock_page

which happens because hwclock started triggering warnings due to
a (correct) might_sleep() check in the MM code.

The warning occurs because hwclock uses this dubious sequence of
code to run "atomic" code:

  static unsigned long
  atomic(const char *name, unsigned long (*op)(unsigned long),
         unsigned long arg)
  {
    unsigned long v;
    __asm__ volatile ("cli");
    v = (*op)(arg);
    __asm__ volatile ("sti");
    return v;
  }

Then it pagefaults in that "atomic" section, triggering the warning.

There is no way the kernel could provide "atomicity" in this path,
a page fault is a cannot-continue machine event so the kernel has to
wait for the page to be filled in.

Even if it was just a minor fault we'd have to take locks and might have
to spend quite a bit of time with interrupts disabled - not nice to irq
latencies in general.

So instead just enable interrupts in the pagefault path unconditionally
if we come from user-space, and handle the fault.

Also, while touching this code, unify some trivial parts of the x86
VM paths at the same time.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Reported-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/mm/fault.c