Skip to content

Commit

Permalink
dump: add panic test when reading pvpanic device capabilities
Browse files Browse the repository at this point in the history
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 <wji@redhat.com>
  • Loading branch information
heywji committed Feb 27, 2024
1 parent f4b0f21 commit 3df5811
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions qemu/tests/cfg/pvpanic_event_check.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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'"
15 changes: 15 additions & 0 deletions qemu/tests/pvpanic_event_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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:
Expand Down

0 comments on commit 3df5811

Please sign in to comment.