Bug 14517

Summary: qemux86 and qemuarm does not shutdown within timeout(120)
Product: [QA/Testing] Functional (self) Testing Reporter: Alexandre Belloni <alexandre.belloni>
Component: oe-selftestAssignee: Sakib Sajal <sakib.sajal>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: Medium CC: alexandre.belloni, chee.yang.lee, luca.ceresoli, randy.macleod, sakib.sajal, thomas.perrot
Version: 3.4   
Target Milestone: 4.2   
Hardware: x86   
OS: Multiple   
Whiteboard: AB-INT
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
qemu_boot_log.20210918151557 none

Description Alexandre Belloni 2021-08-18 21:56:06 UTC
2021-08-13 06:16:49,123 - oe-selftest - INFO - ======================================================================
2021-08-13 06:16:49,124 - oe-selftest - INFO - FAIL: runqemu.QemuTest.test_qemu_can_shutdown (subunit.RemotedTestCase)
2021-08-13 06:16:49,124 - oe-selftest - INFO - ----------------------------------------------------------------------
2021-08-13 06:16:49,124 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/qemux86/build/meta/lib/oeqa/selftest/cases/runqemu.py", line 190, in test_qemu_can_shutdown
    self.assertTrue(qemu_shutdown_succeeded, 'Failed: %s does not shutdown within timeout(%s)' % (self.machine, shutdown_timeout))
  File "/usr/lib/python3.6/unittest/case.py", line 682, in assertTrue
    raise self.failureException(msg)
AssertionError: False is not true : Failed: qemux86 does not shutdown within timeout(120)

https://autobuilder.yoctoproject.org/typhoon/#/builders/59/builds/3803/steps/19/logs/stdio
qemux86 ubuntu1804-ty-1
Comment 1 Randy MacLeod 2021-08-19 14:52:59 UTC
If it happens again, check the dmesg output of the qemu image.
Comment 2 Alexandre Belloni 2021-09-18 20:56:57 UTC
https://autobuilder.yoctoproject.org/typhoon/#/builders/59/builds/3988/steps/18/logs/stdio
qemux86 ubuntu1804-ty-1

This did take a long time to boot:

Waiting at most 1000 seconds for login banner (09/18/21 15:16:21)
Connection from 127.0.0.1:38980
Reached login banner in 998.8470027446747 seconds (09/18/21 15:33:00)

I'm attaching the qemu boot log which show how slow this was and there were several rcu stalls.
Comment 3 Alexandre Belloni 2021-09-18 20:58:54 UTC
Created attachment 4826 [details]
qemu_boot_log.20210918151557
Comment 4 Thomas Perrot 2021-10-14 12:30:17 UTC
The same issue occurs with qemuarm:

https://autobuilder.yoctoproject.org/typhoon/#/builders/53/builds/4172/steps/18/logs/stdio

qemuarm ubuntu1804-ty-3
Comment 5 Thomas Perrot 2021-10-14 12:38:41 UTC
The bug 14522 is a duplicate.
Comment 7 Alexandre Belloni 2021-12-09 14:26:03 UTC
https://autobuilder.yoctoproject.org/typhoon/#/builders/59/builds/4421/steps/19/logs/stdio

qemux86 ubuntu1804-ty-3
Comment 8 Chee Yang 2022-03-02 05:42:35 UTC
qemux86 ubuntu1804-ty-3 Non-SSD 
https://autobuilder.yoctoproject.org/typhoon/#/builders/59/builds/4763/steps/19/logs/stdio
Comment 9 Randy MacLeod 2022-06-02 15:02:09 UTC
Hasn't happened since early March so closing.
Comment 10 Sakib Sajal 2022-07-12 20:38:06 UTC
Issue still occurs on oe-core/master, issue does not occur with older version of bios:
wget -O bios.bin https://github.com/qemu/qemu/blob/stable-5.0/pc-bios/bios.bin?raw=true

Then pass to runqemu

qemuparams='-bios bios.bin'

Testing newer version of bios to see where the regression was introduced.

seabios repo: https://github.com/coreboot/seabios.git


I have identified the offending patch that causes qemu to hang on reboot:

commit 2e3de6253422112ae43e608661ba94ea6b345694 (HEAD)
Author: Gerd Hoffmann <kraxel@redhat.com>
Date:   Mon May 25 11:06:27 2020 +0200
    pci: fix mmconfig support
    
    The MODESEGMENT condition is backwards, with the effect that
    mmconfig mode is not used to configure pci bars during POST.
    
    Oops.  Fix it.
    
    The only real mode pci config space access seems to come from the
    ipxe option rom initialiation.  Which happens to work via mmconfig
    because it runs in big real mode so this went unnoticed ...
    
    Fixes: 6a3b59ab9c7d ("pci: add mmconfig support")
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Which in turn fixes commit 6a3b59ab9c7d:

 

commit 6a3b59ab9c7dc00331c21346052dfa6a0df45aa3
Author: Gerd Hoffmann <kraxel@redhat.com>
Date:   Mon Mar 23 15:59:11 2020 +0100
    pci: add mmconfig support
    
    Add support for pci config space access via mmconfig bar.  Enable for
    qemu q35 chipset.  Main advantage is that we need only one instead of
    two io operations per config space access, which translates to one
    instead of two vmexits for virtualization.
    
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Message-id: 20200323145911.22319-3-kraxel@redhat.com
Comment 11 Randy MacLeod 2022-07-14 15:00:00 UTC
The reproducer that Sakib is working on is WITHOUT KVM. 
With KVM works fine and it is the default for Yocto autobuilder runs. -- Yocto Bug Review.
Comment 12 Randy MacLeod 2022-10-27 15:04:47 UTC
Likely working now with the SSDs.
Comment 13 Luca Ceresoli 2023-02-10 21:15:12 UTC
Happened again :(

https://autobuilder.yoctoproject.org/typhoon/#/builders/63/builds/6610/steps/19/logs/stdio

qemuppc on opensuse154-ty-3
Comment 14 Randy MacLeod 2023-02-16 15:36:58 UTC
The qemuppc issue is being tracked in: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14522