Re: mmiotrace bug: recursive probe hit

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>, Ingo Molnar <mingo@...>
Cc: Pekka Paalanen <pq@...>, Christoph Hellwig <hch@...>, Arjan van de Ven <arjan@...>, Pavel Roskin <proski@...>, Steven Rostedt <rostedt@...>, Peter Zijlstra <a.p.zijlstra@...>, <penberg@...>, <vegard.nossum@...>
Date: Sunday, March 30, 2008 - 1:26 pm

On Fri, 28 Mar 2008 22:25:00 +0200
Pekka Paalanen <pq@iki.fi> wrote:


It appears this happens:

          CPU 0           CPU 1
 ,--->  fault           fault
 |      disarm          disarm
 |                      single step
 |                      arm
 |      single step
 '--------'
        arm

and the both cpus are faulting on the same page. I guess one cpu is running
an nvidia interrupt service.
I see three possible solutions:

A) Like in this patch, just disarm again and hope for the best.
Seems to work ok. I also compare the fault address to the saved address
ctx->addr. If they are equal, it is a "double probe hit" and harmless.
If they are not equal, it is a real "recursive probe hit" and something
more is wrong. With these definitions, recursive probe hits are gone in
my experiments on Intel Core 2 Duo.


B) Acquire a spinlock in kmmio_handler() and release it in
post_kmmio_handler(). I don't like this one since I spent some effort
making the fault path spinlockless, but at least this would be a
completely separate spinlock. Or we could use per-page spinlocks.

C) Vegard mentioned something about per-cpu page tables for kmemcheck.
This would be the ultimate solution, because it would solve two problems:
- recursive probe hits
- missed events due to another cpu disarming the page for single stepping
Would it be possible to have a single temporary per-cpu pte?

I understood kmemcheck has similar issues. Of course, one could force the
system down to a single running CPU, but that feels nasty.

Which way to go?
I choose A) as the current workaround, keeping in mind that I will loose
events on SMP. C) would be the only reliable SMP solution on tracing point
of view.


Thanks.

-- 
Pekka Paalanen
http://www.iki.fi/pq/
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC] mmiotrace full patch, preview 2, Pekka Paalanen, (Sun Mar 9, 10:40 am)
mmiotrace bug: recursive probe hit, Pekka Paalanen, (Fri Mar 28, 4:25 pm)
Re: mmiotrace bug: recursive probe hit, Pekka Paalanen, (Sun Mar 30, 1:26 pm)
Re: mmiotrace bug: recursive probe hit, Pekka Paalanen, (Thu Apr 3, 5:07 pm)
Re: mmiotrace bug: recursive probe hit, Avi Kivity, (Sat Apr 5, 3:36 am)
Re: mmiotrace bug: recursive probe hit, Pekka Paalanen, (Sun Apr 6, 1:32 pm)
Re: mmiotrace bug: recursive probe hit, Pekka Enberg, (Sat Apr 5, 3:40 am)
Re: mmiotrace bug: recursive probe hit, Avi Kivity, (Sat Apr 5, 8:39 am)
Re: mmiotrace bug: recursive probe hit, Avi Kivity, (Sat Apr 5, 11:58 am)
Re: mmiotrace bug: recursive probe hit, Vegard Nossum, (Thu Apr 3, 5:40 pm)
Re: mmiotrace bug: recursive probe hit, Pekka Paalanen, (Fri Apr 4, 9:18 am)
Re: [RFC] mmiotrace full patch, preview 2, Vegard Nossum, (Thu Mar 27, 7:13 pm)
Re: [RFC] mmiotrace full patch, preview 2, Pekka Paalanen, (Fri Mar 28, 2:24 pm)
Re: [RFC] mmiotrace full patch, preview 2, Pekka Paalanen, (Sun Mar 9, 10:46 am)