lkml.org 
[lkml]   [2000]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Calling current() from interrupt context
Date
In article <20001008212709.D14137@excalibur.research.wombat.ie>,
Kenn Humborg <kenn@linux.ie> wrote:
>
>I'd just like to confirm that it's illegal to call current()
>from interrupt-handling code.

It's not categorically forbidden.

It does indeed happen, think about things like cross-CPU interrupts for
TLB invalidations etc.

At the very least such interrupts are interested in the "current CPU" -
which on most architectures is defined to "current->processor".

Also, there's been some work on recursive spinlocks, which also used
"current" as the test for recursion.

You might be able to avoid it by using other approaches (most of this
code tends to be architecture-specific anyway).

I think you are right in general, but there are certainly things to look
out for, just in case.

(And taking a trap in an interrupt handler prints out an oops message:
you can expect no end of confusion and debugging problems if "current"
is not valid at that point - lots of small details that probably make
this fairly painful).

Note that there are alternative approaches. For example, you could make
the interrupt stack be in the same multi-page as the regular stack, and
switch them both at task-switch time - just allocate four pages instead
of two, and use "current = esp & ~16383" instead or something like that.

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

\
 
 \ /
  Last update: 2005-03-22 12:39    [W:0.249 / U:5.588 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site