[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090616030522.GA22162@Krystal>
Date: Mon, 15 Jun 2009 23:05:22 -0400
From: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Ingo Molnar <mingo@...e.hu>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Linus Torvalds <torvalds@...ux-foundation.org>,
mingo@...hat.com, paulus@...ba.org, acme@...hat.com,
linux-kernel@...r.kernel.org, penberg@...helsinki.fi,
vegard.nossum@...il.com, efault@....de, jeremy@...p.org,
npiggin@...e.de, tglx@...utronix.de,
linux-tip-commits@...r.kernel.org
Subject: Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain
support to use NMI-safe methods
* H. Peter Anvin (hpa@...or.com) wrote:
> Mathieu Desnoyers wrote:
> >
> > Where is the kernel page fault handler grabbing any lock to service
> > in-kernel page faults exactly ?
> >
> > Those are usually considered as utterly simple page table fixups,
> > nothing more.
> >
>
> It doesn't, *because it doesn't have to*. Your proposal requires that
> page faults can be handled inside the page fault handler, and that's a
> pretty tall order.
>
> -hpa
>
I am not asking for the pf handler to handle every possible kind of
fault recursively. Just to keep the in-kernel page fault related code
for vmalloc (and possibly for prefetch ?) paths NMI-reentrant :
void do_page_fault(struct pt_regs *regs, unsigned long error_code)
address = read_cr2();
if (unlikely(kmmio_fault(regs, address)))
return;
#ifdef CONFIG_X86_32
if (unlikely(address >= TASK_SIZE)) {
#else
if (unlikely(address >= TASK_SIZE64)) {
#endif
if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) &&
vmalloc_fault(address) >= 0)
return;
/* Can handle a stale RO->RW TLB */
if (spurious_fault(address, error_code))
return;
/* kprobes don't want to hook the spurious faults. */
if (notify_page_fault(regs))
return;
/*
* Don't take the mm semaphore here. If we fixup a prefetch
* fault we could otherwise deadlock.
*/
goto bad_area_nosemaphore;
}
This includes vmalloc_fault. Note that I already looked into
vmalloc_fault to ensure it could handle NMIs on x86_64 as well. See
commit bdd5ea31e79fed76eb57d0cd797355267f4f4a8c. It seems I missed the
cr2 register issue though. I assumed NMI handler to save it somehow,
which ends up not being the case.
Mathieu
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists