Bug 1257409

Summary: executing (qemu)system_powerdown causes the linux guest frozen
Product: Red Hat Enterprise Linux 7 Reporter: Xueqiang Wei <xuwei>
Component: qemu-kvmAssignee: Markus Armbruster <armbru>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: amit.shah, armbru, astepano, chayang, juzhang, knoel, marcandre.lureau, michen, pezhang, qzhang, rbalakri, virt-bugs, virt-maint, xfu, xuwei
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1246944 Environment:
Last Closed: 2016-07-25 06:11:02 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: 1246944    
Bug Blocks:    

Comment 1 Xueqiang Wei 2015-08-27 03:53:45 UTC
Version-Release number of selected component (if applicable):

Host:
kernel-3.10.0-306.0.1.el7.x86_64
qemu-kvm-1.5.3-101.el7

Guest:
kernel-3.10.0-309.el7.x86_64


BTW, also hit this issue with qmp command {"execute": "system_powerdown"}

Comment 3 Xueqiang Wei 2015-08-27 11:42:47 UTC
in guest
#runlevel
N 5

 
# init 3
then (qemu) system_powerdown, not hit this issue.

Comment 5 Andrei Stepanov 2016-05-31 18:40:13 UTC
Reproducible on:
kernel-3.10.0-418.el7.x86_64
qemu-kvm-1.5.3-112.el7.x86_64

Comment 6 Amit Shah 2016-07-22 08:19:47 UTC
As comment 3 shows, this is the guest trying to do a hibernate / suspend instead of a shutdown.

Using qemu commands for effecting shutdown isn't guaranteed to produce desired results, because the guest can (and, indeed, does) influence the action on such commands.

The safest way to shutdown a guest from the host is to issue commands via libvirt, which routes through the guest agent.

Perhaps QE can update the test cases to not use the qemu commands, since what the guest does on receiving those commands is not in our control, unless those commands are routed through the guest-agent.

Comment 7 Markus Armbruster 2016-07-22 08:58:28 UTC
system_powerdown triggers a System Control Interrupt in the guest.  The guest can react to it however it likes.  As long as qemu-kvm triggers an SCI, there is no qemu-kvm bug.

Closely related: bug 980692.  It was filed against qemu-kvm with the title "fail to poweroff guest when do system_powerdown in HMP monitor if did not login guest", and reassigned to gdm with the title changed to "gdm login screen in VMs: the ACPI power button should by default effect a shutdown".  The actual bug we fixed there was the guest's reaction to SCI while gdm is running.

To double-check it's the guest's decision not to shutdown, please

* confirm that shutdown works in run level 3, and

* retest run level 5 with a guest that has bug 980692 fixed.

Additionally:

* The expected result of tests involving system_powerdown depends on the guest.  Therefore, the test plan needs to spell out how to get the guest into a defined state that reliably produces the expected result.  Please confirm the test plan does that.

* Please confirm the test plan covers the preferred way to shut down guests, namely via libvirt commands to make the guest agent shut it down.

Comment 8 Xueqiang Wei 2016-07-25 05:48:03 UTC
(In reply to Markus Armbruster from comment #7)
> system_powerdown triggers a System Control Interrupt in the guest.  The
> guest can react to it however it likes.  As long as qemu-kvm triggers an
> SCI, there is no qemu-kvm bug.
> 
> Closely related: bug 980692.  It was filed against qemu-kvm with the title
> "fail to poweroff guest when do system_powerdown in HMP monitor if did not
> login guest", and reassigned to gdm with the title changed to "gdm login
> screen in VMs: the ACPI power button should by default effect a shutdown". 
> The actual bug we fixed there was the guest's reaction to SCI while gdm is
> running.
> 
> To double-check it's the guest's decision not to shutdown, please
> 
> * confirm that shutdown works in run level 3, and
> 
> * retest run level 5 with a guest that has bug 980692 fixed.
> 
> Additionally:
> 
> * The expected result of tests involving system_powerdown depends on the
> guest.  Therefore, the test plan needs to spell out how to get the guest
> into a defined state that reliably produces the expected result.  Please
> confirm the test plan does that.
> 
> * Please confirm the test plan covers the preferred way to shut down guests,
> namely via libvirt commands to make the guest agent shut it down.


Confirmed, shutdown works in run level 3, and retested bug 980692, it has fixed.
Will confirm with feature owner and update test plan. Thank you.

Comment 9 Markus Armbruster 2016-07-25 06:11:02 UTC
Your testing confirms that QEMU works as it should.  Closing NOTABUG.