diff options
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/DocBook/kernel-api.tmpl | 44 | ||||
-rw-r--r-- | Documentation/RCU/checklist.txt | 44 | ||||
-rw-r--r-- | Documentation/RCU/whatisRCU.txt | 12 | ||||
-rw-r--r-- | Documentation/devices.txt | 7 | ||||
-rw-r--r-- | Documentation/filesystems/fuse.txt | 118 | ||||
-rw-r--r-- | Documentation/filesystems/ramfs-rootfs-initramfs.txt | 146 | ||||
-rw-r--r-- | Documentation/kdump/kdump.txt | 420 | ||||
-rw-r--r-- | Documentation/memory-barriers.txt | 34 | ||||
-rw-r--r-- | Documentation/rtc.txt | 7 | ||||
-rw-r--r-- | Documentation/sysrq.txt | 5 |
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 |
290 | X!Edrivers/pci/search.c | 316 | X!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 | ||
146 | 8. Although synchronize_rcu() is a bit slower than is call_rcu(), | 146 | 8. 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 | ||
151 | 9. All RCU list-traversal primitives, which include | 189 | 9. 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 | ||
189 | rcu_assign_pointer() | 199 | rcu_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 | ||
8 | This list is the Linux Device List, the official registry of allocated | 8 | This list is the Linux Device List, the official registry of allocated |
9 | device numbers and /dev directory nodes for the Linux operating | 9 | device 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 | ||
2795 | 205 char Low-density serial ports (alternate device) | 2796 | 205 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 | ||
3112 | 257 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 | ||
21 | Filesystem 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 | |||
21 | Mount owner: | 29 | Mount 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 | ||
89 | Sysfs | 97 | Control filesystem |
90 | ~~~~~ | 98 | ~~~~~~~~~~~~~~~~~~ |
99 | |||
100 | There's a control filesystem for FUSE, which can be mounted by: | ||
91 | 101 | ||
92 | FUSE sets up the following hierarchy in sysfs: | 102 | mount -t fusectl none /sys/fs/fuse/connections |
93 | 103 | ||
94 | /sys/fs/fuse/connections/N/ | 104 | Mounting it under the '/sys/fs/fuse/connections' directory makes it |
105 | backwards compatible with earlier versions. | ||
95 | 106 | ||
96 | where N is an increasing number allocated to each new connection. | 107 | Under the fuse control filesystem each connection has a directory |
108 | named by a unique number. | ||
97 | 109 | ||
98 | For each connection the following attributes are defined: | 110 | For 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 | ||
113 | Only a privileged user may read or write these attributes. | 125 | Only the owner of the mount may read or write these files. |
126 | |||
127 | Interrupting filesystem operations | ||
128 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
129 | |||
130 | If a process issuing a FUSE filesystem request is interrupted, the | ||
131 | following 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 | |||
145 | INTERRUPT requests take precedence over other requests, so the | ||
146 | userspace filesystem will receive queued INTERRUPTs before any others. | ||
147 | |||
148 | The userspace filesystem may ignore the INTERRUPT requests entirely, | ||
149 | or may honor them by sending a reply to the _original_ request, with | ||
150 | the error set to EINTR. | ||
151 | |||
152 | It is also possible that there's a race between processing the | ||
153 | original 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 | |||
161 | If the filesystem cannot find the original request, it should wait for | ||
162 | some timeout and/or a number of new requests to arrive, after which it | ||
163 | should reply to the INTERRUPT request with an EAGAIN error. In case | ||
164 | 1) the INTERRUPT request will be requeued. In case 2) the INTERRUPT | ||
165 | reply will be ignored. | ||
114 | 166 | ||
115 | Aborting a filesystem connection | 167 | Aborting 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 | ||
145 | How do non-privileged mounts work? | 197 | How 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 | ||
307 | The solution for this is to allow requests to be interrupted while | 359 | The solution for this is to allow the filesystem to be aborted. |
308 | they 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 | |||
319 | If the filesystem daemon was single threaded, this will stop here, | ||
320 | since there's no other thread to dequeue and execute the request. | ||
321 | In this case the solution is to kill the FUSE daemon as well. If | ||
322 | there are multiple serving threads, you just have to kill them as | ||
323 | long as any remain. | ||
324 | |||
325 | Moral: a filesystem which deadlocks, can soon find itself dead. | ||
326 | 360 | ||
327 | Scenario 2 - Tricky deadlock | 361 | Scenario 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 | ||
358 | Solution is again to let the the request be interrupted (not | 392 | Solution is basically the same as above. |
359 | elaborated further). | ||
360 | |||
361 | An additional problem is that while the write buffer is being | ||
362 | copied to the request, the request must not be interrupted. This | ||
363 | is because the destination address of the copy may not be valid | ||
364 | after the request is interrupted. | ||
365 | |||
366 | This is solved with doing the copy atomically, and allowing | ||
367 | interruption while the page(s) belonging to the write buffer are | ||
368 | faulted with get_user_pages(). The 'req->locked' flag indicates | ||
369 | when the copy is taking place, and interruption is delayed until | ||
370 | this flag is unset. | ||
371 | 393 | ||
372 | Scenario 3 - Tricky deadlock with asynchronous read | 394 | An additional problem is that while the write buffer is being copied |
373 | --------------------------------------------------- | 395 | to the request, the request must not be interrupted/aborted. This is |
396 | because the destination address of the copy may not be valid after the | ||
397 | request has returned. | ||
374 | 398 | ||
375 | The same situation as above, except thread-1 will wait on page lock | 399 | This is solved with doing the copy atomically, and allowing abort |
376 | and hence it will be uninterruptible as well. The solution is to | 400 | while the page(s) belonging to the write buffer are faulted with |
377 | abort the connection with forced umount (if mount is attached) or | 401 | get_user_pages(). The 'req->locked' flag indicates when the copy is |
378 | through the abort attribute in sysfs. | 402 | taking 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. | |||
70 | What is rootfs? | 70 | What is rootfs? |
71 | --------------- | 71 | --------------- |
72 | 72 | ||
73 | Rootfs is a special instance of ramfs, which is always present in 2.6 systems. | 73 | Rootfs 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 | 74 | always present in 2.6 systems. You can't unmount rootfs for approximately the |
75 | kernel's doubly-linked list of mount points.) | 75 | same reason you can't kill the init process; rather than having special code |
76 | to check for and handle an empty list, it's smaller and simpler for the kernel | ||
77 | to just make sure certain lists can't become empty. | ||
76 | 78 | ||
77 | Most systems just mount another filesystem over it and ignore it. The | 79 | Most systems just mount another filesystem over rootfs and ignore it. The |
78 | amount of space an empty instance of ramfs takes up is tiny. | 80 | amount of space an empty instance of ramfs takes up is tiny. |
79 | 81 | ||
80 | What is initramfs? | 82 | What is initramfs? |
@@ -92,14 +94,16 @@ out of that. | |||
92 | 94 | ||
93 | All this differs from the old initrd in several ways: | 95 | All 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 | ||
125 | The 2.6 kernel build process always creates a gzipped cpio format initramfs | 129 | The 2.6 kernel build process always creates a gzipped cpio format initramfs |
126 | archive and links it into the resulting kernel binary. By default, this | 130 | archive and links it into the resulting kernel binary. By default, this |
127 | archive is empty (consuming 134 bytes on x86). The config option | 131 | archive is empty (consuming 134 bytes on x86). |
128 | CONFIG_INITRAMFS_SOURCE (for some reason buried under devices->block devices | 132 | |
129 | in menuconfig, and living in usr/Kconfig) can be used to specify a source for | 133 | The config option CONFIG_INITRAMFS_SOURCE (for some reason buried under |
130 | the initramfs archive, which will automatically be incorporated into the | 134 | devices->block devices in menuconfig, and living in usr/Kconfig) can be used |
131 | resulting binary. This option can point to an existing gzipped cpio archive, a | 135 | to specify a source for the initramfs archive, which will automatically be |
132 | directory containing files to be archived, or a text file specification such | 136 | incorporated into the resulting binary. This option can point to an existing |
133 | as the following example: | 137 | gzipped cpio archive, a directory containing files to be archived, or a text |
138 | file 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: | |||
146 | Run "usr/gen_init_cpio" (after the kernel build) to get a usage message | 151 | Run "usr/gen_init_cpio" (after the kernel build) to get a usage message |
147 | documenting the above file format. | 152 | documenting the above file format. |
148 | 153 | ||
149 | One advantage of the text file is that root access is not required to | 154 | One advantage of the configuration file is that root access is not required to |
150 | set permissions or create device nodes in the new archive. (Note that those | 155 | set permissions or create device nodes in the new archive. (Note that those |
151 | two example "file" entries expect to find files named "init.sh" and "busybox" in | 156 | two example "file" entries expect to find files named "init.sh" and "busybox" in |
152 | a directory called "initramfs", under the linux-2.6.* directory. See | 157 | a directory called "initramfs", under the linux-2.6.* directory. See |
153 | Documentation/early-userspace/README for more details.) | 158 | Documentation/early-userspace/README for more details.) |
154 | 159 | ||
155 | The kernel does not depend on external cpio tools, gen_init_cpio is created | 160 | The kernel does not depend on external cpio tools. If you specify a |
156 | from usr/gen_init_cpio.c which is entirely self-contained, and the kernel's | 161 | directory instead of a configuration file, the kernel's build infrastructure |
157 | boot-time extractor is also (obviously) self-contained. However, if you _do_ | 162 | creates a configuration file from that directory (usr/Makefile calls |
158 | happen to have cpio installed, the following command line can extract the | 163 | scripts/gen_initramfs_list.sh), and proceeds to package up that directory |
159 | generated cpio image back into its component files: | 164 | using the config file (by feeding it to usr/gen_init_cpio, which is created |
165 | from usr/gen_init_cpio.c). The kernel's build-time cpio creation code is | ||
166 | entirely self-contained, and the kernel's boot-time extractor is also | ||
167 | (obviously) self-contained. | ||
168 | |||
169 | The one thing you might need external cpio utilities installed for is creating | ||
170 | or extracting your own preprepared cpio files to feed to the kernel build | ||
171 | (instead of a config file or directory). | ||
172 | |||
173 | The following command line can extract a cpio image (either by the above script | ||
174 | or 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 | ||
178 | The following shell script can create a prebuilt cpio archive you can | ||
179 | use 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 | |||
201 | Note: The cpio man page contains some bad advice that will break your initramfs | ||
202 | archive if you follow it. It says "A typical way to generate the list | ||
203 | of filenames is with the find command; you should give find the -depth option | ||
204 | to minimize problems with permissions on directories that are unwritable or not | ||
205 | searchable." Don't do this when creating initramfs.cpio.gz images, it won't | ||
206 | work. The Linux kernel cpio extractor won't create files in a directory that | ||
207 | doesn't exist, so the directory entries must go before the files that go in | ||
208 | those directories. The above script gets them in the right order. | ||
209 | |||
210 | External initramfs images: | ||
211 | -------------------------- | ||
212 | |||
213 | If the kernel has initrd support enabled, an external cpio.gz archive can also | ||
214 | be passed into a 2.6 kernel in place of an initrd. In this case, the kernel | ||
215 | will autodetect the type (initramfs, not initrd) and extract the external cpio | ||
216 | archive into rootfs before trying to run /init. | ||
217 | |||
218 | This has the memory efficiency advantages of initramfs (no ramdisk block | ||
219 | device) but the separate packaging of initrd (which is nice if you have | ||
220 | non-GPL code you'd like to run from initramfs, without conflating it with | ||
221 | the GPL licensed Linux kernel binary). | ||
222 | |||
223 | It can also be used to supplement the kernel's built-in initamfs image. The | ||
224 | files in the external archive will overwrite any conflicting files in | ||
225 | the built-in initramfs archive. Some distributors also prefer to customize | ||
226 | a single kernel image with task-specific initramfs images, without recompiling. | ||
227 | |||
163 | Contents of initramfs: | 228 | Contents of initramfs: |
164 | ---------------------- | 229 | ---------------------- |
165 | 230 | ||
231 | An initramfs archive is a complete self-contained root filesystem for Linux. | ||
166 | If you don't already understand what shared libraries, devices, and paths | 232 | If you don't already understand what shared libraries, devices, and paths |
167 | you need to get a minimal root filesystem up and running, here are some | 233 | you need to get a minimal root filesystem up and running, here are some |
168 | references: | 234 | references: |
@@ -176,13 +242,36 @@ code against, along with some related utilities. It is BSD licensed. | |||
176 | 242 | ||
177 | I use uClibc (http://www.uclibc.org) and busybox (http://www.busybox.net) | 243 | I use uClibc (http://www.uclibc.org) and busybox (http://www.busybox.net) |
178 | myself. These are LGPL and GPL, respectively. (A self-contained initramfs | 244 | myself. These are LGPL and GPL, respectively. (A self-contained initramfs |
179 | package is planned for the busybox 1.2 release.) | 245 | package is planned for the busybox 1.3 release.) |
180 | 246 | ||
181 | In theory you could use glibc, but that's not well suited for small embedded | 247 | In theory you could use glibc, but that's not well suited for small embedded |
182 | uses like this. (A "hello world" program statically linked against glibc is | 248 | uses like this. (A "hello world" program statically linked against glibc is |
183 | over 400k. With uClibc it's 7k. Also note that glibc dlopens libnss to do | 249 | over 400k. With uClibc it's 7k. Also note that glibc dlopens libnss to do |
184 | name lookups, even when otherwise statically linked.) | 250 | name lookups, even when otherwise statically linked.) |
185 | 251 | ||
252 | A good first step is to get initramfs to run a statically linked "hello world" | ||
253 | program as init, and test it under an emulator like qemu (www.qemu.org) or | ||
254 | User 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 | |||
271 | When 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 | ||
273 | just as useful. | ||
274 | |||
186 | Why cpio rather than tar? | 275 | Why cpio rather than tar? |
187 | ------------------------- | 276 | ------------------------- |
188 | 277 | ||
@@ -241,7 +330,7 @@ the above threads) is: | |||
241 | Future directions: | 330 | Future directions: |
242 | ------------------ | 331 | ------------------ |
243 | 332 | ||
244 | Today (2.6.14), initramfs is always compiled in, but not always used. The | 333 | Today (2.6.16), initramfs is always compiled in, but not always used. The |
245 | kernel falls back to legacy boot code that is reached only if initramfs does | 334 | kernel falls back to legacy boot code that is reached only if initramfs does |
246 | not contain an /init program. The fallback is legacy code, there to ensure a | 335 | not contain an /init program. The fallback is legacy code, there to ensure a |
247 | smooth transition and allowing early boot functionality to gradually move to | 336 | smooth transition and allowing early boot functionality to gradually move to |
@@ -258,8 +347,9 @@ and so on. | |||
258 | 347 | ||
259 | This kind of complexity (which inevitably includes policy) is rightly handled | 348 | This kind of complexity (which inevitably includes policy) is rightly handled |
260 | in userspace. Both klibc and busybox/uClibc are working on simple initramfs | 349 | in userspace. Both klibc and busybox/uClibc are working on simple initramfs |
261 | packages to drop into a kernel build, and when standard solutions are ready | 350 | packages to drop into a kernel build. |
262 | and widely deployed, the kernel's legacy early boot code will become obsolete | ||
263 | and a candidate for the feature removal schedule. | ||
264 | 351 | ||
265 | But that's a while off yet. | 352 | The klibc package has now been accepted into Andrew Morton's 2.6.17-mm tree. |
353 | The kernel's current early boot code (partition detection, etc) will probably | ||
354 | be migrated into a default initramfs, automatically created and used by the | ||
355 | kernel 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 @@ | |||
1 | Documentation for kdump - the kexec-based crash dumping solution | 1 | ================================================================ |
2 | Documentation for Kdump - The kexec-based Crash Dumping Solution | ||
2 | ================================================================ | 3 | ================================================================ |
3 | 4 | ||
4 | DESIGN | 5 | This document includes overview, setup and installation, and analysis |
5 | ====== | 6 | information. |
6 | 7 | ||
7 | Kdump uses kexec to reboot to a second kernel whenever a dump needs to be | 8 | Overview |
8 | taken. This second kernel is booted with very little memory. The first kernel | 9 | ======== |
9 | reserves the section of memory that the second kernel uses. This ensures that | ||
10 | on-going DMA from the first kernel does not corrupt the second kernel. | ||
11 | 10 | ||
12 | All the necessary information about Core image is encoded in ELF format and | 11 | Kdump uses kexec to quickly boot to a dump-capture kernel whenever a |
13 | stored in reserved area of memory before crash. Physical address of start of | 12 | dump of the system kernel's memory needs to be taken (for example, when |
14 | ELF header is passed to new kernel through command line parameter elfcorehdr=. | 13 | the system panics). The system kernel's memory image is preserved across |
14 | the reboot and is accessible to the dump-capture kernel. | ||
15 | 15 | ||
16 | On i386, the first 640 KB of physical memory is needed to boot, irrespective | 16 | You can use common Linux commands, such as cp and scp, to copy the |
17 | of where the kernel loads. Hence, this region is backed up by kexec just before | 17 | memory image to a dump file on the local disk, or across the network to |
18 | rebooting into the new kernel. | 18 | a remote system. |
19 | 19 | ||
20 | In the second kernel, "old memory" can be accessed in two ways. | 20 | Kdump and kexec are currently supported on the x86, x86_64, and ppc64 |
21 | architectures. | ||
21 | 22 | ||
22 | - The first one is through a /dev/oldmem device interface. A capture utility | 23 | When 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 | 24 | the 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=) | 26 | The kexec -p command loads the dump-capture kernel into this reserved |
26 | can become handy here. | 27 | memory. |
27 | 28 | ||
28 | - The second interface is through /proc/vmcore. This exports the dump as an ELF | 29 | On 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 | 30 | regardless of where the kernel loads. Therefore, kexec backs up this |
30 | (cp, scp, etc). Further, gdb can be used to perform limited debugging on | 31 | region 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 | ||
35 | SETUP | 33 | All of the necessary information about the system kernel's core image is |
36 | ===== | 34 | encoded in the ELF format, and stored in a reserved area of memory |
35 | before a crash. The physical address of the start of the ELF header is | ||
36 | passed to the dump-capture kernel through the elfcorehdr= boot | ||
37 | parameter. | ||
38 | |||
39 | With the dump-capture kernel, you can access the memory image, or "old | ||
40 | memory," 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 | |||
54 | Setup and Installation | ||
55 | ====================== | ||
56 | |||
57 | Install kexec-tools and the Kdump patch | ||
58 | --------------------------------------- | ||
59 | |||
60 | 1) Login as the root user. | ||
61 | |||
62 | 2) 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 | |||
66 | 3) Unpack the tarball with the tar command, as follows: | ||
67 | |||
68 | tar xvpzf kexec-tools-1.101.tar.gz | ||
69 | |||
70 | 4) 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 | |||
77 | 5) Change to the kexec-tools-1.101 directory, as follows: | ||
78 | |||
79 | cd kexec-tools-1.101 | ||
80 | |||
81 | 6) 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 | |||
87 | 7) Configure the package, as follows: | ||
88 | |||
89 | ./configure | ||
90 | |||
91 | 8) Compile the package, as follows: | ||
92 | |||
93 | make | ||
94 | |||
95 | 9) Install the package, as follows: | ||
96 | |||
97 | make install | ||
98 | |||
99 | |||
100 | Download and build the system and dump-capture kernels | ||
101 | ------------------------------------------------------ | ||
102 | |||
103 | Download the mainline (vanilla) kernel source code (2.6.13-rc1 or newer) | ||
104 | from http://www.kernel.org. Two kernels must be built: a system kernel | ||
105 | and a dump-capture kernel. Use the following steps to configure these | ||
106 | kernels with the necessary kexec and Kdump features: | ||
107 | |||
108 | System kernel | ||
109 | ------------- | ||
110 | |||
111 | 1) Enable "kexec system call" in "Processor type and features." | ||
112 | |||
113 | CONFIG_KEXEC=y | ||
114 | |||
115 | 2) 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 | |||
127 | 3) 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 | |||
135 | 4) Make and install the kernel and its modules. Update the boot loader | ||
136 | (such as grub, yaboot, or lilo) configuration files as necessary. | ||
137 | |||
138 | 5) 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 | |||
149 | The dump-capture kernel | ||
150 | ----------------------- | ||
37 | 151 | ||
38 | 1) Download the upstream kexec-tools userspace package from | 152 | 1) 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 | 155 | 2) 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 | |
46 | 2) 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 | 162 | 3) 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 | 170 | 4) 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 | 176 | 5) 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 | 181 | 6) 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 | ||
78 | 3) After booting to regular kernel or first kernel, load the second kernel | 192 | 6) 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: | 198 | 7) 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, | 202 | Load 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 | 205 | After 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 | 206 | the 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. | 213 | Notes 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 | |
108 | 4) 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. | |
113 | 5) 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 | |||
235 | Kernel Panic | ||
236 | ============ | ||
237 | |||
238 | After successfully loading the dump-capture kernel as previously | ||
239 | described, the system will reboot into the dump-capture kernel if a | ||
240 | system crash is triggered. Trigger points are located in panic(), | ||
241 | die(), die_nmi() and in the sysrq handler (ALT-SysRq-c). | ||
242 | |||
243 | The following conditions will execute a crash trigger point: | ||
244 | |||
245 | If a hard lockup is detected and "NMI watchdog" is configured, the system | ||
246 | will boot into the dump-capture kernel ( die_nmi() ). | ||
247 | |||
248 | If die() is called, and it happens to be a thread with pid 0 or 1, or die() | ||
249 | is called inside interrupt context or die() is called and panic_on_oops is set, | ||
250 | the system will boot into the dump-capture kernel. | ||
251 | |||
252 | On 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 | |||
254 | For 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 | |||
257 | Write Out the Dump File | ||
258 | ======================= | ||
259 | |||
260 | After the dump-capture kernel is booted, write out the dump file with | ||
261 | the 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 | 265 | You can also access dumped memory as a /dev/oldmem device for a linear |
118 | view. To create the device, type: | 266 | and 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 | 270 | Use the dd command with suitable options for count, bs, and skip to |
123 | portions of the dump. | 271 | access specific portions of the dump. |
124 | 272 | ||
125 | Entire memory: dd if=/dev/oldmem of=oldmem.001 | 273 | To see the entire memory, use the following command: |
126 | 274 | ||
275 | dd if=/dev/oldmem of=oldmem.001 | ||
127 | 276 | ||
128 | ANALYSIS | 277 | |
278 | Analysis | ||
129 | ======== | 279 | ======== |
130 | Limited 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> | 281 | Before analyzing the dump image, you should reboot into a stable kernel. |
282 | |||
283 | You 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 | ||
285 | command: | ||
286 | |||
287 | gdb vmlinux <dump-file> | ||
134 | 288 | ||
135 | Stack trace for the task on processor 0, register display, memory display | 289 | Stack trace for the task on processor 0, register display, and memory |
136 | work fine. | 290 | display work fine. |
137 | 291 | ||
138 | Note: gdb cannot analyse core files generated in ELF64 format for i386. | 292 | Note: GDB cannot analyze core files generated in ELF64 format for x86. |
293 | On systems with a maximum of 4GB of memory, you can generate | ||
294 | ELF32-format headers using the --elf32-core-headers kernel option on the | ||
295 | dump kernel. | ||
139 | 296 | ||
140 | Latest "crash" (crash-4.0-2.18) as available on Dave Anderson's site | 297 | You can also use the Crash utility to analyze dump files in Kdump |
141 | http://people.redhat.com/~anderson/ works well with kdump format. | 298 | format. Crash is available on Dave Anderson's site at the following URL: |
142 | 299 | ||
300 | http://people.redhat.com/~anderson/ | ||
301 | |||
302 | |||
303 | To Do | ||
304 | ===== | ||
143 | 305 | ||
144 | TODO | 306 | 1) Provide a kernel pages filtering mechanism, so core file size is not |
145 | ==== | 307 | extreme on systems with huge memory banks. |
146 | 1) Provide a kernel pages filtering mechanism so that core file size is not | ||
147 | insane on systems having huge memory banks. | ||
148 | 2) 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 | ||
309 | 2) 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 | ||
152 | CONTACT | 313 | |
314 | Contact | ||
153 | ======= | 315 | ======= |
316 | |||
154 | Vivek Goyal (vgoyal@in.ibm.com) | 317 | Vivek Goyal (vgoyal@in.ibm.com) |
155 | Maneesh Soni (maneesh@in.ibm.com) | 318 | Maneesh Soni (maneesh@in.ibm.com) |
319 | |||
320 | |||
321 | Trademark | ||
322 | ========= | ||
323 | |||
324 | Linux is a trademark of Linus Torvalds in the United States, other | ||
325 | countries, 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 | |||
262 | CPU to restrict the order. | 262 | CPU to restrict the order. |
263 | 263 | ||
264 | Memory barriers are such interventions. They impose a perceived partial | 264 | Memory barriers are such interventions. They impose a perceived partial |
265 | ordering between the memory operations specified on either side of the barrier. | 265 | ordering over the memory operations on either side of the barrier. |
266 | They request that the sequence of memory events generated appears to other | 266 | |
267 | parts of the system as if the barrier is effective on that CPU. | 267 | Such enforcement is important because the CPUs and other devices in a system |
268 | can use a variety of tricks to improve performance - including reordering, | ||
269 | deferral and combination of memory operations; speculative loads; speculative | ||
270 | branch prediction and various types of caching. Memory barriers are used to | ||
271 | override or suppress these tricks, allowing the code to sanely control the | ||
272 | interaction of multiple CPUs and/or devices. | ||
268 | 273 | ||
269 | 274 | ||
270 | VARIETIES OF MEMORY BARRIER | 275 | VARIETIES 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 | |||
461 | isn't, and this behaviour can be observed on certain real CPUs (such as the DEC | 466 | isn't, and this behaviour can be observed on certain real CPUs (such as the DEC |
462 | Alpha). | 467 | Alpha). |
463 | 468 | ||
464 | To deal with this, a data dependency barrier must be inserted between the | 469 | To deal with this, a data dependency barrier or better must be inserted |
465 | address load and the data load: | 470 | between 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 | |||
484 | variable B might be stored in an even-numbered cache line. Then, if the | 489 | variable B might be stored in an even-numbered cache line. Then, if the |
485 | even-numbered bank of the reading CPU's cache is extremely busy while the | 490 | even-numbered bank of the reading CPU's cache is extremely busy while the |
486 | odd-numbered bank is idle, one can see the new value of the pointer P (&B), | 491 | odd-numbered bank is idle, one can see the new value of the pointer P (&B), |
487 | but the old value of the variable B (1). | 492 | but the old value of the variable B (2). |
488 | 493 | ||
489 | 494 | ||
490 | Another example of where data dependency barriers might by required is where a | 495 | Another 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 | ||
747 | If, however, a read barrier were to be placed between the load of E and the | 752 | If, however, a read barrier were to be placed between the load of B and the |
748 | load of A on CPU 2: | 753 | load 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 | ||
1462 | On a UP system - where this wouldn't be a problem - the smp_mb() is just a | 1467 | On a UP system - where this wouldn't be a problem - the smp_mb() is just a |
1463 | compiler barrier, thus making sure the compiler emits the instructions in the | 1468 | compiler barrier, thus making sure the compiler emits the instructions in the |
1464 | right order without actually intervening in the CPU. Since there there's only | 1469 | right order without actually intervening in the CPU. Since there's only one |
1465 | one CPU, that CPU's dependency ordering logic will take care of everything | 1470 | CPU, that CPU's dependency ordering logic will take care of everything else. |
1466 | else. | ||
1467 | 1471 | ||
1468 | 1472 | ||
1469 | ATOMIC OPERATIONS | 1473 | ATOMIC 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. | |||
44 | Programming and/or enabling interrupt frequencies greater than 64Hz is | 44 | Programming and/or enabling interrupt frequencies greater than 64Hz is |
45 | only allowed by root. This is perhaps a bit conservative, but we don't want | 45 | only allowed by root. This is perhaps a bit conservative, but we don't want |
46 | an evil user generating lots of IRQs on a slow 386sx-16, where it might have | 46 | an evil user generating lots of IRQs on a slow 386sx-16, where it might have |
47 | a negative impact on performance. Note that the interrupt handler is only | 47 | a negative impact on performance. This 64Hz limit can be changed by writing |
48 | a few lines of code to minimize any possibility of this effect. | 48 | a different value to /proc/sys/dev/rtc/max-user-freq. Note that the |
49 | interrupt handler is only a few lines of code to minimize any possibility | ||
50 | of this effect. | ||
49 | 51 | ||
50 | Also, if the kernel time is synchronized with an external source, the | 52 | Also, if the kernel time is synchronized with an external source, the |
51 | kernel will write the time back to the CMOS clock every 11 minutes. In | 53 | kernel 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 | |||
115 | when you would try to login. It will kill all programs on given console | 115 | when you would try to login. It will kill all programs on given console |
116 | and thus letting you make sure that the login prompt you see is actually | 116 | and thus letting you make sure that the login prompt you see is actually |
117 | the one from init, not some trojan program. | 117 | the one from init, not some trojan program. |
118 | IMPORTANT:In its true form it is not a true SAK like the one in :IMPORTANT | 118 | IMPORTANT: In its true form it is not a true SAK like the one in a :IMPORTANT |
119 | IMPORTANT:c2 compliant systems, and it should be mistook as such. :IMPORTANT | 119 | IMPORTANT: c2 compliant system, and it should not be mistaken as :IMPORTANT |
120 | IMPORTANT: 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 |
121 | useful when you want to exit a program that will not let you switch consoles. | 122 | useful 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.) |