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:
Assigned to Amnon for initial triage per bz process and age of bug created or assigned to virt-maint without triage.
BTW, if set unarmed=on, guest can boot up without error.
Bulk update: Move RHEL-AV bugs to RHEL9. If necessary to resolve in RHEL8, then clone to the current RHEL8 release.
Reproduced with qemu-kvm-6.1.0-1.el9.
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
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...
It is merged upstream now. Updating status.
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
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.
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