1. /proc 정보사용
# ls /proc/ 1 252 66 driver mounts 10 256 68 execdomains mtd 11 3 7 fb net 12 390 70 filesystems pagetypeinfo 13 396 72 fs partitions 14 405 74 interrupts scsi 15 42 76 iomem self 16 43 8 ioports slabinfo 17 44 82 irq softirqs 18 48 9 kallsyms stat 19 5 asound key-users sys 2 50 buddyinfo keys sysrq-trigger 20 52 bus kmsg sysvipc 21 54 cmdline kpagecount timer_list 22 56 config.gz kpageflags tty 228 58 cpu loadavg uptime 23 6 cpuinfo locks version 24 60 crypto meminfo vmallocinfo 25 62 devices misc vmstat 250 64 diskstats modules zoneinfo
# ls /proc/ 1 456 579 fs self 152 461 592 graphics slabinfo 154 466 6 interrupts softirqs 155 471 606 iomem stat 157 476 636 ioports sys 163 481 7 irq sysrec 174 486 8 kallsyms sysvipc 186 491 959 key-users timer_list 187 496 976 kmsg tnk 2 5 990 kpagecount tty 269 501 buddyinfo kpageflags umap 275 504 bus loadavg uptime 3 507 cmdline locks version 329 510 consoles media-mem vfmw 346 513 cpu meminfo vfmw_chn 362 516 cpuinfo misc vfmw_dbg 363 519 crypto modules vfmw_dec 364 522 devices mounts vfmw_prn 365 525 diskstats mtd vfmw_scd 366 528 driver net vmallocinfo 4 531 execdomains pagetypeinfo vmstat 439 562 fb partitions yaffs 442 578 filesystems scsi zoneinfo
상위와 같이 Kernel Version 및 SoC마다 지원해주는 proc 기능이 다르고, 기능이 구현이 안되는 경우도 있으니 이런 부분은 조심해서 확인하자.
- interrupt 분석
$ cat /proc/interrupts // 모든 Interrupt 정보 확인 $ ls /proc/irq/number/
- Kernel Symbol Table 확인
$ cat /proc/kallsyms // Kernel의 Sysmbol Table 확인 및 Memory 주소 확인
- Kernel HW I/O Memory 확인
$ cat /proc/iomem // Kernel의 HW I/O Memory확인 $ cat /proc/modules // Kernel Module Memory 확인
$ cat /proc/vmallocinfo 0xbf000000-0xbf026000 155648 module_alloc_update_bounds+0x14/0x64 pages=37 vmalloc 0xbf02f000-0xbf035000 24576 module_alloc_update_bounds+0x14/0x64 pages=5 vmalloc 0xbf039000-0xbf03b000 8192 module_alloc_update_bounds+0x14/0x64 pages=1 vmalloc 0xbf03d000-0xbf049000 49152 module_alloc_update_bounds+0x14/0x64 pages=11 vmalloc 0xbf04f000-0xbf05b000 49152 module_alloc_update_bounds+0x14/0x64 pages=11 vmalloc 0xbf061000-0xbf090000 192512 module_alloc_update_bounds+0x14/0x64 pages=46 vmalloc 0xbf09a000-0xbf0bb000 135168 module_alloc_update_bounds+0x14/0x64 pages=32 vmalloc 0xbf0c0000-0xbf0d7000 94208 module_alloc_update_bounds+0x14/0x64 pages=22 vmalloc 0xbf0dd000-0xbf10e000 200704 module_alloc_update_bounds+0x14/0x64 pages=48 vmalloc 0xbf113000-0xbf11e000 45056 module_alloc_update_bounds+0x14/0x64 pages=10 vmalloc 0xbf123000-0xbf14b000 163840 module_alloc_update_bounds+0x14/0x64 pages=39 vmalloc 0xbf153000-0xbf17a000 159744 module_alloc_update_bounds+0x14/0x64 pages=38 vmalloc 0xbf182000-0xbf18f000 53248 module_alloc_update_bounds+0x14/0x64 pages=12 vmalloc 0xbf194000-0xbf1ca000 221184 module_alloc_update_bounds+0x14/0x64 pages=53 vmalloc 0xbf1d8000-0xbf236000 385024 module_alloc_update_bounds+0x14/0x64 pages=93 vmalloc 0xbf24d000-0xbf293000 286720 module_alloc_update_bounds+0x14/0x64 pages=69 vmalloc 0xbf29f000-0xbf2a8000 36864 module_alloc_update_bounds+0x14/0x64 pages=8 vmalloc 0xbf2ac000-0xbf2d8000 180224 module_alloc_update_bounds+0x14/0x64 pages=43 vmalloc 0xbf2df000-0xbf2ed000 57344 module_alloc_update_bounds+0x14/0x64 pages=13 vmalloc 0xbf2f2000-0xbf2f4000 8192 module_alloc_update_bounds+0x14/0x64 pages=1 vmalloc 0xbf2f6000-0xbf309000 77824 module_alloc_update_bounds+0x14/0x64 pages=18 vmalloc 0xbf30f000-0xbf337000 163840 module_alloc_update_bounds+0x14/0x64 pages=39 vmalloc 0xbf33d000-0xbf398000 372736 module_alloc_update_bounds+0x14/0x64 pages=90 vmalloc 0xbf3ac000-0xbf3da000 188416 module_alloc_update_bounds+0x14/0x64 pages=45 vmalloc 0xbf3e5000-0xbf3e8000 12288 module_alloc_update_bounds+0x14/0x64 pages=2 vmalloc 0xbf3ea000-0xbf3ed000 12288 module_alloc_update_bounds+0x14/0x64 pages=2 vmalloc 0xbf3f0000-0xbf3f4000 16384 module_alloc_update_bounds+0x14/0x64 pages=3 vmalloc 0xbf3f7000-0xbf411000 106496 module_alloc_update_bounds+0x14/0x64 pages=25 vmalloc 0xbf414000-0xbf419000 20480 module_alloc_update_bounds+0x14/0x64 pages=4 vmalloc 0xbf41c000-0xbf421000 20480 module_alloc_update_bounds+0x14/0x64 pages=4 vmalloc 0xbf424000-0xbf447000 143360 module_alloc_update_bounds+0x14/0x64 pages=34 vmalloc 0xbf44c000-0xbf475000 167936 module_alloc_update_bounds+0x14/0x64 pages=40 vmalloc 0xbf479000-0xbf488000 61440 module_alloc_update_bounds+0x14/0x64 pages=14 vmalloc 0xbf48c000-0xbf491000 20480 module_alloc_update_bounds+0x14/0x64 pages=4 vmalloc 0xd0804000-0xd0810000 49152 cramfs_uncompress_init+0x34/0x64 pages=11 vmalloc 0xd0810000-0xd081c000 49152 zisofs_init+0x14/0x34 pages=11 vmalloc 0xd081c000-0xd081f000 12288 jffs2_lzo_init+0x28/0x78 pages=2 vmalloc 0xd0831000-0xd083d000 49152 jffs2_zlib_init+0x5c/0xb0 pages=11 vmalloc 0xd083e000-0xd0840000 8192 hinfc301_probe+0x88/0x3a0 ioremap 0xd0852000-0xd0854000 8192 hinfc301_probe+0xc4/0x3a0 ioremap 0xd0854000-0xd0856000 8192 hinfc301_probe+0xf0/0x3a0 ioremap 0xd0856000-0xd0858000 8192 hi_mci_probe+0x17c/0x460 ioremap 0xd085a000-0xd085c000 8192 SYS_HAL_Init+0x6c/0x174 [hi3521_sys] ioremap 0xd0860000-0xd0871000 69632 pl011_probe+0x190/0x294 ioremap 0xd0880000-0xd0891000 69632 pl011_probe+0x190/0x294 ioremap 0xd0891000-0xd08d4000 274432 jffs2_zlib_init+0x20/0xb0 pages=66 vmalloc 0xd08d4000-0xd08e5000 69632 jffs2_lzo_init+0x18/0x78 pages=16 vmalloc 0xd08fe000-0xd0900000 8192 VcmpHalInit+0x38/0x104 [vcmp] ioremap 0xd0900000-0xd0911000 69632 devm_ioremap+0x48/0x78 ioremap 0xd0914000-0xd0918000 16384 TdeHalInit+0x264/0x374 [hi3521_tde] ioremap 0xd091c000-0xd091f000 12288 wf_ipc_init+0x100/0x4c8 [wfcommon] pages=2 vmalloc 0xd0920000-0xd0931000 69632 hiusb_ehci_hcd_drv_probe+0xcc/0x160 ioremap 0xd093c000-0xd093f000 12288 wf_ipc_init+0x3bc/0x4c8 [wfcommon] pages=2 vmalloc 0xd0940000-0xd0951000 69632 hiusb_ohci_hcd_drv_probe+0xc0/0x154 ioremap 0xd0980000-0xd09a1000 135168 stmmac_dvr_probe+0xe8/0xa50 [stmmac] ioremap 0xd09be000-0xd09c0000 8192 VoieHalInit+0x20/0x40 [hi3521_aenc] ioremap 0xd09c0000-0xd09d1000 69632 SYS_HAL_Init+0x20/0x174 [hi3521_sys] ioremap 0xd09e0000-0xd09f1000 69632 SYS_HAL_Init+0x48/0x174 [hi3521_sys] ioremap 0xd0a00000-0xd0a11000 69632 SYS_HAL_Init+0x8c/0x174 [hi3521_sys] ioremap 0xd0b00000-0xd0bc1000 790528 _mmb_map2kern+0x68/0xd0 [mmz] ioremap 0xd0ce0000-0xd0cf1000 69632 HAL_VOU_Init+0x20/0x30 [hi3521_vou] ioremap 0xd0da0000-0xd0da9000 36864 _mmb_map2kern+0x68/0xd0 [mmz] ioremap 0xd0db0000-0xd0dbe000 57344 _mmb_map2kern+0x68/0xd0 [mmz] ioremap 0xd0e00000-0xd0f96000 1662976 _mmb_map2kern+0x68/0xd0 [mmz] ioremap 0xd0fe0000-0xd0ff1000 69632 DRV_HDMI_BoardInit+0x20/0x30 [hi3521_hdmi] ioremap 0xd1000000-0xd17ea000 8298496 _mmb_map2kern+0x68/0xd0 [mmz] ioremap 0xd1800000-0xd1996000 1662976 _mmb_map2kern+0x68/0xd0 [mmz] ioremap 0xd1a11000-0xd1a92000 528384 wf_ipc_init+0xd4/0x4c8 [wfcommon] pages=128 vmalloc 0xd1ac0000-0xd1ad1000 69632 dmac_init+0x44/0x10c [hidmac] ioremap 0xd1b00000-0xd1bf1000 987136 wfw_init+0x16c/0x1d4 [wfcommon] ioremap 0xd1bf1000-0xd1ff2000 4198400 wf_ipc_init+0xd4/0x4c8 [wfcommon] pages=1024 vmalloc 0xd1ff2000-0xd23f3000 4198400 wf_ipc_init+0x1ac/0x4c8 [wfcommon] pages=1024 vmalloc 0xd23f3000-0xd25f4000 2101248 wf_ipc_init+0xd4/0x4c8 [wfcommon] pages=512 vmalloc 0xd25f4000-0xd27f5000 2101248 wf_ipc_init+0x314/0x4c8 [wfcommon] pages=512 vmalloc 0xd27f5000-0xd28f6000 1052672 wf_ipc_init+0xd4/0x4c8 [wfcommon] pages=256 vmalloc 0xd28f6000-0xd30f7000 8392704 wf_ipc_init+0x100/0x4c8 [wfcommon] pages=2048 vmalloc vpages 0xd30f7000-0xd32f8000 2101248 wf_ipc_init+0xd4/0x4c8 [wfcommon] pages=512 vmalloc 0xd32f8000-0xd33f9000 1052672 wf_ipc_init+0xd4/0x4c8 [wfcommon] pages=256 vmalloc 0xd33f9000-0xd3bfa000 8392704 wf_ipc_init+0x3bc/0x4c8 [wfcommon] pages=2048 vmalloc vpages 0xd3bfa000-0xd3c7b000 528384 wf_ipc_init+0x1f4/0x4c8 [wfcommon] pages=128 vmalloc
참고사항
- Address : Virtual Address 이지만 뒤에 phy 옵션으로 제공하는 경우도 있음
- 관련 함수 (ioremap , ioremap_nocache,vmalloc ... )
request_mem_region() 으로 할당된 memory는 아래에 표시.
$ cat /proc/iomem 10000000-10000100 : hinand 10020000-10020fff : hi_mci.0 10080000-1008ffff : ahci.0 100a0000-100affff : hiusb-ohci.0 100a0000-100affff : ohci_hcd 100b0000-100bffff : hiusb-ehci.0 100b0000-100bffff : ehci_hcd 101c0000-101dffff : stmmaceth.0 101c0000-101dffff : stmmaceth 20030000-200300ff : stmmaceth.0 20030000-20030064 : hinand 20080000-2008ffff : uart:0 20080000-20080fff : uart-pl011 20090000-2009ffff : uart:1 20090000-20090fff : uart-pl011 20700000-2070ffff : l2cache.0 50000000-50000880 : hinand 80000000-83ffffff : System RAM 8002a000-805acfff : Kernel text 805ae000-8062aa37 : Kernel data
상위 정보는 Kernel version or SoC마다 다를 수 있으므로 참고
- Kernel의 시간체크
$ cat /proc/uptime // Kernel이 Boot Up 시간표시
- 사용중인 Device 확인
$ cat /proc/devices Character devices: 1 mem 4 /dev/vc/0 4 tty 5 /dev/tty 5 /dev/console 5 /dev/ptmx 7 vcs 10 misc 13 input 21 sg 29 fb 90 mtd 128 ptm 136 pts 166 ttyACM 180 usb 189 usb_device 204 ttyAMA 254 bsg Block devices: 1 ramdisk 259 blkext 7 loop 8 sd 11 sr 31 mtdblock 65 sd 66 sd 67 sd 68 sd 69 sd 70 sd 71 sd 128 sd 129 sd 130 sd 131 sd 132 sd 133 sd 134 sd 135 sd 179 mmc 240 romblock
- /proc/self : 현재 동작 중인 pid
- /proc/number : pid 정보
$ ls /proc/250/ attr exe mountstats smaps auxv fd net stat clear_refs fdinfo oom_adj statm cmdline limits oom_score status comm maps oom_score_adj task coredump_filter mem pagemap wchan cwd mountinfo personality environ mounts root
$ cat /proc/250/maps 00008000-000a6000 r-xp 00000000 01:00 6175 /usr/sbin/telnetd 000ae000-000af000 rw-p 0009e000 01:00 6175 /usr/sbin/telnetd 000af000-000d2000 rw-p 00000000 00:00 0 [heap] 40033000-40034000 rw-p 00000000 00:00 0 4004a000-4004b000 rw-p 00000000 00:00 0 400ca000-400e7000 r-xp 00000000 01:00 4005 /lib/ld-2.8.so 400ee000-400ef000 r--p 0001c000 01:00 4005 /lib/ld-2.8.so 400ef000-400f0000 rw-p 0001d000 01:00 4005 /lib/ld-2.8.so 400f0000-40195000 r-xp 00000000 01:00 3985 /lib/libm-2.8.so 40195000-4019c000 ---p 000a5000 01:00 3985 /lib/libm-2.8.so 4019c000-4019d000 r--p 000a4000 01:00 3985 /lib/libm-2.8.so 4019d000-4019e000 rw-p 000a5000 01:00 3985 /lib/libm-2.8.so 4019e000-402bb000 r-xp 00000000 01:00 4006 /lib/libc-2.8.so 402bb000-402c2000 ---p 0011d000 01:00 4006 /lib/libc-2.8.so 402c2000-402c4000 r--p 0011c000 01:00 4006 /lib/libc-2.8.so 402c4000-402c5000 rw-p 0011e000 01:00 4006 /lib/libc-2.8.so 402c5000-402c8000 rw-p 00000000 00:00 0 beb73000-beb94000 rw-p 00000000 00:00 0 [stack] ffff0000-ffff1000 r-xp 00000000 00:00 0 [vectors] $ cat /proc/250/mounts rootfs / rootfs rw 0 0 /dev/root / ext2 rw,relatime,errors=continue 0 0 devtmpfs /dev devtmpfs rw,relatime,size=246140k,nr_inodes=61535,mode=755 0 0 proc /proc proc rw,relatime 0 0 tmpfs /mnt/.splash tmpfs rw,relatime,size=40k 0 0 sysfs /sys sysfs rw,relatime 0 0 devpts /dev/pts devpts rw,relatime,gid=5,mode=620 0 0 /dev/mtdblock11 /opt ext2 ro,relatime,errors=continue 0 0 /dev/mtdblock14 /rdk jffs2 ro,relatime 0 0
http://www.makelinux.net/ldd3/chp-9-sect-4
http://www.tldp.org/LDP/sag/html/proc-fs.html
http://bestskp.tistory.com/121
https://www.kernel.org/doc/Documentation/filesystems/proc.txt
https://www.google.co.kr/url?sa=t&rct=j&q=&esrc=s&source=web&cd=63&ved=0CCsQFjACODw&url=http%3A%2F%2Fcfile25.uf.tistory.com%2Fattach%2F242E0445514034683BF6FE&ei=SEyiVMvmC9OWuASh7YCoBg&usg=AFQjCNF01zVOTf66tox721ZrWIJ1CcrhVA&sig2=jDYliavyZOTf6nj4GcmsYw&bvm=bv.82001339,d.dGc&cad=rjt
댓글 없음 :
댓글 쓰기