aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/DocBook/kernel-api.tmpl44
-rw-r--r--Documentation/RCU/checklist.txt44
-rw-r--r--Documentation/RCU/whatisRCU.txt12
-rw-r--r--Documentation/devices.txt7
-rw-r--r--Documentation/filesystems/fuse.txt118
-rw-r--r--Documentation/filesystems/ramfs-rootfs-initramfs.txt146
-rw-r--r--Documentation/kdump/kdump.txt420
-rw-r--r--Documentation/memory-barriers.txt34
-rw-r--r--Documentation/rtc.txt7
-rw-r--r--Documentation/sysrq.txt5
10 files changed, 611 insertions, 226 deletions
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
index 31b727ceb127..3630a0d7695f 100644
--- a/Documentation/DocBook/kernel-api.tmpl
+++ b/Documentation/DocBook/kernel-api.tmpl
@@ -62,6 +62,8 @@
62 <sect1><title>Internal Functions</title> 62 <sect1><title>Internal Functions</title>
63!Ikernel/exit.c 63!Ikernel/exit.c
64!Ikernel/signal.c 64!Ikernel/signal.c
65!Iinclude/linux/kthread.h
66!Ekernel/kthread.c
65 </sect1> 67 </sect1>
66 68
67 <sect1><title>Kernel objects manipulation</title> 69 <sect1><title>Kernel objects manipulation</title>
@@ -114,6 +116,29 @@ X!Ilib/string.c
114 </sect1> 116 </sect1>
115 </chapter> 117 </chapter>
116 118
119 <chapter id="kernel-lib">
120 <title>Basic Kernel Library Functions</title>
121
122 <para>
123 The Linux kernel provides more basic utility functions.
124 </para>
125
126 <sect1><title>Bitmap Operations</title>
127!Elib/bitmap.c
128!Ilib/bitmap.c
129 </sect1>
130
131 <sect1><title>Command-line Parsing</title>
132!Elib/cmdline.c
133 </sect1>
134
135 <sect1><title>CRC Functions</title>
136!Elib/crc16.c
137!Elib/crc32.c
138!Elib/crc-ccitt.c
139 </sect1>
140 </chapter>
141
117 <chapter id="mm"> 142 <chapter id="mm">
118 <title>Memory Management in Linux</title> 143 <title>Memory Management in Linux</title>
119 <sect1><title>The Slab Cache</title> 144 <sect1><title>The Slab Cache</title>
@@ -281,12 +306,13 @@ X!Ekernel/module.c
281 <sect1><title>MTRR Handling</title> 306 <sect1><title>MTRR Handling</title>
282!Earch/i386/kernel/cpu/mtrr/main.c 307!Earch/i386/kernel/cpu/mtrr/main.c
283 </sect1> 308 </sect1>
309
284 <sect1><title>PCI Support Library</title> 310 <sect1><title>PCI Support Library</title>
285!Edrivers/pci/pci.c 311!Edrivers/pci/pci.c
286!Edrivers/pci/pci-driver.c 312!Edrivers/pci/pci-driver.c
287!Edrivers/pci/remove.c 313!Edrivers/pci/remove.c
288!Edrivers/pci/pci-acpi.c 314!Edrivers/pci/pci-acpi.c
289<!-- kerneldoc does not understand to __devinit 315<!-- kerneldoc does not understand __devinit
290X!Edrivers/pci/search.c 316X!Edrivers/pci/search.c
291 --> 317 -->
292!Edrivers/pci/msi.c 318!Edrivers/pci/msi.c
@@ -315,6 +341,13 @@ X!Earch/i386/kernel/mca.c
315 </sect1> 341 </sect1>
316 </chapter> 342 </chapter>
317 343
344 <chapter id="firmware">
345 <title>Firmware Interfaces</title>
346 <sect1><title>DMI Interfaces</title>
347!Edrivers/firmware/dmi_scan.c
348 </sect1>
349 </chapter>
350
318 <chapter id="devfs"> 351 <chapter id="devfs">
319 <title>The Device File System</title> 352 <title>The Device File System</title>
320!Efs/devfs/base.c 353!Efs/devfs/base.c
@@ -403,7 +436,6 @@ X!Edrivers/pnp/system.c
403 </sect1> 436 </sect1>
404 </chapter> 437 </chapter>
405 438
406
407 <chapter id="blkdev"> 439 <chapter id="blkdev">
408 <title>Block Devices</title> 440 <title>Block Devices</title>
409!Eblock/ll_rw_blk.c 441!Eblock/ll_rw_blk.c
@@ -414,6 +446,14 @@ X!Edrivers/pnp/system.c
414!Edrivers/char/misc.c 446!Edrivers/char/misc.c
415 </chapter> 447 </chapter>
416 448
449 <chapter id="parportdev">
450 <title>Parallel Port Devices</title>
451!Iinclude/linux/parport.h
452!Edrivers/parport/ieee1284.c
453!Edrivers/parport/share.c
454!Idrivers/parport/daisy.c
455 </chapter>
456
417 <chapter id="viddev"> 457 <chapter id="viddev">
418 <title>Video4Linux</title> 458 <title>Video4Linux</title>
419!Edrivers/media/video/videodev.c 459!Edrivers/media/video/videodev.c
diff --git a/Documentation/RCU/checklist.txt b/Documentation/RCU/checklist.txt
index 49e27cc19385..1d50cf0c905e 100644
--- a/Documentation/RCU/checklist.txt
+++ b/Documentation/RCU/checklist.txt
@@ -144,9 +144,47 @@ over a rather long period of time, but improvements are always welcome!
144 whether the increased speed is worth it. 144 whether the increased speed is worth it.
145 145
1468. Although synchronize_rcu() is a bit slower than is call_rcu(), 1468. Although synchronize_rcu() is a bit slower than is call_rcu(),
147 it usually results in simpler code. So, unless update performance 147 it usually results in simpler code. So, unless update
148 is important or the updaters cannot block, synchronize_rcu() 148 performance is critically important or the updaters cannot block,
149 should be used in preference to call_rcu(). 149 synchronize_rcu() should be used in preference to call_rcu().
150
151 An especially important property of the synchronize_rcu()
152 primitive is that it automatically self-limits: if grace periods
153 are delayed for whatever reason, then the synchronize_rcu()
154 primitive will correspondingly delay updates. In contrast,
155 code using call_rcu() should explicitly limit update rate in
156 cases where grace periods are delayed, as failing to do so can
157 result in excessive realtime latencies or even OOM conditions.
158
159 Ways of gaining this self-limiting property when using call_rcu()
160 include:
161
162 a. Keeping a count of the number of data-structure elements
163 used by the RCU-protected data structure, including those
164 waiting for a grace period to elapse. Enforce a limit
165 on this number, stalling updates as needed to allow
166 previously deferred frees to complete.
167
168 Alternatively, limit only the number awaiting deferred
169 free rather than the total number of elements.
170
171 b. Limiting update rate. For example, if updates occur only
172 once per hour, then no explicit rate limiting is required,
173 unless your system is already badly broken. The dcache
174 subsystem takes this approach -- updates are guarded
175 by a global lock, limiting their rate.
176
177 c. Trusted update -- if updates can only be done manually by
178 superuser or some other trusted user, then it might not
179 be necessary to automatically limit them. The theory
180 here is that superuser already has lots of ways to crash
181 the machine.
182
183 d. Use call_rcu_bh() rather than call_rcu(), in order to take
184 advantage of call_rcu_bh()'s faster grace periods.
185
186 e. Periodically invoke synchronize_rcu(), permitting a limited
187 number of updates per grace period.
150 188
1519. All RCU list-traversal primitives, which include 1899. All RCU list-traversal primitives, which include
152 list_for_each_rcu(), list_for_each_entry_rcu(), 190 list_for_each_rcu(), list_for_each_entry_rcu(),
diff --git a/Documentation/RCU/whatisRCU.txt b/Documentation/RCU/whatisRCU.txt
index 6e459420ee9f..4f41a60e5111 100644
--- a/Documentation/RCU/whatisRCU.txt
+++ b/Documentation/RCU/whatisRCU.txt
@@ -184,7 +184,17 @@ synchronize_rcu()
184 blocking, it registers a function and argument which are invoked 184 blocking, it registers a function and argument which are invoked
185 after all ongoing RCU read-side critical sections have completed. 185 after all ongoing RCU read-side critical sections have completed.
186 This callback variant is particularly useful in situations where 186 This callback variant is particularly useful in situations where
187 it is illegal to block. 187 it is illegal to block or where update-side performance is
188 critically important.
189
190 However, the call_rcu() API should not be used lightly, as use
191 of the synchronize_rcu() API generally results in simpler code.
192 In addition, the synchronize_rcu() API has the nice property
193 of automatically limiting update rate should grace periods
194 be delayed. This property results in system resilience in face
195 of denial-of-service attacks. Code using call_rcu() should limit
196 update rate in order to gain this same sort of resilience. See
197 checklist.txt for some approaches to limiting the update rate.
188 198
189rcu_assign_pointer() 199rcu_assign_pointer()
190 200
diff --git a/Documentation/devices.txt b/Documentation/devices.txt
index b2f593fc76ca..4aaf68fafebe 100644
--- a/Documentation/devices.txt
+++ b/Documentation/devices.txt
@@ -3,7 +3,7 @@
3 3
4 Maintained by Torben Mathiasen <device@lanana.org> 4 Maintained by Torben Mathiasen <device@lanana.org>
5 5
6 Last revised: 01 March 2006 6 Last revised: 15 May 2006
7 7
8This list is the Linux Device List, the official registry of allocated 8This list is the Linux Device List, the official registry of allocated
9device numbers and /dev directory nodes for the Linux operating 9device numbers and /dev directory nodes for the Linux operating
@@ -2791,6 +2791,7 @@ Your cooperation is appreciated.
2791 170 = /dev/ttyNX0 Hilscher netX serial port 0 2791 170 = /dev/ttyNX0 Hilscher netX serial port 0
2792 ... 2792 ...
2793 185 = /dev/ttyNX15 Hilscher netX serial port 15 2793 185 = /dev/ttyNX15 Hilscher netX serial port 15
2794 186 = /dev/ttyJ0 JTAG1 DCC protocol based serial port emulation
2794 2795
2795205 char Low-density serial ports (alternate device) 2796205 char Low-density serial ports (alternate device)
2796 0 = /dev/culu0 Callout device for ttyLU0 2797 0 = /dev/culu0 Callout device for ttyLU0
@@ -3108,6 +3109,10 @@ Your cooperation is appreciated.
3108 ... 3109 ...
3109 240 = /dev/rfdp 16th RFD FTL layer 3110 240 = /dev/rfdp 16th RFD FTL layer
3110 3111
3112257 char Phoenix Technologies Cryptographic Services Driver
3113 0 = /dev/ptlsec Crypto Services Driver
3114
3115
3111 3116
3112 **** ADDITIONAL /dev DIRECTORY ENTRIES 3117 **** ADDITIONAL /dev DIRECTORY ENTRIES
3113 3118
diff --git a/Documentation/filesystems/fuse.txt b/Documentation/filesystems/fuse.txt
index 33f74310d161..a584f05403a4 100644
--- a/Documentation/filesystems/fuse.txt
+++ b/Documentation/filesystems/fuse.txt
@@ -18,6 +18,14 @@ Non-privileged mount (or user mount):
18 user. NOTE: this is not the same as mounts allowed with the "user" 18 user. NOTE: this is not the same as mounts allowed with the "user"
19 option in /etc/fstab, which is not discussed here. 19 option in /etc/fstab, which is not discussed here.
20 20
21Filesystem connection:
22
23 A connection between the filesystem daemon and the kernel. The
24 connection exists until either the daemon dies, or the filesystem is
25 umounted. Note that detaching (or lazy umounting) the filesystem
26 does _not_ break the connection, in this case it will exist until
27 the last reference to the filesystem is released.
28
21Mount owner: 29Mount owner:
22 30
23 The user who does the mounting. 31 The user who does the mounting.
@@ -86,16 +94,20 @@ Mount options
86 The default is infinite. Note that the size of read requests is 94 The default is infinite. Note that the size of read requests is
87 limited anyway to 32 pages (which is 128kbyte on i386). 95 limited anyway to 32 pages (which is 128kbyte on i386).
88 96
89Sysfs 97Control filesystem
90~~~~~ 98~~~~~~~~~~~~~~~~~~
99
100There's a control filesystem for FUSE, which can be mounted by:
91 101
92FUSE sets up the following hierarchy in sysfs: 102 mount -t fusectl none /sys/fs/fuse/connections
93 103
94 /sys/fs/fuse/connections/N/ 104Mounting it under the '/sys/fs/fuse/connections' directory makes it
105backwards compatible with earlier versions.
95 106
96where N is an increasing number allocated to each new connection. 107Under the fuse control filesystem each connection has a directory
108named by a unique number.
97 109
98For each connection the following attributes are defined: 110For each connection the following files exist within this directory:
99 111
100 'waiting' 112 'waiting'
101 113
@@ -110,7 +122,47 @@ For each connection the following attributes are defined:
110 connection. This means that all waiting requests will be aborted an 122 connection. This means that all waiting requests will be aborted an
111 error returned for all aborted and new requests. 123 error returned for all aborted and new requests.
112 124
113Only a privileged user may read or write these attributes. 125Only the owner of the mount may read or write these files.
126
127Interrupting filesystem operations
128~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
129
130If a process issuing a FUSE filesystem request is interrupted, the
131following will happen:
132
133 1) If the request is not yet sent to userspace AND the signal is
134 fatal (SIGKILL or unhandled fatal signal), then the request is
135 dequeued and returns immediately.
136
137 2) If the request is not yet sent to userspace AND the signal is not
138 fatal, then an 'interrupted' flag is set for the request. When
139 the request has been successfully transfered to userspace and
140 this flag is set, an INTERRUPT request is queued.
141
142 3) If the request is already sent to userspace, then an INTERRUPT
143 request is queued.
144
145INTERRUPT requests take precedence over other requests, so the
146userspace filesystem will receive queued INTERRUPTs before any others.
147
148The userspace filesystem may ignore the INTERRUPT requests entirely,
149or may honor them by sending a reply to the _original_ request, with
150the error set to EINTR.
151
152It is also possible that there's a race between processing the
153original request and it's INTERRUPT request. There are two possibilities:
154
155 1) The INTERRUPT request is processed before the original request is
156 processed
157
158 2) The INTERRUPT request is processed after the original request has
159 been answered
160
161If the filesystem cannot find the original request, it should wait for
162some timeout and/or a number of new requests to arrive, after which it
163should reply to the INTERRUPT request with an EAGAIN error. In case
1641) the INTERRUPT request will be requeued. In case 2) the INTERRUPT
165reply will be ignored.
114 166
115Aborting a filesystem connection 167Aborting a filesystem connection
116~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 168~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -139,8 +191,8 @@ the filesystem. There are several ways to do this:
139 - Use forced umount (umount -f). Works in all cases but only if 191 - Use forced umount (umount -f). Works in all cases but only if
140 filesystem is still attached (it hasn't been lazy unmounted) 192 filesystem is still attached (it hasn't been lazy unmounted)
141 193
142 - Abort filesystem through the sysfs interface. Most powerful 194 - Abort filesystem through the FUSE control filesystem. Most
143 method, always works. 195 powerful method, always works.
144 196
145How do non-privileged mounts work? 197How do non-privileged mounts work?
146~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -304,25 +356,7 @@ Scenario 1 - Simple deadlock
304 | | for "file"] 356 | | for "file"]
305 | | *DEADLOCK* 357 | | *DEADLOCK*
306 358
307The solution for this is to allow requests to be interrupted while 359The solution for this is to allow the filesystem to be aborted.
308they are in userspace:
309
310 | [interrupted by signal] |
311 | <fuse_unlink() |
312 | [release semaphore] | [semaphore acquired]
313 | <sys_unlink() |
314 | | >fuse_unlink()
315 | | [queue req on fc->pending]
316 | | [wake up fc->waitq]
317 | | [sleep on req->waitq]
318
319If the filesystem daemon was single threaded, this will stop here,
320since there's no other thread to dequeue and execute the request.
321In this case the solution is to kill the FUSE daemon as well. If
322there are multiple serving threads, you just have to kill them as
323long as any remain.
324
325Moral: a filesystem which deadlocks, can soon find itself dead.
326 360
327Scenario 2 - Tricky deadlock 361Scenario 2 - Tricky deadlock
328---------------------------- 362----------------------------
@@ -355,24 +389,14 @@ but is caused by a pagefault.
355 | | [lock page] 389 | | [lock page]
356 | | * DEADLOCK * 390 | | * DEADLOCK *
357 391
358Solution is again to let the the request be interrupted (not 392Solution is basically the same as above.
359elaborated further).
360
361An additional problem is that while the write buffer is being
362copied to the request, the request must not be interrupted. This
363is because the destination address of the copy may not be valid
364after the request is interrupted.
365
366This is solved with doing the copy atomically, and allowing
367interruption while the page(s) belonging to the write buffer are
368faulted with get_user_pages(). The 'req->locked' flag indicates
369when the copy is taking place, and interruption is delayed until
370this flag is unset.
371 393
372Scenario 3 - Tricky deadlock with asynchronous read 394An additional problem is that while the write buffer is being copied
373--------------------------------------------------- 395to the request, the request must not be interrupted/aborted. This is
396because the destination address of the copy may not be valid after the
397request has returned.
374 398
375The same situation as above, except thread-1 will wait on page lock 399This is solved with doing the copy atomically, and allowing abort
376and hence it will be uninterruptible as well. The solution is to 400while the page(s) belonging to the write buffer are faulted with
377abort the connection with forced umount (if mount is attached) or 401get_user_pages(). The 'req->locked' flag indicates when the copy is
378through the abort attribute in sysfs. 402taking place, and abort is delayed until this flag is unset.
diff --git a/Documentation/filesystems/ramfs-rootfs-initramfs.txt b/Documentation/filesystems/ramfs-rootfs-initramfs.txt
index 60ab61e54e8a..25981e2e51be 100644
--- a/Documentation/filesystems/ramfs-rootfs-initramfs.txt
+++ b/Documentation/filesystems/ramfs-rootfs-initramfs.txt
@@ -70,11 +70,13 @@ tmpfs mounts. See Documentation/filesystems/tmpfs.txt for more information.
70What is rootfs? 70What is rootfs?
71--------------- 71---------------
72 72
73Rootfs is a special instance of ramfs, which is always present in 2.6 systems. 73Rootfs is a special instance of ramfs (or tmpfs, if that's enabled), which is
74(It's used internally as the starting and stopping point for searches of the 74always present in 2.6 systems. You can't unmount rootfs for approximately the
75kernel's doubly-linked list of mount points.) 75same reason you can't kill the init process; rather than having special code
76to check for and handle an empty list, it's smaller and simpler for the kernel
77to just make sure certain lists can't become empty.
76 78
77Most systems just mount another filesystem over it and ignore it. The 79Most systems just mount another filesystem over rootfs and ignore it. The
78amount of space an empty instance of ramfs takes up is tiny. 80amount of space an empty instance of ramfs takes up is tiny.
79 81
80What is initramfs? 82What is initramfs?
@@ -92,14 +94,16 @@ out of that.
92 94
93All this differs from the old initrd in several ways: 95All this differs from the old initrd in several ways:
94 96
95 - The old initrd was a separate file, while the initramfs archive is linked 97 - The old initrd was always a separate file, while the initramfs archive is
96 into the linux kernel image. (The directory linux-*/usr is devoted to 98 linked into the linux kernel image. (The directory linux-*/usr is devoted
97 generating this archive during the build.) 99 to generating this archive during the build.)
98 100
99 - The old initrd file was a gzipped filesystem image (in some file format, 101 - The old initrd file was a gzipped filesystem image (in some file format,
100 such as ext2, that had to be built into the kernel), while the new 102 such as ext2, that needed a driver built into the kernel), while the new
101 initramfs archive is a gzipped cpio archive (like tar only simpler, 103 initramfs archive is a gzipped cpio archive (like tar only simpler,
102 see cpio(1) and Documentation/early-userspace/buffer-format.txt). 104 see cpio(1) and Documentation/early-userspace/buffer-format.txt). The
105 kernel's cpio extraction code is not only extremely small, it's also
106 __init data that can be discarded during the boot process.
103 107
104 - The program run by the old initrd (which was called /initrd, not /init) did 108 - The program run by the old initrd (which was called /initrd, not /init) did
105 some setup and then returned to the kernel, while the init program from 109 some setup and then returned to the kernel, while the init program from
@@ -124,13 +128,14 @@ Populating initramfs:
124 128
125The 2.6 kernel build process always creates a gzipped cpio format initramfs 129The 2.6 kernel build process always creates a gzipped cpio format initramfs
126archive and links it into the resulting kernel binary. By default, this 130archive and links it into the resulting kernel binary. By default, this
127archive is empty (consuming 134 bytes on x86). The config option 131archive is empty (consuming 134 bytes on x86).
128CONFIG_INITRAMFS_SOURCE (for some reason buried under devices->block devices 132
129in menuconfig, and living in usr/Kconfig) can be used to specify a source for 133The config option CONFIG_INITRAMFS_SOURCE (for some reason buried under
130the initramfs archive, which will automatically be incorporated into the 134devices->block devices in menuconfig, and living in usr/Kconfig) can be used
131resulting binary. This option can point to an existing gzipped cpio archive, a 135to specify a source for the initramfs archive, which will automatically be
132directory containing files to be archived, or a text file specification such 136incorporated into the resulting binary. This option can point to an existing
133as the following example: 137gzipped cpio archive, a directory containing files to be archived, or a text
138file specification such as the following example:
134 139
135 dir /dev 755 0 0 140 dir /dev 755 0 0
136 nod /dev/console 644 0 0 c 5 1 141 nod /dev/console 644 0 0 c 5 1
@@ -146,23 +151,84 @@ as the following example:
146Run "usr/gen_init_cpio" (after the kernel build) to get a usage message 151Run "usr/gen_init_cpio" (after the kernel build) to get a usage message
147documenting the above file format. 152documenting the above file format.
148 153
149One advantage of the text file is that root access is not required to 154One advantage of the configuration file is that root access is not required to
150set permissions or create device nodes in the new archive. (Note that those 155set permissions or create device nodes in the new archive. (Note that those
151two example "file" entries expect to find files named "init.sh" and "busybox" in 156two example "file" entries expect to find files named "init.sh" and "busybox" in
152a directory called "initramfs", under the linux-2.6.* directory. See 157a directory called "initramfs", under the linux-2.6.* directory. See
153Documentation/early-userspace/README for more details.) 158Documentation/early-userspace/README for more details.)
154 159
155The kernel does not depend on external cpio tools, gen_init_cpio is created 160The kernel does not depend on external cpio tools. If you specify a
156from usr/gen_init_cpio.c which is entirely self-contained, and the kernel's 161directory instead of a configuration file, the kernel's build infrastructure
157boot-time extractor is also (obviously) self-contained. However, if you _do_ 162creates a configuration file from that directory (usr/Makefile calls
158happen to have cpio installed, the following command line can extract the 163scripts/gen_initramfs_list.sh), and proceeds to package up that directory
159generated cpio image back into its component files: 164using the config file (by feeding it to usr/gen_init_cpio, which is created
165from usr/gen_init_cpio.c). The kernel's build-time cpio creation code is
166entirely self-contained, and the kernel's boot-time extractor is also
167(obviously) self-contained.
168
169The one thing you might need external cpio utilities installed for is creating
170or extracting your own preprepared cpio files to feed to the kernel build
171(instead of a config file or directory).
172
173The following command line can extract a cpio image (either by the above script
174or by the kernel build) back into its component files:
160 175
161 cpio -i -d -H newc -F initramfs_data.cpio --no-absolute-filenames 176 cpio -i -d -H newc -F initramfs_data.cpio --no-absolute-filenames
162 177
178The following shell script can create a prebuilt cpio archive you can
179use in place of the above config file:
180
181 #!/bin/sh
182
183 # Copyright 2006 Rob Landley <rob@landley.net> and TimeSys Corporation.
184 # Licensed under GPL version 2
185
186 if [ $# -ne 2 ]
187 then
188 echo "usage: mkinitramfs directory imagename.cpio.gz"
189 exit 1
190 fi
191
192 if [ -d "$1" ]
193 then
194 echo "creating $2 from $1"
195 (cd "$1"; find . | cpio -o -H newc | gzip) > "$2"
196 else
197 echo "First argument must be a directory"
198 exit 1
199 fi
200
201Note: The cpio man page contains some bad advice that will break your initramfs
202archive if you follow it. It says "A typical way to generate the list
203of filenames is with the find command; you should give find the -depth option
204to minimize problems with permissions on directories that are unwritable or not
205searchable." Don't do this when creating initramfs.cpio.gz images, it won't
206work. The Linux kernel cpio extractor won't create files in a directory that
207doesn't exist, so the directory entries must go before the files that go in
208those directories. The above script gets them in the right order.
209
210External initramfs images:
211--------------------------
212
213If the kernel has initrd support enabled, an external cpio.gz archive can also
214be passed into a 2.6 kernel in place of an initrd. In this case, the kernel
215will autodetect the type (initramfs, not initrd) and extract the external cpio
216archive into rootfs before trying to run /init.
217
218This has the memory efficiency advantages of initramfs (no ramdisk block
219device) but the separate packaging of initrd (which is nice if you have
220non-GPL code you'd like to run from initramfs, without conflating it with
221the GPL licensed Linux kernel binary).
222
223It can also be used to supplement the kernel's built-in initamfs image. The
224files in the external archive will overwrite any conflicting files in
225the built-in initramfs archive. Some distributors also prefer to customize
226a single kernel image with task-specific initramfs images, without recompiling.
227
163Contents of initramfs: 228Contents of initramfs:
164---------------------- 229----------------------
165 230
231An initramfs archive is a complete self-contained root filesystem for Linux.
166If you don't already understand what shared libraries, devices, and paths 232If you don't already understand what shared libraries, devices, and paths
167you need to get a minimal root filesystem up and running, here are some 233you need to get a minimal root filesystem up and running, here are some
168references: 234references:
@@ -176,13 +242,36 @@ code against, along with some related utilities. It is BSD licensed.
176 242
177I use uClibc (http://www.uclibc.org) and busybox (http://www.busybox.net) 243I use uClibc (http://www.uclibc.org) and busybox (http://www.busybox.net)
178myself. These are LGPL and GPL, respectively. (A self-contained initramfs 244myself. These are LGPL and GPL, respectively. (A self-contained initramfs
179package is planned for the busybox 1.2 release.) 245package is planned for the busybox 1.3 release.)
180 246
181In theory you could use glibc, but that's not well suited for small embedded 247In theory you could use glibc, but that's not well suited for small embedded
182uses like this. (A "hello world" program statically linked against glibc is 248uses like this. (A "hello world" program statically linked against glibc is
183over 400k. With uClibc it's 7k. Also note that glibc dlopens libnss to do 249over 400k. With uClibc it's 7k. Also note that glibc dlopens libnss to do
184name lookups, even when otherwise statically linked.) 250name lookups, even when otherwise statically linked.)
185 251
252A good first step is to get initramfs to run a statically linked "hello world"
253program as init, and test it under an emulator like qemu (www.qemu.org) or
254User Mode Linux, like so:
255
256 cat > hello.c << EOF
257 #include <stdio.h>
258 #include <unistd.h>
259
260 int main(int argc, char *argv[])
261 {
262 printf("Hello world!\n");
263 sleep(999999999);
264 }
265 EOF
266 gcc -static hello2.c -o init
267 echo init | cpio -o -H newc | gzip > test.cpio.gz
268 # Testing external initramfs using the initrd loading mechanism.
269 qemu -kernel /boot/vmlinuz -initrd test.cpio.gz /dev/zero
270
271When debugging a normal root filesystem, it's nice to be able to boot with
272"init=/bin/sh". The initramfs equivalent is "rdinit=/bin/sh", and it's
273just as useful.
274
186Why cpio rather than tar? 275Why cpio rather than tar?
187------------------------- 276-------------------------
188 277
@@ -241,7 +330,7 @@ the above threads) is:
241Future directions: 330Future directions:
242------------------ 331------------------
243 332
244Today (2.6.14), initramfs is always compiled in, but not always used. The 333Today (2.6.16), initramfs is always compiled in, but not always used. The
245kernel falls back to legacy boot code that is reached only if initramfs does 334kernel falls back to legacy boot code that is reached only if initramfs does
246not contain an /init program. The fallback is legacy code, there to ensure a 335not contain an /init program. The fallback is legacy code, there to ensure a
247smooth transition and allowing early boot functionality to gradually move to 336smooth transition and allowing early boot functionality to gradually move to
@@ -258,8 +347,9 @@ and so on.
258 347
259This kind of complexity (which inevitably includes policy) is rightly handled 348This kind of complexity (which inevitably includes policy) is rightly handled
260in userspace. Both klibc and busybox/uClibc are working on simple initramfs 349in userspace. Both klibc and busybox/uClibc are working on simple initramfs
261packages to drop into a kernel build, and when standard solutions are ready 350packages to drop into a kernel build.
262and widely deployed, the kernel's legacy early boot code will become obsolete
263and a candidate for the feature removal schedule.
264 351
265But that's a while off yet. 352The klibc package has now been accepted into Andrew Morton's 2.6.17-mm tree.
353The kernel's current early boot code (partition detection, etc) will probably
354be migrated into a default initramfs, automatically created and used by the
355kernel build.
diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt
index 212cf3c21abf..08bafa8c1caa 100644
--- a/Documentation/kdump/kdump.txt
+++ b/Documentation/kdump/kdump.txt
@@ -1,155 +1,325 @@
1Documentation for kdump - the kexec-based crash dumping solution 1================================================================
2Documentation for Kdump - The kexec-based Crash Dumping Solution
2================================================================ 3================================================================
3 4
4DESIGN 5This document includes overview, setup and installation, and analysis
5====== 6information.
6 7
7Kdump uses kexec to reboot to a second kernel whenever a dump needs to be 8Overview
8taken. This second kernel is booted with very little memory. The first kernel 9========
9reserves the section of memory that the second kernel uses. This ensures that
10on-going DMA from the first kernel does not corrupt the second kernel.
11 10
12All the necessary information about Core image is encoded in ELF format and 11Kdump uses kexec to quickly boot to a dump-capture kernel whenever a
13stored in reserved area of memory before crash. Physical address of start of 12dump of the system kernel's memory needs to be taken (for example, when
14ELF header is passed to new kernel through command line parameter elfcorehdr=. 13the system panics). The system kernel's memory image is preserved across
14the reboot and is accessible to the dump-capture kernel.
15 15
16On i386, the first 640 KB of physical memory is needed to boot, irrespective 16You can use common Linux commands, such as cp and scp, to copy the
17of where the kernel loads. Hence, this region is backed up by kexec just before 17memory image to a dump file on the local disk, or across the network to
18rebooting into the new kernel. 18a remote system.
19 19
20In the second kernel, "old memory" can be accessed in two ways. 20Kdump and kexec are currently supported on the x86, x86_64, and ppc64
21architectures.
21 22
22- The first one is through a /dev/oldmem device interface. A capture utility 23When the system kernel boots, it reserves a small section of memory for
23 can read the device file and write out the memory in raw format. This is raw 24the dump-capture kernel. This ensures that ongoing Direct Memory Access
24 dump of memory and analysis/capture tool should be intelligent enough to 25(DMA) from the system kernel does not corrupt the dump-capture kernel.
25 determine where to look for the right information. ELF headers (elfcorehdr=) 26The kexec -p command loads the dump-capture kernel into this reserved
26 can become handy here. 27memory.
27 28
28- The second interface is through /proc/vmcore. This exports the dump as an ELF 29On x86 machines, the first 640 KB of physical memory is needed to boot,
29 format file which can be written out using any file copy command 30regardless of where the kernel loads. Therefore, kexec backs up this
30 (cp, scp, etc). Further, gdb can be used to perform limited debugging on 31region just before rebooting into the dump-capture kernel.
31 the dump file. This method ensures methods ensure that there is correct
32 ordering of the dump pages (corresponding to the first 640 KB that has been
33 relocated).
34 32
35SETUP 33All of the necessary information about the system kernel's core image is
36===== 34encoded in the ELF format, and stored in a reserved area of memory
35before a crash. The physical address of the start of the ELF header is
36passed to the dump-capture kernel through the elfcorehdr= boot
37parameter.
38
39With the dump-capture kernel, you can access the memory image, or "old
40memory," in two ways:
41
42- Through a /dev/oldmem device interface. A capture utility can read the
43 device file and write out the memory in raw format. This is a raw dump
44 of memory. Analysis and capture tools must be intelligent enough to
45 determine where to look for the right information.
46
47- Through /proc/vmcore. This exports the dump as an ELF-format file that
48 you can write out using file copy commands such as cp or scp. Further,
49 you can use analysis tools such as the GNU Debugger (GDB) and the Crash
50 tool to debug the dump file. This method ensures that the dump pages are
51 correctly ordered.
52
53
54Setup and Installation
55======================
56
57Install kexec-tools and the Kdump patch
58---------------------------------------
59
601) Login as the root user.
61
622) Download the kexec-tools user-space package from the following URL:
63
64 http://www.xmission.com/~ebiederm/files/kexec/kexec-tools-1.101.tar.gz
65
663) Unpack the tarball with the tar command, as follows:
67
68 tar xvpzf kexec-tools-1.101.tar.gz
69
704) Download the latest consolidated Kdump patch from the following URL:
71
72 http://lse.sourceforge.net/kdump/
73
74 (This location is being used until all the user-space Kdump patches
75 are integrated with the kexec-tools package.)
76
775) Change to the kexec-tools-1.101 directory, as follows:
78
79 cd kexec-tools-1.101
80
816) Apply the consolidated patch to the kexec-tools-1.101 source tree
82 with the patch command, as follows. (Modify the path to the downloaded
83 patch as necessary.)
84
85 patch -p1 < /path-to-kdump-patch/kexec-tools-1.101-kdump.patch
86
877) Configure the package, as follows:
88
89 ./configure
90
918) Compile the package, as follows:
92
93 make
94
959) Install the package, as follows:
96
97 make install
98
99
100Download and build the system and dump-capture kernels
101------------------------------------------------------
102
103Download the mainline (vanilla) kernel source code (2.6.13-rc1 or newer)
104from http://www.kernel.org. Two kernels must be built: a system kernel
105and a dump-capture kernel. Use the following steps to configure these
106kernels with the necessary kexec and Kdump features:
107
108System kernel
109-------------
110
1111) Enable "kexec system call" in "Processor type and features."
112
113 CONFIG_KEXEC=y
114
1152) Enable "sysfs file system support" in "Filesystem" -> "Pseudo
116 filesystems." This is usually enabled by default.
117
118 CONFIG_SYSFS=y
119
120 Note that "sysfs file system support" might not appear in the "Pseudo
121 filesystems" menu if "Configure standard kernel features (for small
122 systems)" is not enabled in "General Setup." In this case, check the
123 .config file itself to ensure that sysfs is turned on, as follows:
124
125 grep 'CONFIG_SYSFS' .config
126
1273) Enable "Compile the kernel with debug info" in "Kernel hacking."
128
129 CONFIG_DEBUG_INFO=Y
130
131 This causes the kernel to be built with debug symbols. The dump
132 analysis tools require a vmlinux with debug symbols in order to read
133 and analyze a dump file.
134
1354) Make and install the kernel and its modules. Update the boot loader
136 (such as grub, yaboot, or lilo) configuration files as necessary.
137
1385) Boot the system kernel with the boot parameter "crashkernel=Y@X",
139 where Y specifies how much memory to reserve for the dump-capture kernel
140 and X specifies the beginning of this reserved memory. For example,
141 "crashkernel=64M@16M" tells the system kernel to reserve 64 MB of memory
142 starting at physical address 0x01000000 for the dump-capture kernel.
143
144 On x86 and x86_64, use "crashkernel=64M@16M".
145
146 On ppc64, use "crashkernel=128M@32M".
147
148
149The dump-capture kernel
150-----------------------
37 151
381) Download the upstream kexec-tools userspace package from 1521) Under "General setup," append "-kdump" to the current string in
39 http://www.xmission.com/~ebiederm/files/kexec/kexec-tools-1.101.tar.gz. 153 "Local version."
40 154
41 Apply the latest consolidated kdump patch on top of kexec-tools-1.101 1552) On x86, enable high memory support under "Processor type and
42 from http://lse.sourceforge.net/kdump/. This arrangment has been made 156 features":
43 till all the userspace patches supporting kdump are integrated with 157
44 upstream kexec-tools userspace. 158 CONFIG_HIGHMEM64G=y
45 159 or
462) Download and build the appropriate (2.6.13-rc1 onwards) vanilla kernels. 160 CONFIG_HIGHMEM4G
47 Two kernels need to be built in order to get this feature working. 161
48 Following are the steps to properly configure the two kernels specific 1623) On x86 and x86_64, disable symmetric multi-processing support
49 to kexec and kdump features: 163 under "Processor type and features":
50 164
51 A) First kernel or regular kernel: 165 CONFIG_SMP=n
52 ---------------------------------- 166 (If CONFIG_SMP=y, then specify maxcpus=1 on the kernel command line
53 a) Enable "kexec system call" feature (in Processor type and features). 167 when loading the dump-capture kernel, see section "Load the Dump-capture
54 CONFIG_KEXEC=y 168 Kernel".)
55 b) Enable "sysfs file system support" (in Pseudo filesystems). 169
56 CONFIG_SYSFS=y 1704) On ppc64, disable NUMA support and enable EMBEDDED support:
57 c) make 171
58 d) Boot into first kernel with the command line parameter "crashkernel=Y@X". 172 CONFIG_NUMA=n
59 Use appropriate values for X and Y. Y denotes how much memory to reserve 173 CONFIG_EMBEDDED=y
60 for the second kernel, and X denotes at what physical address the 174 CONFIG_EEH=N for the dump-capture kernel
61 reserved memory section starts. For example: "crashkernel=64M@16M". 175
62 1765) Enable "kernel crash dumps" support under "Processor type and
63 177 features":
64 B) Second kernel or dump capture kernel: 178
65 --------------------------------------- 179 CONFIG_CRASH_DUMP=y
66 a) For i386 architecture enable Highmem support 180
67 CONFIG_HIGHMEM=y 1816) Use a suitable value for "Physical address where the kernel is
68 b) Enable "kernel crash dumps" feature (under "Processor type and features") 182 loaded" (under "Processor type and features"). This only appears when
69 CONFIG_CRASH_DUMP=y 183 "kernel crash dumps" is enabled. By default this value is 0x1000000
70 c) Make sure a suitable value for "Physical address where the kernel is 184 (16MB). It should be the same as X in the "crashkernel=Y@X" boot
71 loaded" (under "Processor type and features"). By default this value 185 parameter discussed above.
72 is 0x1000000 (16MB) and it should be same as X (See option d above), 186
73 e.g., 16 MB or 0x1000000. 187 On x86 and x86_64, use "CONFIG_PHYSICAL_START=0x1000000".
74 CONFIG_PHYSICAL_START=0x1000000 188
75 d) Enable "/proc/vmcore support" (Optional, under "Pseudo filesystems"). 189 On ppc64 the value is automatically set at 32MB when
76 CONFIG_PROC_VMCORE=y 190 CONFIG_CRASH_DUMP is set.
77 191
783) After booting to regular kernel or first kernel, load the second kernel 1926) Optionally enable "/proc/vmcore support" under "Filesystems" ->
79 using the following command: 193 "Pseudo filesystems".
80 194
81 kexec -p <second-kernel> --args-linux --elf32-core-headers 195 CONFIG_PROC_VMCORE=y
82 --append="root=<root-dev> init 1 irqpoll maxcpus=1" 196 (CONFIG_PROC_VMCORE is set by default when CONFIG_CRASH_DUMP is selected.)
83 197
84 Notes: 1987) Make and install the kernel and its modules. DO NOT add this kernel
85 ====== 199 to the boot loader configuration files.
86 i) <second-kernel> has to be a vmlinux image ie uncompressed elf image. 200
87 bzImage will not work, as of now. 201
88 ii) --args-linux has to be speicfied as if kexec it loading an elf image, 202Load the Dump-capture Kernel
89 it needs to know that the arguments supplied are of linux type. 203============================
90 iii) By default ELF headers are stored in ELF64 format to support systems 204
91 with more than 4GB memory. Option --elf32-core-headers forces generation 205After booting to the system kernel, load the dump-capture kernel using
92 of ELF32 headers. The reason for this option being, as of now gdb can 206the following command:
93 not open vmcore file with ELF64 headers on a 32 bit systems. So ELF32 207
94 headers can be used if one has non-PAE systems and hence memory less 208 kexec -p <dump-capture-kernel> \
95 than 4GB. 209 --initrd=<initrd-for-dump-capture-kernel> --args-linux \
96 iv) Specify "irqpoll" as command line parameter. This reduces driver 210 --append="root=<root-dev> init 1 irqpoll"
97 initialization failures in second kernel due to shared interrupts. 211
98 v) <root-dev> needs to be specified in a format corresponding to the root 212
99 device name in the output of mount command. 213Notes on loading the dump-capture kernel:
100 vi) If you have built the drivers required to mount root file system as 214
101 modules in <second-kernel>, then, specify 215* <dump-capture-kernel> must be a vmlinux image (that is, an
102 --initrd=<initrd-for-second-kernel>. 216 uncompressed ELF image). bzImage does not work at this time.
103 vii) Specify maxcpus=1 as, if during first kernel run, if panic happens on 217
104 non-boot cpus, second kernel doesn't seem to be boot up all the cpus. 218* By default, the ELF headers are stored in ELF64 format to support
105 The other option is to always built the second kernel without SMP 219 systems with more than 4GB memory. The --elf32-core-headers option can
106 support ie CONFIG_SMP=n 220 be used to force the generation of ELF32 headers. This is necessary
107 221 because GDB currently cannot open vmcore files with ELF64 headers on
1084) After successfully loading the second kernel as above, if a panic occurs 222 32-bit systems. ELF32 headers can be used on non-PAE systems (that is,
109 system reboots into the second kernel. A module can be written to force 223 less than 4GB of memory).
110 the panic or "ALT-SysRq-c" can be used initiate a crash dump for testing 224
111 purposes. 225* The "irqpoll" boot parameter reduces driver initialization failures
112 226 due to shared interrupts in the dump-capture kernel.
1135) Once the second kernel has booted, write out the dump file using 227
228* You must specify <root-dev> in the format corresponding to the root
229 device name in the output of mount command.
230
231* "init 1" boots the dump-capture kernel into single-user mode without
232 networking. If you want networking, use "init 3."
233
234
235Kernel Panic
236============
237
238After successfully loading the dump-capture kernel as previously
239described, the system will reboot into the dump-capture kernel if a
240system crash is triggered. Trigger points are located in panic(),
241die(), die_nmi() and in the sysrq handler (ALT-SysRq-c).
242
243The following conditions will execute a crash trigger point:
244
245If a hard lockup is detected and "NMI watchdog" is configured, the system
246will boot into the dump-capture kernel ( die_nmi() ).
247
248If die() is called, and it happens to be a thread with pid 0 or 1, or die()
249is called inside interrupt context or die() is called and panic_on_oops is set,
250the system will boot into the dump-capture kernel.
251
252On powererpc systems when a soft-reset is generated, die() is called by all cpus and the system system will boot into the dump-capture kernel.
253
254For testing purposes, you can trigger a crash by using "ALT-SysRq-c",
255"echo c > /proc/sysrq-trigger or write a module to force the panic.
256
257Write Out the Dump File
258=======================
259
260After the dump-capture kernel is booted, write out the dump file with
261the following command:
114 262
115 cp /proc/vmcore <dump-file> 263 cp /proc/vmcore <dump-file>
116 264
117 Dump memory can also be accessed as a /dev/oldmem device for a linear/raw 265You can also access dumped memory as a /dev/oldmem device for a linear
118 view. To create the device, type: 266and raw view. To create the device, use the following command:
119 267
120 mknod /dev/oldmem c 1 12 268 mknod /dev/oldmem c 1 12
121 269
122 Use "dd" with suitable options for count, bs and skip to access specific 270Use the dd command with suitable options for count, bs, and skip to
123 portions of the dump. 271access specific portions of the dump.
124 272
125 Entire memory: dd if=/dev/oldmem of=oldmem.001 273To see the entire memory, use the following command:
126 274
275 dd if=/dev/oldmem of=oldmem.001
127 276
128ANALYSIS 277
278Analysis
129======== 279========
130Limited analysis can be done using gdb on the dump file copied out of
131/proc/vmcore. Use vmlinux built with -g and run
132 280
133 gdb vmlinux <dump-file> 281Before analyzing the dump image, you should reboot into a stable kernel.
282
283You can do limited analysis using GDB on the dump file copied out of
284/proc/vmcore. Use the debug vmlinux built with -g and run the following
285command:
286
287 gdb vmlinux <dump-file>
134 288
135Stack trace for the task on processor 0, register display, memory display 289Stack trace for the task on processor 0, register display, and memory
136work fine. 290display work fine.
137 291
138Note: gdb cannot analyse core files generated in ELF64 format for i386. 292Note: GDB cannot analyze core files generated in ELF64 format for x86.
293On systems with a maximum of 4GB of memory, you can generate
294ELF32-format headers using the --elf32-core-headers kernel option on the
295dump kernel.
139 296
140Latest "crash" (crash-4.0-2.18) as available on Dave Anderson's site 297You can also use the Crash utility to analyze dump files in Kdump
141http://people.redhat.com/~anderson/ works well with kdump format. 298format. Crash is available on Dave Anderson's site at the following URL:
142 299
300 http://people.redhat.com/~anderson/
301
302
303To Do
304=====
143 305
144TODO 3061) Provide a kernel pages filtering mechanism, so core file size is not
145==== 307 extreme on systems with huge memory banks.
1461) Provide a kernel pages filtering mechanism so that core file size is not
147 insane on systems having huge memory banks.
1482) Relocatable kernel can help in maintaining multiple kernels for crashdump
149 and same kernel as the first kernel can be used to capture the dump.
150 308
3092) Relocatable kernel can help in maintaining multiple kernels for
310 crash_dump, and the same kernel as the system kernel can be used to
311 capture the dump.
151 312
152CONTACT 313
314Contact
153======= 315=======
316
154Vivek Goyal (vgoyal@in.ibm.com) 317Vivek Goyal (vgoyal@in.ibm.com)
155Maneesh Soni (maneesh@in.ibm.com) 318Maneesh Soni (maneesh@in.ibm.com)
319
320
321Trademark
322=========
323
324Linux is a trademark of Linus Torvalds in the United States, other
325countries, or both.
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index 4710845dbac4..cf0d5416a4c3 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -262,9 +262,14 @@ What is required is some way of intervening to instruct the compiler and the
262CPU to restrict the order. 262CPU to restrict the order.
263 263
264Memory barriers are such interventions. They impose a perceived partial 264Memory barriers are such interventions. They impose a perceived partial
265ordering between the memory operations specified on either side of the barrier. 265ordering over the memory operations on either side of the barrier.
266They request that the sequence of memory events generated appears to other 266
267parts of the system as if the barrier is effective on that CPU. 267Such enforcement is important because the CPUs and other devices in a system
268can use a variety of tricks to improve performance - including reordering,
269deferral and combination of memory operations; speculative loads; speculative
270branch prediction and various types of caching. Memory barriers are used to
271override or suppress these tricks, allowing the code to sanely control the
272interaction of multiple CPUs and/or devices.
268 273
269 274
270VARIETIES OF MEMORY BARRIER 275VARIETIES OF MEMORY BARRIER
@@ -282,7 +287,7 @@ Memory barriers come in four basic varieties:
282 A write barrier is a partial ordering on stores only; it is not required 287 A write barrier is a partial ordering on stores only; it is not required
283 to have any effect on loads. 288 to have any effect on loads.
284 289
285 A CPU can be viewed as as commiting a sequence of store operations to the 290 A CPU can be viewed as committing a sequence of store operations to the
286 memory system as time progresses. All stores before a write barrier will 291 memory system as time progresses. All stores before a write barrier will
287 occur in the sequence _before_ all the stores after the write barrier. 292 occur in the sequence _before_ all the stores after the write barrier.
288 293
@@ -413,7 +418,7 @@ There are certain things that the Linux kernel memory barriers do not guarantee:
413 indirect effect will be the order in which the second CPU sees the effects 418 indirect effect will be the order in which the second CPU sees the effects
414 of the first CPU's accesses occur, but see the next point: 419 of the first CPU's accesses occur, but see the next point:
415 420
416 (*) There is no guarantee that the a CPU will see the correct order of effects 421 (*) There is no guarantee that a CPU will see the correct order of effects
417 from a second CPU's accesses, even _if_ the second CPU uses a memory 422 from a second CPU's accesses, even _if_ the second CPU uses a memory
418 barrier, unless the first CPU _also_ uses a matching memory barrier (see 423 barrier, unless the first CPU _also_ uses a matching memory barrier (see
419 the subsection on "SMP Barrier Pairing"). 424 the subsection on "SMP Barrier Pairing").
@@ -461,8 +466,8 @@ Whilst this may seem like a failure of coherency or causality maintenance, it
461isn't, and this behaviour can be observed on certain real CPUs (such as the DEC 466isn't, and this behaviour can be observed on certain real CPUs (such as the DEC
462Alpha). 467Alpha).
463 468
464To deal with this, a data dependency barrier must be inserted between the 469To deal with this, a data dependency barrier or better must be inserted
465address load and the data load: 470between the address load and the data load:
466 471
467 CPU 1 CPU 2 472 CPU 1 CPU 2
468 =============== =============== 473 =============== ===============
@@ -484,7 +489,7 @@ lines. The pointer P might be stored in an odd-numbered cache line, and the
484variable B might be stored in an even-numbered cache line. Then, if the 489variable B might be stored in an even-numbered cache line. Then, if the
485even-numbered bank of the reading CPU's cache is extremely busy while the 490even-numbered bank of the reading CPU's cache is extremely busy while the
486odd-numbered bank is idle, one can see the new value of the pointer P (&B), 491odd-numbered bank is idle, one can see the new value of the pointer P (&B),
487but the old value of the variable B (1). 492but the old value of the variable B (2).
488 493
489 494
490Another example of where data dependency barriers might by required is where a 495Another example of where data dependency barriers might by required is where a
@@ -744,7 +749,7 @@ some effectively random order, despite the write barrier issued by CPU 1:
744 : : 749 : :
745 750
746 751
747If, however, a read barrier were to be placed between the load of E and the 752If, however, a read barrier were to be placed between the load of B and the
748load of A on CPU 2: 753load of A on CPU 2:
749 754
750 CPU 1 CPU 2 755 CPU 1 CPU 2
@@ -1461,9 +1466,8 @@ instruction itself is complete.
1461 1466
1462On a UP system - where this wouldn't be a problem - the smp_mb() is just a 1467On a UP system - where this wouldn't be a problem - the smp_mb() is just a
1463compiler barrier, thus making sure the compiler emits the instructions in the 1468compiler barrier, thus making sure the compiler emits the instructions in the
1464right order without actually intervening in the CPU. Since there there's only 1469right order without actually intervening in the CPU. Since there's only one
1465one CPU, that CPU's dependency ordering logic will take care of everything 1470CPU, that CPU's dependency ordering logic will take care of everything else.
1466else.
1467 1471
1468 1472
1469ATOMIC OPERATIONS 1473ATOMIC OPERATIONS
@@ -1640,9 +1644,9 @@ functions:
1640 1644
1641 The PCI bus, amongst others, defines an I/O space concept - which on such 1645 The PCI bus, amongst others, defines an I/O space concept - which on such
1642 CPUs as i386 and x86_64 cpus readily maps to the CPU's concept of I/O 1646 CPUs as i386 and x86_64 cpus readily maps to the CPU's concept of I/O
1643 space. However, it may also mapped as a virtual I/O space in the CPU's 1647 space. However, it may also be mapped as a virtual I/O space in the CPU's
1644 memory map, particularly on those CPUs that don't support alternate 1648 memory map, particularly on those CPUs that don't support alternate I/O
1645 I/O spaces. 1649 spaces.
1646 1650
1647 Accesses to this space may be fully synchronous (as on i386), but 1651 Accesses to this space may be fully synchronous (as on i386), but
1648 intermediary bridges (such as the PCI host bridge) may not fully honour 1652 intermediary bridges (such as the PCI host bridge) may not fully honour
diff --git a/Documentation/rtc.txt b/Documentation/rtc.txt
index 95d17b3e2eee..2a58f985795a 100644
--- a/Documentation/rtc.txt
+++ b/Documentation/rtc.txt
@@ -44,8 +44,10 @@ normal timer interrupt, which is 100Hz.
44Programming and/or enabling interrupt frequencies greater than 64Hz is 44Programming and/or enabling interrupt frequencies greater than 64Hz is
45only allowed by root. This is perhaps a bit conservative, but we don't want 45only allowed by root. This is perhaps a bit conservative, but we don't want
46an evil user generating lots of IRQs on a slow 386sx-16, where it might have 46an evil user generating lots of IRQs on a slow 386sx-16, where it might have
47a negative impact on performance. Note that the interrupt handler is only 47a negative impact on performance. This 64Hz limit can be changed by writing
48a few lines of code to minimize any possibility of this effect. 48a different value to /proc/sys/dev/rtc/max-user-freq. Note that the
49interrupt handler is only a few lines of code to minimize any possibility
50of this effect.
49 51
50Also, if the kernel time is synchronized with an external source, the 52Also, if the kernel time is synchronized with an external source, the
51kernel will write the time back to the CMOS clock every 11 minutes. In 53kernel will write the time back to the CMOS clock every 11 minutes. In
@@ -81,6 +83,7 @@ that will be using this driver.
81 */ 83 */
82 84
83#include <stdio.h> 85#include <stdio.h>
86#include <stdlib.h>
84#include <linux/rtc.h> 87#include <linux/rtc.h>
85#include <sys/ioctl.h> 88#include <sys/ioctl.h>
86#include <sys/time.h> 89#include <sys/time.h>
diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt
index ad0bedf678b3..e0188a23fd5e 100644
--- a/Documentation/sysrq.txt
+++ b/Documentation/sysrq.txt
@@ -115,8 +115,9 @@ trojan program is running at console and which could grab your password
115when you would try to login. It will kill all programs on given console 115when you would try to login. It will kill all programs on given console
116and thus letting you make sure that the login prompt you see is actually 116and thus letting you make sure that the login prompt you see is actually
117the one from init, not some trojan program. 117the one from init, not some trojan program.
118IMPORTANT:In its true form it is not a true SAK like the one in :IMPORTANT 118IMPORTANT: In its true form it is not a true SAK like the one in a :IMPORTANT
119IMPORTANT:c2 compliant systems, and it should be mistook as such. :IMPORTANT 119IMPORTANT: c2 compliant system, and it should not be mistaken as :IMPORTANT
120IMPORTANT: such. :IMPORTANT
120 It seems other find it useful as (System Attention Key) which is 121 It seems other find it useful as (System Attention Key) which is
121useful when you want to exit a program that will not let you switch consoles. 122useful when you want to exit a program that will not let you switch consoles.
122(For example, X or a svgalib program.) 123(For example, X or a svgalib program.)