Bug 1300454

Summary: virsh shutdown/reboot requests fail to work after the first guest reboot
Product: Red Hat Enterprise Linux 7 Reporter: Wei Huang (AMD) <wehuang>
Component: qemu-kvm-rhevAssignee: Wei Huang (AMD) <wehuang>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: drjones, huding, knoel, virt-maint, wehuang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-28 16:51:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1173755    

Description Wei Huang (AMD) 2016-01-20 21:22:39 UTC
This bug is related to guest VM shutdown/reboot support for recent GPIO-based powerdown feature.

Symptom:
The 1st shutdown/reboot always worked for a fresh VM. If VM has been rebooted, then shutdown/reboot requests will fail to trigger VM to act (no reaction). In other words,
 * fresh VM -> shutdown (worked) -> fresh VM -> shutdown/reboot (worked)
 * fresh VM -> reboot (worked) -> stale VM -> shutdown/reboot (failed)

How to reproduce:
1. Download QEMU source from at http://git.engineering.redhat.com/git/users/wehuang/rhel7-qemu-kvm.git/log/?h=wei/qemu-rhev-upstream25-backport
2. Use a guest VM with RHELSA 7.3 kernel (4.4+), which supports GPIO fully. Boots this kernel.
3. In virsh, send shutdown/reboot requests to VM using "shutdown" or "reboot" commands.

Comment 2 Wei Huang (AMD) 2016-01-25 20:56:30 UTC
It looks like the problem was caused by GPIO IRQ triggering mechanism. The following patch solves the problem. A patch will be prepared for the upstream.

-Wei


--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -550,7 +550,9 @@ static DeviceState *pl061_dev;
 static void virt_powerdown_req(Notifier *n, void *opaque)
 {
     /* use gpio Pin 3 for power button event */
+    qemu_set_irq(qdev_get_gpio_in(pl061_dev, 3), 0);
     qemu_set_irq(qdev_get_gpio_in(pl061_dev, 3), 1);

Comment 3 Andrew Jones 2016-04-26 13:24:13 UTC
This is a high priority, as it fixes basic functionality. Do we have upstream patches yet?

Comment 4 Wei Huang (AMD) 2016-04-27 15:36:01 UTC
I will test them today with the latest composes (QEMU). Will update the status after complete.

Comment 5 Wei Huang (AMD) 2016-04-28 16:51:49 UTC
Here is my testing results:

SETUP
* Fresh RHELSA installation on Seattle
* Install the latest QEMU compose: qemu-kvm-rhev-2.6.0-0.el7.rc3.aarch64
* Install a new guest VM from 7.2 ISO (RHELSA 7.3 ISO isn't available yet) using virt-install (name it: VM KERNEL 1)
* Download the latest RHELSA 7.3 kernel (kernel-4.5.0-0.34.el7) inside the same VM. Compile and install the kernel-4.5.0-0.34.el7 kernel in guest VM (name it: VM KERNEL 2)

TESTING RESULTS
1) VM KERNEL 1
Shutdown/reboot (in virsh) doesn't work. This is because AMBA fix was not included in RHELSA 7.2 tree. See https://lkml.org/lkml/2015/9/30/392 for details.
2) VM KERNEL 2
Shutdown/reboot (in virsh) work. The issue described in this BZ wasn't observed anymore: no matter how early I issued shutdown/reboot command, guest VM was always able to comply.

CONCLUSION
shutdown/reboot should work properly under ACPI mode for RHELSA 7.3 kernel + QEMU 2.6. We can close this BZ.