分类:
2012-02-25 18:10:45
原文地址:Kdump & Crash 学习笔记(二) 作者:ChaoYe89
default=0timeout=3splashimage=(hd0,0)/grub/splash.xpm.gzhiddenmenutitle Fedora (2.6.34.6-54.fc13.i686.PAE)root (hd0,0)kernel /vmlinuz-2.6.34.6-54.fc13.i686.PAE ro root=/dev/mapper/vg_dereklaptop-lv_root rd_LVM_LV=vg_dereklaptop/lv_root rd_LVM_LV=vg_dereklaptop/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet rdblacklist=nouveau crashkernel=256Minitrd /initramfs-2.6.34.6-54.fc13.i686.PAE.img
这个是当前内核的分配情况:[root@Derek-Laptop derek]# cat /proc/cmdline
ro root=/dev/mapper/vg_dereklaptop-lv_root rd_LVM_LV=vg_dereklaptop/lv_root rd_LVM_LV=vg_dereklaptop/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet rdblacklist=nouveau
[root@Derek-Laptop derek]# cat /proc/iomem
00000000-00000fff : reserved
00001000-0009f7ff : System RAM
0009f800-0009ffff : reserved
000a0000-000bffff : Video RAM area
000c0000-000cefff : Video ROM
000cf000-000cffff : Adapter ROM
000dc000-000fffff : reserved
000f0000-000fffff : System ROM
00100000-7fedffff : System RAM
00400000-007a7dcd : Kernel code
007a7dce-009f2db7 : Kernel data
00a85000-00b5fb2f : Kernel bss
7fee0000-7feecfff : ACPI Tables
7feed000-7fefffff : ACPI Non-volatile Storage
7ff00000-7fffffff : reserved
80000000-83ffffff : PCI Bus 0000:05
80000000-83ffffff : PCI CardBus 0000:06
84000000-841fffff : PCI Bus 0000:03
88000000-8bffffff : PCI CardBus 0000:06
c0000000-cfffffff : PCI Bus 0000:01
c0000000-cfffffff : 0000:01:00.0
d0000000-d1ffffff : PCI Bus 0000:02
d2000000-d3ffffff : PCI Bus 0000:02
d4000000-d5ffffff : PCI Bus 0000:01
d4000000-d4ffffff : 0000:01:00.0
d5000000-d5ffffff : 0000:01:00.0
d5000000-d5ffffff : nvidia
d6000000-d60fffff : PCI Bus 0000:03
d6000000-d6000fff : 0000:03:00.0
d6000000-d6000fff : iwl3945
d6100000-d61fffff : PCI Bus 0000:05
d6100000-d61000ff : 0000:05:01.0
d6100000-d61000ff : 8139too
d6100400-d61004ff : 0000:05:06.1
d6100400-d61004ff : mmc0
d6100800-d6100fff : 0000:05:06.0
d6100800-d6100fff : firewire_ohci
d6101400-d61014ff : 0000:05:06.2
d6102000-d6102fff : 0000:05:04.0
d6102000-d6102fff : yenta_socket
d6400000-d6403fff : 0000:00:1b.0
d6400000-d6403fff : ICH HD audio
d6404000-d64043ff : 0000:00:1d.7
d6404000-d64043ff : ehci_hcd
e0000000-efffffff : PCI MMCONFIG 0000 [bus 00-ff]
e0000000-efffffff : reserved
e0000000-efffffff : pnp 00:01
fec00000-fec0ffff : reserved
fec00000-fec003ff : IOAPIC 0
fed00000-fed003ff : HPET 0
fed00000-fed003ff : reserved
fed14000-fed19fff : reserved
fed14000-fed17fff : pnp 00:01
fed18000-fed18fff : pnp 00:01
fed19000-fed19fff : pnp 00:01
fed1c000-fed8ffff : reserved
fed1c000-fed1ffff : pnp 00:01
fed20000-fed3ffff : pnp 00:01
fed40000-fed44fff : pnp 00:01
fed45000-fed8ffff : pnp 00:01
fee00000-fee00fff : Local APIC
fee00000-fee00fff : reserved
ff000000-ffffffff : reserved
[root@Derek-Laptop derek]# cat /proc/meminfo
MemTotal: 2060964 kB
MemFree: 780256 kB
Buffers: 38276 kB
Cached: 706092 kB
SwapCached: 0 kB
Active: 755348 kB
Inactive: 378900 kB
Active(anon): 390404 kB
Inactive(anon): 10036 kB
Active(file): 364944 kB
Inactive(file): 368864 kB
Unevictable: 32 kB
Mlocked: 32 kB
HighTotal: 1188744 kB
HighFree: 65304 kB
LowTotal: 872220 kB
LowFree: 714952 kB
SwapTotal: 4128764 kB
SwapFree: 4128764 kB
Dirty: 35784 kB
Writeback: 0 kB
AnonPages: 389904 kB
Mapped: 146244 kB
Shmem: 10568 kB
Slab: 56000 kB
SReclaimable: 29672 kB
SUnreclaim: 26328 kB
KernelStack: 2712 kB
PageTables: 12548 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 5159244 kB
Committed_AS: 1583520 kB
VmallocTotal: 122880 kB
VmallocUsed: 67284 kB
VmallocChunk: 18428 kB
HardwareCorrupted: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 81912 kB
DirectMap2M: 825344 kB
再查看当前的内核参数:[root@Derek-Laptop derek]# service kdump status
Kdump is operational
[root@Derek-Laptop derek]# cat /proc/cmdlinero root=/dev/mapper/vg_dereklaptop-lv_root rd_LVM_LV=vg_dereklaptop/lv_root rd_LVM_LV=vg_dereklaptop/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet rdblacklist=nouveau crashkernel=256M
[root@Derek-Laptop derek]# cat /proc/iomem
00000000-00000fff : reserved
00001000-0009f7ff : System RAM
0009f800-0009ffff : reserved
000a0000-000bffff : Video RAM area
000c0000-000cefff : Video ROM
000cf000-000cffff : Adapter ROM
000dc000-000fffff : reserved
000f0000-000fffff : System ROM
00100000-7fedffff : System RAM
00400000-007a7dcd : Kernel code
007a7dce-009f2db7 : Kernel data
00a85000-00b5fb2f : Kernel bss
02000000-11ffffff : Crash kernel
7fee0000-7feecfff : ACPI Tables
7feed000-7fefffff : ACPI Non-volatile Storage
7ff00000-7fffffff : reserved
80000000-83ffffff : PCI Bus 0000:05
80000000-83ffffff : PCI CardBus 0000:06
84000000-841fffff : PCI Bus 0000:03
88000000-8bffffff : PCI CardBus 0000:06
c0000000-cfffffff : PCI Bus 0000:01
c0000000-cfffffff : 0000:01:00.0
d0000000-d1ffffff : PCI Bus 0000:02
d2000000-d3ffffff : PCI Bus 0000:02
d4000000-d5ffffff : PCI Bus 0000:01
d4000000-d4ffffff : 0000:01:00.0
d5000000-d5ffffff : 0000:01:00.0
d5000000-d5ffffff : nvidia
d6000000-d60fffff : PCI Bus 0000:03
d6000000-d6000fff : 0000:03:00.0
d6000000-d6000fff : iwl3945
d6100000-d61fffff : PCI Bus 0000:05
d6100000-d61000ff : 0000:05:01.0
d6100000-d61000ff : 8139too
d6100400-d61004ff : 0000:05:06.1
d6100400-d61004ff : mmc0
d6100800-d6100fff : 0000:05:06.0
d6100800-d6100fff : firewire_ohci
d6101000-d61010ff : 0000:05:06.2
d6102000-d6102fff : 0000:05:04.0
d6102000-d6102fff : yenta_socket
d6400000-d6403fff : 0000:00:1b.0
d6400000-d6403fff : ICH HD audio
d6404000-d64043ff : 0000:00:1d.7
d6404000-d64043ff : ehci_hcd
e0000000-efffffff : PCI MMCONFIG 0000 [bus 00-ff]
e0000000-efffffff : reserved
e0000000-efffffff : pnp 00:01
fec00000-fec0ffff : reserved
fec00000-fec003ff : IOAPIC 0
fed00000-fed003ff : HPET 0
fed00000-fed003ff : reserved
fed14000-fed19fff : reserved
fed14000-fed17fff : pnp 00:01
fed18000-fed18fff : pnp 00:01
fed19000-fed19fff : pnp 00:01
fed1c000-fed8ffff : reserved
fed1c000-fed1ffff : pnp 00:01
fed20000-fed3ffff : pnp 00:01
fed40000-fed44fff : pnp 00:01
fed45000-fed8ffff : pnp 00:01
fee00000-fee00fff : Local APIC
fee00000-fee00fff : reserved
ff000000-ffffffff : reserved
可以看到,当前内核可使用的内存已经减少256M了。Crash Kernel的内存分配已经成功了,Kdump服务也启动了。当前内核崩溃时,Crash Kernel会使用这256M内存,在某个地址展开,具体是哪个地址,看看iomem就知道了^_^[root@Derek-Laptop derek]# cat /proc/meminfo
MemTotal: 1798820 kB
MemFree: 880520 kB
Buffers: 33484 kB
Cached: 433800 kB
SwapCached: 0 kB
Active: 415720 kB
Inactive: 361112 kB
Active(anon): 309948 kB
Inactive(anon): 8564 kB
Active(file): 105772 kB
Inactive(file): 352548 kB
Unevictable: 32 kB
Mlocked: 32 kB
HighTotal: 1188744 kB
HighFree: 419820 kB
LowTotal: 610076 kB
LowFree: 460700 kB
SwapTotal: 4128764 kB
SwapFree: 4128764 kB
Dirty: 12036 kB
Writeback: 0 kB
AnonPages: 309572 kB
Mapped: 132636 kB
Shmem: 8972 kB
Slab: 50984 kB
SReclaimable: 25408 kB
SUnreclaim: 25576 kB
KernelStack: 2624 kB
PageTables: 11112 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 5028172 kB
Committed_AS: 1270672 kB
VmallocTotal: 122880 kB
VmallocUsed: 67252 kB
VmallocChunk: 20476 kB
HardwareCorrupted: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 67576 kB
DirectMap2M: 839680 kB