Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1963845

Summary: QEMU quit if set nvdimm memory backend option readonly=on
Product: Red Hat Enterprise Linux 9 Reporter: Yumei Huang <yuhuang>
Component: qemu-kvmAssignee: Julia Suvorova <jusual>
qemu-kvm sub component: Devices QA Contact: Mario Casquero <mcasquer>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: chayang, dyuan, jinzhao, jusual, juzhang, lcong, mrezanin, virt-maint, yuhuang
Version: unspecifiedKeywords: Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-7.2.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:19:27 UTC Type: ---
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: 2135806    
Bug Blocks:    

Description Yumei Huang 2021-05-24 07:52:22 UTC
Description of problem:

Boot guest with nvdimm device, set memory backend option readonly=on, qemu quit with error, even when specify unarmed=off as it says. 

(qemu) qemu-kvm: -device nvdimm,id=dimm0,memdev=mem0,unarmed=off: 'unarmed' property must be off since memdev mem0 is read-only


Version-Release number of selected component (if applicable):
qemu-kvm-6.0.0-16.module+el8.5.0+10848+2dccc46d
kernel-4.18.0-304.5.el8.x86_64

How reproducible:
always

Steps to Reproduce:
1. Boot guest with nvdimm device, set memory backend option readonly=on

# /usr/libexec/qemu-kvm -m 4G,slots=8,maxmem=40G -M q35,nvdimm=on \
-object memory-backend-file,id=mem0,mem-path=/mnt/test.pmem,size=1G,readonly=on \
-device nvdimm,id=dimm0,memdev=mem0,unarmed=off \
-monitor stdio


Actual results:
QEMU quits with error message.
(qemu) qemu-kvm: -device nvdimm,id=dimm0,memdev=mem0,unarmed=off: 'unarmed' property must be off since memdev mem0 is read-only

Expected results:
Guest boot up without error.

Additional info:

Comment 1 John Ferlan 2021-06-04 12:25:41 UTC
Assigned to Amnon for initial triage per bz process and age of bug created or assigned to virt-maint without triage.

Comment 2 Yumei Huang 2021-06-18 07:36:11 UTC
BTW, if set unarmed=on, guest can boot up without error.

Comment 3 Eric Hadley 2021-09-08 16:57:34 UTC
Bulk update: Move RHEL-AV bugs to RHEL9. If necessary to resolve in RHEL8, then clone to the current RHEL8 release.

Comment 4 Yumei Huang 2021-09-09 01:42:35 UTC
Reproduced with qemu-kvm-6.1.0-1.el9.

Comment 5 Julia Suvorova 2022-05-31 15:14:22 UTC
AFAIU, the logic is correct, but the error message is not,
e.g. 'unarmed' property must be on when memdev is read-only.

I've posted a patch upstream to fix it:
  [PATCH] hw/mem/nvdimm: fix error message for 'unarmed' flag

Comment 7 John Ferlan 2022-10-26 15:49:39 UTC
I see the upstream patch from comment 5 posted as https://lists.nongnu.org/archive/html/qemu-devel/2022-05/msg06222.html with a follow-up Reviewed-by from Stefan Hajnoczi, but then the thread moves into June with Igor's https://lists.nongnu.org/archive/html/qemu-devel/2022-06/msg02474.html and a lot of subsequent discussion about transferring ownership of the component to David Hildenbrand.

Perhaps just a ping to David can help get this merged... Julia - I left a needinfo on you for this...

Comment 10 Julia Suvorova 2022-11-01 12:50:34 UTC
It is merged upstream now. Updating status.

Comment 13 Mario Casquero 2022-12-20 09:15:26 UTC
Manual test passed on:

dell-per750-24.lab.eng.pek2.redhat.com
qemu-kvm-7.2.0-1.el9.x86_64
5.14.0-212.el9.x86_64

With the following options in the qemu-kvm cmd line:

-object memory-backend-file,size=1G,mem-path=/tmp/nvdimm0,share=yes,readonly=on,id=mem-mem1 \
-device nvdimm,unarmed=off,id=dimm-mem1,memdev=mem-mem1 \

Now qemu quits with the appropiate error:

(qemu) qemu-kvm: -device nvdimm,unarmed=off,id=dimm-mem1,memdev=mem-mem1: 'unarmed' property must be 'on' since memdev mem-mem1 is read-only

If setting 'unarmed' to 'on' then qemu works as expected

Comment 16 Mario Casquero 2022-12-22 08:21:03 UTC
NVDIMM readonly + unarmed tests passed:

dell-per750-24.lab.eng.pek2.redhat.com
qemu-kvm-7.2.0-1.el9.x86_64
5.14.0-212.el9.x86_64

With the following options in the qemu-kvm cmd line:

-object memory-backend-file,size=1G,mem-path=/tmp/nvdimm0,share=yes,readonly=on,id=mem-mem1 \
-device nvdimm,unarmed=off,id=dimm-mem1,memdev=mem-mem1 \

Qemu quits with the appropiate error:

(qemu) qemu-kvm: -device nvdimm,unarmed=off,id=dimm-mem1,memdev=mem-mem1: 'unarmed' property must be 'on' since memdev mem-mem1 is read-only

If setting 'unarmed' to 'on' then qemu works as expected.

Comment 18 errata-xmlrpc 2023-05-09 07:19:27 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-2023:2162