lib/Kernel/magic_sysrq.pm

sysrq_display_help

sysrq_display_help();

Sends alt-sysrq-a key to print magic sysrq help menu, parses journalctl log for the presence of magic sysrq help pattern. Returns 1 if pattern is found returns 0 otherwise.

sysrq_dump_all_cpu_backtrace

sysrq_dump_all_cpu_backtrace();

Sends alt-sysrq-l key combination to print all cpu backtrace, parses journalctl log for backtrace pattern ending with "/TASK" and checks for presence of hex numbers representing CPU register values. Returns 1 if pattern is found else 0.

sysrq_show_memory

sysrq_show_memory();

Sends alt-sysrq-m key combination to print memory information, parses journalctl log to search for sysrq Memory Info pattern and checks for presence of string "Total swap". Returns 1 if string pattern is found otherwise 0.

sysrq_dump_curr_regs_flags

sysrq_dump_curr_regs_flags();

Sends the alt-sysrq-p keystroke to trigger a dump of the current CPU registers and flags to the kernel ring buffer. It then checks the journalctl logs to verify that the expected register state output (e.g., CPU#0:) was successfully captured. Returns 1 if the CPU register dump is successfully found in the logs, or 0 if the expected output is missing.

sysrq_dump_curr_tasks

sysrq_dump_curr_tasks();

Sends the alt-sysrq-t keystroke to trigger a dump of the current tasks and thread states to the kernel ring buffer. It evaluates a larger portion of the journalctl logs (up to 10,000 lines) with an extended timeout to verify that the task state information (specifically looking for runnable tasks:) was successfully recorded. Returns 1 if the task state dump is successfully found in the logs, or 0 if the expected output is missing.

sysrq_check_kconfig

sysrq_check_kconfig();

Checks whether CONFIG_MAGIC_SYSRQ is set to y in running kernel configuration. Returns true/false.

NAME

Kernel::magic_sysrq - Helper module for testing Linux Magic System Request functionality in openQA.

DESCRIPTION

This module provides a suite of helper subroutines for openQA to interact with and validate the Linux kernel's Magic System Request (SysRq) functionality.

It triggers various SysRq commands by sending specific key combinations (e.g., alt-sysrq-a) using send_key. It then parses the kernel ring buffer logs using journalctl to verify that the kernel responded correctly to the request.

The module exports the following subroutines by default: