Sophie

Sophie

distrib > Mandriva > 9.0 > i586 > by-pkgid > 98e91bc877e03cf3582cd163550eb7e3 > files > 542

kernel-doc-html-2.4.19-16mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML
><HEAD
><TITLE
>The Players</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Unreliable Guide To Hacking The Linux Kernel"
HREF="book1.html"><LINK
REL="PREVIOUS"
TITLE="Introduction"
HREF="c22.html"><LINK
REL="NEXT"
TITLE="Hardware Interrupts (Hard IRQs)"
HREF="x54.html"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Unreliable Guide To Hacking The Linux Kernel</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="c22.html"
ACCESSKEY="P"
>&#60;&#60;&#60; Previous</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x54.html"
ACCESSKEY="N"
>Next &#62;&#62;&#62;</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="BASIC-PLAYERS"
></A
>The Players</H1
><P
>   At any time each of the CPUs in a system can be:
  </P
><P
></P
><UL
><LI
><P
>     not associated with any process, serving a hardware interrupt;
    </P
></LI
><LI
><P
>     not associated with any process, serving a softirq, tasklet or bh;
    </P
></LI
><LI
><P
>     running in kernel space, associated with a process;
    </P
></LI
><LI
><P
>     running a process in user space.
    </P
></LI
></UL
><P
>   There is a strict ordering between these: other than the last
   category (userspace) each can only be pre-empted by those above.
   For example, while a softirq is running on a CPU, no other
   softirq will pre-empt it, but a hardware interrupt can.  However,
   any other CPUs in the system execute independently.
  </P
><P
>   We'll see a number of ways that the user context can block
   interrupts, to become truly non-preemptable.
  </P
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="BASICS-USERCONTEXT"
></A
>User Context</H1
><P
>    User context is when you are coming in from a system call or
    other trap: you can sleep, and you own the CPU (except for
    interrupts) until you call <TT
CLASS="FUNCTION"
>schedule()</TT
>.  
    In other words, user context (unlike userspace) is not pre-emptable.
   </P
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="./stylesheet-images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>     You are always in user context on module load and unload,
     and on operations on the block device layer.
    </P
></TD
></TR
></TABLE
></DIV
><P
>    In user context, the <TT
CLASS="VARNAME"
>current</TT
> pointer (indicating 
    the task we are currently executing) is valid, and
    <TT
CLASS="FUNCTION"
>in_interrupt()</TT
>
    (<TT
CLASS="FILENAME"
>include/asm/hardirq.h</TT
>) is <SPAN
CLASS="RETURNVALUE"
>false
    </SPAN
>.  
   </P
><DIV
CLASS="CAUTION"
><P
></P
><TABLE
CLASS="CAUTION"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="./stylesheet-images/caution.gif"
HSPACE="5"
ALT="Caution"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>     Beware that if you have interrupts or bottom halves disabled 
     (see below), <TT
CLASS="FUNCTION"
>in_interrupt()</TT
> will return a 
     false positive.
    </P
></TD
></TR
></TABLE
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="c22.html"
ACCESSKEY="P"
>&#60;&#60;&#60; Previous</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x54.html"
ACCESSKEY="N"
>Next &#62;&#62;&#62;</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Introduction</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Hardware Interrupts (Hard IRQs)</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>