Summary of Linux kernel debugging methods SysRq

Source: Internet
Author: User

SysRq

Use

SYSRQ is called the "Magic key combination" and is a debugging tool built into the Linux kernel. As long as the kernel is not fully locked, no matter what the kernel is doing, using these key combinations can collect system operation information including system memory usage, CPU task processing, process running state and so on.

" principle" "Kernel Help document Kernel/documentation/sysrq.txt"

First, the kernel configuration option is to enable the CONFIG_MAGIC_SYSRQ option so that after the system starts, the/proc/sysrq-trigger node is generated for debugging.

Second, the Kernel.sysrq=1 default enable SYSQ feature can be set in/etc/sysctl.conf. It is also possible to dynamically enable SYSRQ functions by writing/PROC/SYS/KERNEL/SYSRQ nodes. Different values are written to enable different functions:

0-disable SysRq completely

1-enable all functions of SYSRQ

2-enable control of console logging level

4-enable Control of keyboard (SAK, Unraw)

8-enable debugging dumps of processes etc.

16-enable Sync Command

32-enable remount read-only

64-enable signalling of processes (term, kill, Oom-kill)

128-allow Reboot/poweroff

256-allow nicing of all RT tasks

"Instructions for use"

#echo m >/proc/sysrq-trigger Exporting memory allocation information

#echo T >/proc/sysrq-trigger Export Current task status information

#echo p >/proc/sysrq-trigger Export current CPU register and flag bit information

#echo C >/proc/sysrq-trigger generates a null pointer panic event that causes the system to crash

#echo s >/proc/sysrq-trigger sync all mounted file systems instantly

#echo u >/proc/sysrq-trigger instantly re-mount all file systems as read-only

#echo w >/proc/sysrq-trigger dump tasks in uninterruptable blocking state

Summary of Linux kernel debugging methods SysRq

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.