Hello everyone,

I have spent part of today with my buddy Phil debugging some overflow
problem on MIPS. The problem is related to the very subtle issue of
overflows in-flight during context switch out in per-thread mode.

As you know, there is no way to cancel an interrupt. PMU interrupts can
happen up to the point where the kernel masks all interrupts during the
context switch. In you are monitoring at the kernel level, this can happen
all the way until spin_lock_irqsave(). But then, the interrupt will not be
delivered to the thread that generated it and this is a major issue in perfmon.

Perfmon cannot afford to lose interrupts because it uses them to emulate
64 bit counters. Thus, if you lose an interrupt, you loose up to the
width of the counter in the final count. This is a known issue with per-thread
monitoring.

Perfmon takes care of it very meticulously during context switch.
During context switch out, perfmon saves the current overflow
status of the counters into a bitmask. During context switch in, perfmon
checks whether any bit in set in the bitmask, and if so the interrupt is
regenerated in an arch-specific manner.

For this to work, the pfm_arch_resend_irq() needs to be defined. It turns
out that neither the powerpc, mips, sparc64 architecture define this callback.

Thus, I believe they are subject the problem. It can easily be detected if you
look at the statistics maintained by perfmon via debugfs. Perfmon maintains
the number of times you had to replay in the ovfl_intr_replay_count entry.
If you see a value different than zero then it means you needed replay
capability. To trigger this condition you can pin multiple self-sampling threads
onto the same core and have monitoring run at kernel+user+force a lot of
context switches.

Given that I am not an expert at MIPS, Power and Sparc I don't know how
you can repost the interrupt. I would appreciate if the respective platform
experts could take a look.


Thanks.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
perfmon2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to