[开发杂项][调试]debug into kernel

problem

  • a blocked process on server
  • gdb get few infomation
  • log get few infomation

top/ps check pid, check cpu utilization

strace check syscall

pstrack print userspace call stack

WCHAN, syscall

man ps | grep WCHAN
ps -flp pid
ps -flp pid
cat /proc/pid/wchan # check wait status
cat /proc/pid/syscall  # check syscall
262 .....

262 ⇒ newfstatat

man newfstatat

fstatat

print kernel space call stack

cat /proc/PID/stack

ps

ps fauwwwx
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0    896   576 ?        Sl   15:58   0:00 /init
root       239  0.0  0.0    896    84 ?        Ss   16:01   0:00 /init
root       240  0.0  0.0      0     0 ?        Z    16:01   0:00  \_ [init] <defunct>
root       242  0.0  0.0      0     0 ?        Z    16:01   0:00  \_ [init] <defunct>
root       244  0.0  0.0    896    84 ?        S    16:01   0:00  \_ /init
root       245  0.0  0.4 1242416 27228 pts/2   Ssl+ 16:01   0:01      \_ /mnt/wsl/docker-desktop/docker-desktop-proxy --distro-name Ubuntu-20.04 --docker-desktop-root /mnt/wsl/docker-desktop --show-kube-system-containers=true

list open file

 sudo lsof -p 1
COMMAND PID USER   FD      TYPE DEVICE SIZE/OFF            NODE NAME
init      1 root  cwd       DIR   8,16     4096               2 /
init      1 root  rtd       DIR   8,16     4096               2 /
init      1 root  txt       REG   0,18   632048 281474977205323 /init
init      1 root    0u      CHR    1,3      0t0              10 /dev/null
init      1 root    1u      CHR    1,3      0t0              10 /dev/null
init      1 root    2u      CHR    1,3      0t0              10 /dev/null
init      1 root    3w      CHR   1,11      0t0              15 /dev/kmsg
init      1 root    5r      REG    0,4        0      4026532184 mnt
init      1 root    6r      REG    0,4        0      4026532200 mnt
init      1 root    8u      DIR   8,16     4096               2 /
init      1 root    9u     sock    0,8      0t0           15429 protocol: AF_VSOCK
init      1 root   10u  a_inode   0,12        0           14787 [eventpoll]
init      1 root  100u     sock    0,8      0t0           15424 protocol: AF_VSOCK

kernel core dump

ipmitool 工具发送 NMI 信号
让系统产生 vmcore(Linux 内核崩溃时产生的内核转储文件)
以便后续分析

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值