Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 105658
b: refs/heads/master
c: e4268aa
h: refs/heads/master
v: v3
  • Loading branch information
Alex Chiang authored and Jesse Barnes committed Jul 22, 2008
1 parent 22cde00 commit 3dea7f0
Show file tree
Hide file tree
Showing 1,480 changed files with 51,256 additions and 66,809 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5c402355adf8f920531f02099f4ec0d2bccd4c64
refs/heads/master: e4268aad42e9f37d01925022830b16bab3d0d5af
8 changes: 0 additions & 8 deletions trunk/CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,6 @@ S: 2322 37th Ave SW
S: Seattle, Washington 98126-2010
S: USA

N: Muli Ben-Yehuda
E: mulix@mulix.org
E: muli@il.ibm.com
W: http://www.mulix.org
D: trident OSS sound driver, x86-64 dma-ops and Calgary IOMMU,
D: KVM and Xen bits and other misc. hackery.
S: Haifa, Israel

N: Johannes Berg
E: johannes@sipsolutions.net
W: http://johannes.sipsolutions.net/
Expand Down
20 changes: 0 additions & 20 deletions trunk/Documentation/ABI/testing/sysfs-dev

This file was deleted.

24 changes: 0 additions & 24 deletions trunk/Documentation/ABI/testing/sysfs-devices-memory

This file was deleted.

6 changes: 0 additions & 6 deletions trunk/Documentation/ABI/testing/sysfs-kernel-mm

This file was deleted.

15 changes: 0 additions & 15 deletions trunk/Documentation/ABI/testing/sysfs-kernel-mm-hugepages

This file was deleted.

9 changes: 0 additions & 9 deletions trunk/Documentation/DMA-attributes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,3 @@ ready and available in memory. The DMA of the "completion indication"
could race with data DMA. Mapping the memory used for completion
indications with DMA_ATTR_WRITE_BARRIER would prevent the race.

DMA_ATTR_WEAK_ORDERING
----------------------

DMA_ATTR_WEAK_ORDERING specifies that reads and writes to the mapping
may be weakly ordered, that is that reads and writes may pass each other.

Since it is optional for platforms to implement DMA_ATTR_WEAK_ORDERING,
those that do not will simply ignore the attribute and exhibit default
behavior.
57 changes: 33 additions & 24 deletions trunk/Documentation/DocBook/kernel-locking.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@
</para>

<sect1 id="lock-intro">
<title>Two Main Types of Kernel Locks: Spinlocks and Mutexes</title>
<title>Three Main Types of Kernel Locks: Spinlocks, Mutexes and Semaphores</title>

<para>
There are two main types of kernel locks. The fundamental type
There are three main types of kernel locks. The fundamental type
is the spinlock
(<filename class="headerfile">include/asm/spinlock.h</filename>),
which is a very simple single-holder lock: if you can't get the
Expand All @@ -239,6 +239,14 @@
can't sleep (see <xref linkend="sleeping-things"/>), and so have to
use a spinlock instead.
</para>
<para>
The third type is a semaphore
(<filename class="headerfile">include/linux/semaphore.h</filename>): it
can have more than one holder at any time (the number decided at
initialization time), although it is most commonly used as a
single-holder lock (a mutex). If you can't get a semaphore, your
task will be suspended and later on woken up - just like for mutexes.
</para>
<para>
Neither type of lock is recursive: see
<xref linkend="deadlock"/>.
Expand Down Expand Up @@ -270,7 +278,7 @@
</para>

<para>
Mutexes still exist, because they are required for
Semaphores still exist, because they are required for
synchronization between <firstterm linkend="gloss-usercontext">user
contexts</firstterm>, as we will see below.
</para>
Expand All @@ -281,17 +289,18 @@

<para>
If you have a data structure which is only ever accessed from
user context, then you can use a simple mutex
(<filename>include/linux/mutex.h</filename>) to protect it. This
is the most trivial case: you initialize the mutex. Then you can
call <function>mutex_lock_interruptible()</function> to grab the mutex,
and <function>mutex_unlock()</function> to release it. There is also a
<function>mutex_lock()</function>, which should be avoided, because it
user context, then you can use a simple semaphore
(<filename>linux/linux/semaphore.h</filename>) to protect it. This
is the most trivial case: you initialize the semaphore to the number
of resources available (usually 1), and call
<function>down_interruptible()</function> to grab the semaphore, and
<function>up()</function> to release it. There is also a
<function>down()</function>, which should be avoided, because it
will not return if a signal is received.
</para>

<para>
Example: <filename>net/netfilter/nf_sockopt.c</filename> allows
Example: <filename>linux/net/core/netfilter.c</filename> allows
registration of new <function>setsockopt()</function> and
<function>getsockopt()</function> calls, with
<function>nf_register_sockopt()</function>. Registration and
Expand Down Expand Up @@ -506,7 +515,7 @@
<listitem>
<para>
If you are in a process context (any syscall) and want to
lock other process out, use a mutex. You can take a mutex
lock other process out, use a semaphore. You can take a semaphore
and sleep (<function>copy_from_user*(</function> or
<function>kmalloc(x,GFP_KERNEL)</function>).
</para>
Expand Down Expand Up @@ -653,7 +662,7 @@
<entry>SLBH</entry>
<entry>SLBH</entry>
<entry>SLBH</entry>
<entry>MLI</entry>
<entry>DI</entry>
<entry>None</entry>
</row>

Expand Down Expand Up @@ -683,8 +692,8 @@
<entry>spin_lock_bh</entry>
</row>
<row>
<entry>MLI</entry>
<entry>mutex_lock_interruptible</entry>
<entry>DI</entry>
<entry>down_interruptible</entry>
</row>

</tbody>
Expand Down Expand Up @@ -1301,7 +1310,7 @@ as Alan Cox says, <quote>Lock data, not code</quote>.
<para>
There is a coding bug where a piece of code tries to grab a
spinlock twice: it will spin forever, waiting for the lock to
be released (spinlocks, rwlocks and mutexes are not
be released (spinlocks, rwlocks and semaphores are not
recursive in Linux). This is trivial to diagnose: not a
stay-up-five-nights-talk-to-fluffy-code-bunnies kind of
problem.
Expand All @@ -1326,7 +1335,7 @@ as Alan Cox says, <quote>Lock data, not code</quote>.

<para>
This complete lockup is easy to diagnose: on SMP boxes the
watchdog timer or compiling with <symbol>DEBUG_SPINLOCK</symbol> set
watchdog timer or compiling with <symbol>DEBUG_SPINLOCKS</symbol> set
(<filename>include/linux/spinlock.h</filename>) will show this up
immediately when it happens.
</para>
Expand Down Expand Up @@ -1549,7 +1558,7 @@ the amount of locking which needs to be done.
<title>Read/Write Lock Variants</title>

<para>
Both spinlocks and mutexes have read/write variants:
Both spinlocks and semaphores have read/write variants:
<type>rwlock_t</type> and <structname>struct rw_semaphore</structname>.
These divide users into two classes: the readers and the writers. If
you are only reading the data, you can get a read lock, but to write to
Expand Down Expand Up @@ -1672,7 +1681,7 @@ the amount of locking which needs to be done.
#include &lt;linux/slab.h&gt;
#include &lt;linux/string.h&gt;
+#include &lt;linux/rcupdate.h&gt;
#include &lt;linux/mutex.h&gt;
#include &lt;linux/semaphore.h&gt;
#include &lt;asm/errno.h&gt;

struct object
Expand Down Expand Up @@ -1904,7 +1913,7 @@ machines due to caching.
</listitem>
<listitem>
<para>
<function>put_user()</function>
<function> put_user()</function>
</para>
</listitem>
</itemizedlist>
Expand All @@ -1918,13 +1927,13 @@ machines due to caching.

<listitem>
<para>
<function>mutex_lock_interruptible()</function> and
<function>mutex_lock()</function>
<function>down_interruptible()</function> and
<function>down()</function>
</para>
<para>
There is a <function>mutex_trylock()</function> which can be
There is a <function>down_trylock()</function> which can be
used inside interrupt context, as it will not sleep.
<function>mutex_unlock()</function> will also never sleep.
<function>up()</function> will also never sleep.
</para>
</listitem>
</itemizedlist>
Expand Down Expand Up @@ -2014,7 +2023,7 @@ machines due to caching.
<para>
Prior to 2.5, or when <symbol>CONFIG_PREEMPT</symbol> is
unset, processes in user context inside the kernel would not
preempt each other (ie. you had that CPU until you gave it up,
preempt each other (ie. you had that CPU until you have it up,
except for interrupts). With the addition of
<symbol>CONFIG_PREEMPT</symbol> in 2.5.4, this changed: when
in user context, higher priority tasks can "cut in": spinlocks
Expand Down
63 changes: 12 additions & 51 deletions trunk/Documentation/DocBook/uio-howto.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@
</affiliation>
</author>

<copyright>
<year>2006-2008</year>
<holder>Hans-Jürgen Koch.</holder>
</copyright>

<legalnotice>
<para>
This documentation is Free Software licensed under the terms of the
GPL version 2.
</para>
</legalnotice>

<pubdate>2006-12-11</pubdate>

<abstract>
Expand All @@ -41,12 +29,6 @@ GPL version 2.
</abstract>

<revhistory>
<revision>
<revnumber>0.5</revnumber>
<date>2008-05-22</date>
<authorinitials>hjk</authorinitials>
<revremark>Added description of write() function.</revremark>
</revision>
<revision>
<revnumber>0.4</revnumber>
<date>2007-11-26</date>
Expand Down Expand Up @@ -75,9 +57,20 @@ GPL version 2.
</bookinfo>

<chapter id="aboutthisdoc">
<?dbhtml filename="aboutthis.html"?>
<?dbhtml filename="about.html"?>
<title>About this document</title>

<sect1 id="copyright">
<?dbhtml filename="copyright.html"?>
<title>Copyright and License</title>
<para>
Copyright (c) 2006 by Hans-Jürgen Koch.</para>
<para>
This documentation is Free Software licensed under the terms of the
GPL version 2.
</para>
</sect1>

<sect1 id="translations">
<?dbhtml filename="translations.html"?>
<title>Translations</title>
Expand Down Expand Up @@ -196,30 +189,6 @@ interested in translating it, please email me
represents the total interrupt count. You can use this number
to figure out if you missed some interrupts.
</para>
<para>
For some hardware that has more than one interrupt source internally,
but not separate IRQ mask and status registers, there might be
situations where userspace cannot determine what the interrupt source
was if the kernel handler disables them by writing to the chip's IRQ
register. In such a case, the kernel has to disable the IRQ completely
to leave the chip's register untouched. Now the userspace part can
determine the cause of the interrupt, but it cannot re-enable
interrupts. Another cornercase is chips where re-enabling interrupts
is a read-modify-write operation to a combined IRQ status/acknowledge
register. This would be racy if a new interrupt occurred
simultaneously.
</para>
<para>
To address these problems, UIO also implements a write() function. It
is normally not used and can be ignored for hardware that has only a
single interrupt source or has separate IRQ mask and status registers.
If you need it, however, a write to <filename>/dev/uioX</filename>
will call the <function>irqcontrol()</function> function implemented
by the driver. You have to write a 32-bit value that is usually either
0 or 1 to disable or enable interrupts. If a driver does not implement
<function>irqcontrol()</function>, <function>write()</function> will
return with <varname>-ENOSYS</varname>.
</para>

<para>
To handle interrupts properly, your custom kernel module can
Expand Down Expand Up @@ -393,14 +362,6 @@ device is actually used.
<function>open()</function>, you will probably also want a custom
<function>release()</function> function.
</para></listitem>

<listitem><para>
<varname>int (*irqcontrol)(struct uio_info *info, s32 irq_on)
</varname>: Optional. If you need to be able to enable or disable
interrupts from userspace by writing to <filename>/dev/uioX</filename>,
you can implement this function. The parameter <varname>irq_on</varname>
will be 0 to disable interrupts and 1 to enable them.
</para></listitem>
</itemizedlist>

<para>
Expand Down
2 changes: 1 addition & 1 deletion trunk/Documentation/HOWTO
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ Here is a list of some of the different kernel trees available:
- pcmcia, Dominik Brodowski <linux@dominikbrodowski.net>
git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git

- SCSI, James Bottomley <James.Bottomley@hansenpartnership.com>
- SCSI, James Bottomley <James.Bottomley@SteelEye.com>
git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git

- x86, Ingo Molnar <mingo@elte.hu>
Expand Down
Loading

0 comments on commit 3dea7f0

Please sign in to comment.