Re: [Question] arch-independent way to differentiate between userandkernel

From: Steven Rostedt
Date: Wed Aug 03 2005 - 06:49:00 EST


On Wed, 2005-08-03 at 06:56 -0400, linux-os (Dick Johnson) wrote:
> On Wed, 3 Aug 2005, Steven Rostedt wrote:
> The interrupt handler gets a pointer to a structure called "struct pt_regs".
> That contains, amongst other things, the registers pushed onto the stack
> during the interrupt. If the segments were kernel segments, the interrupt
> occurred while in kernel mode. But..... If you have any code that
> needs to know, it's horribly and irreparably broken beyond all
> repair. Interrupts need to be handled NOW, without regard to what
> got interrupted.
>

By the time you get to __do_IRQ there's already more stuff on the stack.
And the pt_regs is arch specific so this doesn't help.

This is for debugging, so please don't jump to conclusions that what I'm
doing is broken. I'm writing code to look for soft deadlocks on a fully
preemptible kernel (Ingo's RT). For example, there's a nasty location
in kjournald that goes into a busy loop waiting for a lock to be
released. In the mainline kernel this is OK since the holding of these
locks turn off preemption. But Ingo's kernel does not turn off
preemption here, and if the kjournald is an RT task, it will prevent all
tasks lower in priority than itself from running. I'm writing code to
detect this.

Take a look at the
"[patch] Real-Time Preemption, -RT-2.6.13-rc4-V0.7.52-01" thread.

-- Steve



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/