From 3df58116f1cb0748c93cc367a368484dfc6154b0 Mon Sep 17 00:00:00 2001 From: wji Date: Wed, 21 Feb 2024 12:00:55 +0800 Subject: [PATCH] dump: add panic test when reading pvpanic device capabilities According to https://gitlab.com/qemu-project/qemu/-/blob/master/docs/ specs/pvpanic.rst, bit 0 means 'panic' and bit 1 means 'crash loaded'. The section have two bits in "capability". 3(as '11') means both are recognized in q35 machine type. 1(as '01') means compatibility in older machine types. ID: 1561 Signed-off-by: wji --- qemu/tests/cfg/pvpanic_event_check.cfg | 1 + qemu/tests/pvpanic_event_check.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/qemu/tests/cfg/pvpanic_event_check.cfg b/qemu/tests/cfg/pvpanic_event_check.cfg index 686855cc298..e4e2b0e289f 100644 --- a/qemu/tests/cfg/pvpanic_event_check.cfg +++ b/qemu/tests/cfg/pvpanic_event_check.cfg @@ -9,3 +9,4 @@ check_kexec_cmd = "dmesg | grep crash_kexec_post_notifiers=1" expect_event = "GUEST_CRASHLOADED" trigger_crash_cmd = "echo c > /proc/sysrq-trigger" + check_ISA_cmd = "lspci -v | grep 'ISA bridge'" diff --git a/qemu/tests/pvpanic_event_check.py b/qemu/tests/pvpanic_event_check.py index 84f0f57a26e..ab68e09a11f 100644 --- a/qemu/tests/pvpanic_event_check.py +++ b/qemu/tests/pvpanic_event_check.py @@ -11,6 +11,8 @@ def run(test, params, env): 1) boot up guest with pvpanic device 2) setup crash_kexec_post_notifiers to 1 in VM and reboot VM 3) check kdump server in guest + check the 'ISA bridge' device + check the capability file locations combined 4) trigger a crash in guest 5) check the event @@ -29,6 +31,7 @@ def run(test, params, env): check_kexec_cmd = params["check_kexec_cmd"] expect_event = params["expect_event"] trigger_crash_cmd = params["trigger_crash_cmd"] + check_ISA_cmd = params["check_ISA_cmd"] error_context.context("Setup crash_kexec_post_notifiers=1 in guest", test.log.info) @@ -43,6 +46,18 @@ def run(test, params, env): if kdump_expect_status not in o: test.error("Kdump service status is not %s" % kdump_expect_status) + error_context.context("Check ISA Bridge in the guest", test.log.info) + o = session.cmd_output(check_ISA_cmd) + device_id = o.split()[0] + device_cmd = f"cat /sys/devices/pci0000:00/0000:{device_id}/QEMU0001:00/capability" + o = session.cmd_output(device_cmd) + if o.strip() == '1': + test.log.info("Got 1 since i440fx machine-type") + elif o.strip() == '3': + test.log.info("Got 3 since q35 machine-type") + else: + test.error("Please check the abnormal values") + error_context.context("Trigger a crash in guest and check qmp event", test.log.info) try: