Bug 1961326

Summary: [aarch64] [libvirt] support pvpanic-pci instantiation for aarch64
Product: Red Hat Enterprise Linux 9 Reporter: Eric Auger <eric.auger>
Component: libvirtAssignee: khanicov
libvirt sub component: General QA Contact: Hu Shuai (Fujitsu) <hshuai>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: abologna, dzheng, eauger, fqi, gshan, haizhao, hshuai, jdenemar, jsuchane, lijin, lmen, mzhan, qzhang, virt-maint, weizhan, yalzhang, yihyu, zhenyzha
Version: 9.0Keywords: Triaged
Target Milestone: beta   
Target Release: 9.1   
Hardware: aarch64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-9.1.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-07 08:30:47 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version: 9.1.0
Embargoed:
Bug Depends On: 1747467, 1961178, 1977192    
Bug Blocks: 1924294    

Description Eric Auger 2021-05-17 17:22:21 UTC
x86 uses the the pvpanic ISA device whereas on ARM the pvpanic-pci device is used.

libvirt must be enhanced to support its instantiation.

Comment 8 yalzhang@redhat.com 2022-10-19 03:40:37 UTC
Hi Eric, Could you please help evaluate if this feature is still needed? If yes, we can extend the stale date to +6M. Or it will be closed as won't fix automatically. Thank you!

Comment 9 yalzhang@redhat.com 2022-10-20 03:29:27 UTC
extend the stale date as the priority for arm increased

Comment 10 Eric Auger 2022-10-20 16:17:27 UTC
Yes thank you, the feature is still needed.

Comment 11 Hu Shuai (Fujitsu) 2022-11-30 01:49:23 UTC
Hi, Andrea, is there any progress or plan for this new feature?

Comment 12 Andrea Bolognani 2022-12-02 17:59:05 UTC
(In reply to Hu Shuai (Fujitsu) from comment #11)
> Hi, Andrea, is there any progress or plan for this new feature?

Reassigning to Kristina, who will look into it in the coming weeks.

Comment 13 Eric Auger 2022-12-06 10:01:55 UTC
Hi Kristina, the qemu enablement was tracked by https://bugzilla.redhat.com/show_bug.cgi?id=1747467. There, you will be able to find the test setup we used. Compared to x86 integration the specificity is the pvpanic device is a pcie device and not an ISA one. So it needs to be integrated like other PCIe end-points (maybe the virtio-iommu-pci device laterly introduced can be used as an example? But better to ask Andrea)

Comment 14 khanicov 2023-02-20 16:38:05 UTC
v2 of patches posted upstream:

https://listman.redhat.com/archives/libvir-list/2023-February/238009.html

Comment 15 khanicov 2023-02-22 14:58:50 UTC
merged upstream as:

4bae0c8ae4 NEWS: Document new pvpanic-pci device
c98e49f82e docs: document panic device 'pvpanic-pci'
78744415fe tests: add case for pvpanic-pci without address
9f52df3a70 qemu: assign PCI address to device pvpanic-pci
f4367059d2 tests: add test cases for device pvpanic-pci
46ef87e10e conf: add panic model 'pvpanic'
741624a1a6 qemu: introduce QEMU_CAPS_DEVICE_PANIC_PCI

v9.0.0-247-g4bae0c8ae4

Comment 16 Hu Shuai (Fujitsu) 2023-02-23 07:57:36 UTC
Test with upstream libvirt.
```
# git describe
v9.1.0-rc1-1-g6af048339f
```
Env:
  kernel-5.14.0-268.el9.aarch64
  libvirt-9.1.0-1.el9.aarch64

1. The guest can be defined and started with device panic.
  1.1 Add panic device to the guest xml
```
# cat avocado-vt-vm1.xml | grep panic
    <panic model='pvpanic'/>
```
  1.2 Define && start the guest
```
# virsh define avocado-vt-vm1.xml
Domain 'avocado-vt-vm1' defined from avocado-vt-vm1.xml
# virsh start avocado-vt-vm1
Domain 'avocado-vt-vm1' started
```
  1.3 Check the panic device of running guest
```
# virsh dumpxml avocado-vt-vm1 | grep /panic -B2
    <panic model='pvpanic'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </panic>
```


2. The guest can be shut off when triggering the guest crash through 'echo c > /proc/sysrq-trigger'.
On guest:
```
# systemctl stop kdump
# echo 1 > /proc/sys/kernel/sysrq
# echo c > /proc/sysrq-trigger
```
On host:
```
# virsh domstate avocado-vt-vm1 --reason
shut off (crashed)
```
Log from /var/log/libvirt/qemu/avocado-vt-vm1.log
```
2023-02-23 07:47:37.216+0000: shutting down, reason=crashed
2023-02-23T07:47:37.220955Z qemu-kvm: terminating on signal 15 from pid 4590 (<unknown process>)
```

Comment 22 lijin 2023-05-23 11:26:47 UTC
Change status to verified based on above comment

Comment 24 errata-xmlrpc 2023-11-07 08:30:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: libvirt security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:6409