Blame view
Documentation/ramoops.txt
5.55 KB
4126dacb5 Documentation: ad... |
1 2 3 4 |
Ramoops oops/panic logger ========================= Sergiu Iordache <sergiu@chromium.org> |
9ba80d99c ramoops: use psto... |
5 |
Updated: 17 November 2011 |
4126dacb5 Documentation: ad... |
6 7 8 9 10 11 12 13 14 |
0. Introduction Ramoops is an oops/panic logger that writes its logs to RAM before the system crashes. It works by logging oopses and panics in a circular buffer. Ramoops needs a system with persistent RAM so that the content of that area can survive after a restart. 1. Ramoops concepts |
027bc8b08 pstore-ram: Allow... |
15 16 |
Ramoops uses a predefined memory area to store the dump. The start and size and type of the memory area are set using three variables: |
4126dacb5 Documentation: ad... |
17 18 19 |
* "mem_address" for the start * "mem_size" for the size. The memory size will be rounded down to a power of two. |
027bc8b08 pstore-ram: Allow... |
20 21 22 23 24 25 26 27 |
* "mem_type" to specifiy if the memory type (default is pgprot_writecombine). Typically the default value of mem_type=0 should be used as that sets the pstore mapping to pgprot_writecombine. Setting mem_type=1 attempts to use pgprot_noncached, which only works on some platforms. This is because pstore depends on atomic operations. At least on ARM, pgprot_noncached causes the memory to be mapped strongly ordered, and atomic operations on strongly ordered memory are implementation defined, and won't work on many ARMs such as omaps. |
4126dacb5 Documentation: ad... |
28 29 30 31 32 33 34 35 36 37 |
The memory area is divided into "record_size" chunks (also rounded down to power of two) and each oops/panic writes a "record_size" chunk of information. Dumping both oopses and panics can be done by setting 1 in the "dump_oops" variable while setting 0 in that variable dumps only the panics. The module uses a counter to record multiple dumps but the counter gets reset on restart (i.e. new dumps after the restart will overwrite old ones). |
39eb7e979 pstore/ram: Add E... |
38 39 40 41 |
Ramoops also supports software ECC protection of persistent memory regions. This might be useful when a hardware reset was used to bring the machine back to life (i.e. a watchdog triggered). In such cases, RAM may be somewhat corrupt, but usually it is restorable. |
4126dacb5 Documentation: ad... |
42 |
2. Setting the parameters |
529182e20 ramoops: use DT r... |
43 44 45 46 47 48 49 50 |
Setting the ramoops parameters can be done in several different manners: A. Use the module parameters (which have the names of the variables described as before). For quick debugging, you can also reserve parts of memory during boot and then use the reserved memory for ramoops. For example, assuming a machine with > 128 MB of memory, the following kernel command line will tell the kernel to use only the first 128 MB of memory, and place ECC-protected ramoops region at 128 MB boundary: |
958502d83 pstore/ram: Add s... |
51 |
"mem=128M ramoops.mem_address=0x8000000 ramoops.ecc=1" |
529182e20 ramoops: use DT r... |
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
B. Use Device Tree bindings, as described in Documentation/device-tree/bindings/reserved-memory/ramoops.txt. For example: reserved-memory { #address-cells = <2>; #size-cells = <2>; ranges; ramoops@8f000000 { compatible = "ramoops"; reg = <0 0x8f000000 0 0x100000>; record-size = <0x4000>; console-size = <0x4000>; }; }; C. Use a platform device and set the platform data. The parameters can then |
4126dacb5 Documentation: ad... |
71 |
be set through that platform data. An example of doing that is: |
1894a253d ramoops: Move to ... |
72 |
#include <linux/pstore_ram.h> |
4126dacb5 Documentation: ad... |
73 74 75 76 77 |
[...] static struct ramoops_platform_data ramoops_data = { .mem_size = <...>, .mem_address = <...>, |
027bc8b08 pstore-ram: Allow... |
78 |
.mem_type = <...>, |
4126dacb5 Documentation: ad... |
79 80 |
.record_size = <...>, .dump_oops = <...>, |
39eb7e979 pstore/ram: Add E... |
81 |
.ecc = <...>, |
4126dacb5 Documentation: ad... |
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
}; static struct platform_device ramoops_dev = { .name = "ramoops", .dev = { .platform_data = &ramoops_data, }, }; [... inside a function ...] int ret; ret = platform_device_register(&ramoops_dev); if (ret) { printk(KERN_ERR "unable to register platform device "); return ret; } |
958502d83 pstore/ram: Add s... |
100 101 102 103 104 105 106 |
You can specify either RAM memory or peripheral devices' memory. However, when specifying RAM, be sure to reserve the memory by issuing memblock_reserve() very early in the architecture code, e.g.: #include <linux/memblock.h> memblock_reserve(ramoops_data.mem_address, ramoops_data.mem_size); |
4126dacb5 Documentation: ad... |
107 108 109 110 111 112 |
3. Dump format The data dump begins with a header, currently defined as "====" followed by a timestamp and a new line. The dump then continues with the actual data. 4. Reading the data |
9ba80d99c ramoops: use psto... |
113 114 115 |
The dump data can be read from the pstore filesystem. The format for these files is "dmesg-ramoops-N", where N is the record number in memory. To delete a stored record from RAM, simply unlink the respective pstore file. |
a694d1b59 pstore/ram: Add f... |
116 117 118 119 120 121 122 123 |
5. Persistent function tracing Persistent function tracing might be useful for debugging software or hardware related hangs. The functions call chain log is stored in a "ftrace-ramoops" file. Here is an example of usage: # mount -t debugfs debugfs /sys/kernel/debug/ |
65f8c95e4 pstore/ftrace: Co... |
124 |
# echo 1 > /sys/kernel/debug/pstore/record_ftrace |
a694d1b59 pstore/ram: Add f... |
125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# reboot -f [...] # mount -t pstore pstore /mnt/ # tail /mnt/ftrace-ramoops 0 ffffffff8101ea64 ffffffff8101bcda native_apic_mem_read <- disconnect_bsp_APIC+0x6a/0xc0 0 ffffffff8101ea44 ffffffff8101bcf6 native_apic_mem_write <- disconnect_bsp_APIC+0x86/0xc0 0 ffffffff81020084 ffffffff8101a4b5 hpet_disable <- native_machine_shutdown+0x75/0x90 0 ffffffff81005f94 ffffffff8101a4bb iommu_shutdown_noop <- native_machine_shutdown+0x7b/0x90 0 ffffffff8101a6a1 ffffffff8101a437 native_machine_emergency_restart <- native_machine_restart+0x37/0x40 0 ffffffff811f9876 ffffffff8101a73a acpi_reboot <- native_machine_emergency_restart+0xaa/0x1e0 0 ffffffff8101a514 ffffffff8101a772 mach_reboot_fixups <- native_machine_emergency_restart+0xe2/0x1e0 0 ffffffff811d9c54 ffffffff8101a7a0 __const_udelay <- native_machine_emergency_restart+0x110/0x1e0 0 ffffffff811d9c34 ffffffff811d9c80 __delay <- __const_udelay+0x30/0x40 0 ffffffff811d9d14 ffffffff811d9c3f delay_tsc <- __delay+0xf/0x20 |