|
From: John L. <le...@mo...> - 2002-10-18 23:56:25
|
On Fri, Oct 18, 2002 at 05:26:01PM -0400, William Cohen wrote:
> I have been revising the ia64 port based on the comments I got on it.
> The problem code is at the end of module/oprofile.c:op_entry():
>
> if (likely(eflags & IF_MASK)) {
> oprof_ready[cpu] = 1;
> wake_up(&oprof_wait);
> }
>
>
> I am trying to understand all the issues with this snippet of code. This
> code is executed during the nmi and could be executed at potentially any
> time on the x86 including interrupting code in wake_up attempting to do
> an atomic operation (nmi can interrupt even when interrupts are masked).
> So this code appears to be making sure that atomic operations are not
> being broken. Is there something else it is doing besides that?
This is deep magic: we rely on the fact that whenever anything accesses
the waitqueue, interrupts are disabled. So if we interrupt and found
that the context that we are interrupting had interrupts disabled,
there's a possibility that someinth is accessing the waitqueue, so we
have to give up. Otherwise, we are safe to do the wake up.
So you need access to the inteerrupted context's flag that indiciates
we're not accessing the waitqueue on IA64. I have no idea if that's
possible. If it's not you have two options :
o backport the 2.5 stuff
o re-introduce the kernel thread that periodically wakes up and wakes up
oprof_wait if we need to wake up
regards
john
--
"It's a cardboard universe ... and if you lean too hard against it, you fall
through."
- Philip K. Dick
|