Bug 2112303

Summary: virtio-blk: Can't boot fresh installation from used 512 cluster_size image under certain conditions
Product: Red Hat Enterprise Linux 9 Reporter: bfu <bfu>
Component: qemu-kvmAssignee: Thomas Huth <thuth>
qemu-kvm sub component: virtio-blk,scsi QA Contact: bfu <bfu>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: high CC: cohuck, coli, dgilbert, hannsj_uhl, jinzhao, juzhang, knoel, lijin, pbonzini, ribarry, smitterl, stefanha, thuth, vgoyal, virt-maint, virt-qe-z, yiwei
Version: 9.1Keywords: Regression, Triaged
Target Milestone: rc   
Target Release: 9.1   
Hardware: s390x   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-7.0.0-11.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 09:54:42 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:

Description bfu 2022-07-29 09:53:16 UTC
Description of problem:
When using an image with 512k cluster_size, and installing guest with physical size=4096&logical size=512, guest could not reboot after installation

Version-Release number of selected component (if applicable):
kernel version: 5.14.0-130.el9.s390x
qemu version: qemu-kvm-7.0.0-9.el9.s390x
libvirt version: libvirt-8.5.0-1.el9.s390x

How reproducible:
100%

Steps to Reproduce:
1. create an image file that has a cluster size of 512k
qemu-img create -f qcow2 test.qcow2 20G

2. install guest into the created image file with
physical_block_size = 4096, logical_block_size = 512

3. reboot guest after installation finished

Actual results:
guest cannot reboot
2022-07-28 07:30:29: Powering off.
2022-07-28 07:32:40: (Process terminated with status 0)
2022-07-28 07:32:44: LOADPARM=[        ]
2022-07-28 07:32:44: Using virtio-blk.
2022-07-28 07:32:44: Using SCSI scheme.
2022-07-28 07:32:44: 
2022-07-28 07:32:44: ! No zIPL magic in PT !
2022-07-28 07:45:24: (Process terminated with status 0)

Expected results:
guest could reboot successfully

Additional info:

Comment 2 Thomas Huth 2022-08-04 16:02:41 UTC
Hi Boqiao, one question: Is this really a regression (since the "Regression" keyword has been set), or did this simply never work?

Comment 4 Thomas Huth 2022-08-05 10:11:43 UTC
Ah, I think I now understood what is going on here. When fixing BZ 2098076 by removing the "hack" in the firmware that was enforcing 512 byte sectors in some cases (and thus preventing the disk with the 4096 there, see https://gitlab.com/qemu-project/qemu/-/commit/5447de2619050a0a4d ), this uncovered another problem in the s390-ccw bios: It tries to access the sectors with the physical block size numbers, not with the logical ones, which is nonsense. For this specific case here, it used to work in the past since the "hack" enforced 512 byte sectors again, but since the hack has been removed, it is failing now.

Anyway, the right thing to do is to simply switch to use the logical block sizes in the s390-ccw bios. I suggested a patch here:

https://lore.kernel.org/qemu-devel/20220805094214.285223-1-thuth@redhat.com/

Comment 7 bfu 2022-08-11 17:13:58 UTC
Test result:
JOB ID     : 2a09f9e7544bcebd320513b1c90d3a83c9ceda7e
JOB LOG    : /root/avocado/job-results/job-2022-08-11T11.42-2a09f9e/job.log
 (1/2) Host_RHEL.m9.u1.nographic.qcow2.virtio_blk.up.virtio_net.Guest.RHEL.9.1.0.s390x.io-github-autotest-qemu.unattended_install.cdrom.extra_cdrom_ks.default_install.aio_threads.s390-virtio: STARTED
 (1/2) Host_RHEL.m9.u1.nographic.qcow2.virtio_blk.up.virtio_net.Guest.RHEL.9.1.0.s390x.io-github-autotest-qemu.unattended_install.cdrom.extra_cdrom_ks.default_install.aio_threads.s390-virtio: PASS (675.59 s)
 (2/2) Host_RHEL.m9.u1.nographic.qcow2.virtio_blk.up.virtio_net.Guest.RHEL.9.1.0.s390x.io-github-autotest-qemu.check_block_size.4096_512.extra_cdrom_ks.s390-virtio: STARTED
 (2/2) Host_RHEL.m9.u1.nographic.qcow2.virtio_blk.up.virtio_net.Guest.RHEL.9.1.0.s390x.io-github-autotest-qemu.check_block_size.4096_512.extra_cdrom_ks.s390-virtio: PASS (681.97 s)
RESULTS    : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML   : /root/avocado/job-results/job-2022-08-11T11.42-2a09f9e/results.html
JOB TIME   : 1360.84 s

As the test result, add verified: tested to this bz

Comment 11 bfu 2022-08-17 07:24:10 UTC
JOB ID     : 478e6bbf927de9529e0239298bb34053130be8bf
JOB LOG    : /root/avocado/job-results/job-2022-08-16T23.37-478e6bb/job.log
 (1/5) Host_RHEL.m9.u1.nographic.qcow2.virtio_blk.up.virtio_net.Guest.RHEL.9.1.0.s390x.io-github-autotest-qemu.unattended_install.cdrom.extra_cdrom_ks.default_install.aio_threads.s390-virtio: STARTED
 (1/5) Host_RHEL.m9.u1.nographic.qcow2.virtio_blk.up.virtio_net.Guest.RHEL.9.1.0.s390x.io-github-autotest-qemu.unattended_install.cdrom.extra_cdrom_ks.default_install.aio_threads.s390-virtio: PASS (552.67 s)
 (2/5) Host_RHEL.m9.u1.nographic.qcow2.virtio_blk.up.virtio_net.Guest.RHEL.9.1.0.s390x.io-github-autotest-qemu.check_block_size.4096_4096.base.s390-virtio: STARTED
 (2/5) Host_RHEL.m9.u1.nographic.qcow2.virtio_blk.up.virtio_net.Guest.RHEL.9.1.0.s390x.io-github-autotest-qemu.check_block_size.4096_4096.base.s390-virtio: PASS (27.75 s)
 (3/5) Host_RHEL.m9.u1.nographic.qcow2.virtio_blk.up.virtio_net.Guest.RHEL.9.1.0.s390x.io-github-autotest-qemu.check_block_size.4096_512.extra_cdrom_ks.s390-virtio: STARTED
 (3/5) Host_RHEL.m9.u1.nographic.qcow2.virtio_blk.up.virtio_net.Guest.RHEL.9.1.0.s390x.io-github-autotest-qemu.check_block_size.4096_512.extra_cdrom_ks.s390-virtio: PASS (587.67 s)
 (4/5) Host_RHEL.m9.u1.nographic.qcow2.virtio_blk.up.virtio_net.Guest.RHEL.9.1.0.s390x.io-github-autotest-qemu.check_block_size.512_512.extra_cdrom_ks.s390-virtio: STARTED
 (4/5) Host_RHEL.m9.u1.nographic.qcow2.virtio_blk.up.virtio_net.Guest.RHEL.9.1.0.s390x.io-github-autotest-qemu.check_block_size.512_512.extra_cdrom_ks.s390-virtio: PASS (586.49 s)
 (5/5) Host_RHEL.m9.u1.nographic.qcow2.virtio_blk.up.virtio_net.Guest.RHEL.9.1.0.s390x.io-github-autotest-qemu.check_block_size.4096_4096_cluster_install.extra_cdrom_ks.s390-virtio: STARTED
 (5/5) Host_RHEL.m9.u1.nographic.qcow2.virtio_blk.up.virtio_net.Guest.RHEL.9.1.0.s390x.io-github-autotest-qemu.check_block_size.4096_4096_cluster_install.extra_cdrom_ks.s390-virtio: PASS (591.47 s)
RESULTS    : PASS 5 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML   : /root/avocado/job-results/job-2022-08-16T23.37-478e6bb/results.html
JOB TIME   : 2354.38 s

As the test result, set this bz to verified

Comment 13 errata-xmlrpc 2022-11-15 09:54:42 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: qemu-kvm 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-2022:7967