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 1425151 - qemu zeroes the first byte of NVDIMM on initialization
Summary: qemu zeroes the first byte of NVDIMM on initialization
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.4
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Stefan Hajnoczi
QA Contact: Yumei Huang
URL:
Whiteboard:
Depends On:
Blocks: 1270403
TreeView+ depends on / blocked
 
Reported: 2017-02-20 16:36 UTC by Michal Privoznik
Modified: 2017-08-02 03:37 UTC (History)
9 users (show)

Fixed In Version: qemu-kvm-rhev-2.9.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 23:44:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:2392 0 normal SHIPPED_LIVE Important: qemu-kvm-rhev security, bug fix, and enhancement update 2017-08-01 20:04:36 UTC

Description Michal Privoznik 2017-02-20 16:36:35 UTC
Description of problem:
When developing patches for libvirt I've noticed that qemu zeroes the very first byte of file associated with NVDIMM. This happens only if -mem-prealloc is specified (or prealloc=yes is set for the corresponding memory-backend-file object).

Version-Release number of selected component (if applicable):
qemu-kvm-common-rhev-2.6.0-28.el7_3.6.x86_64
qemu-kvm-rhev-2.6.0-28.el7_3.6.x86_64


How reproducible:
100%

Steps to Reproduce:
1. echo -n 'A' > /tmp/nvdimm.dat

2. truncate -s 10M /tmp/nvdimm.dat 

3. hexdump -C /tmp/nvdimm.dat 
00000000  41 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |A...............|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00a00000

4. /usr/libexec/qemu-kvm -mem-prealloc -machine pc,nvdimm -m 1024,slots=4,maxmem=8G -cpu host -object memory-backend-file,id=mem1,share=on,mem-path=/tmp/nvdimm.dat,size=$((10 * 1024 * 1024)) -device nvdimm,id=nvdimm1,memdev=mem1
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
qemu-kvm: CPU model 'host' requires KVM

5. hexdump -C /tmp/nvdimm.dat 
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00a00000

Actual results:


Expected results:


Additional info:
From my IRC discussion with qemu developers (danpb and stefanha) it looks like the problem is occurring in os_mem_prealloc() which writes one byte of a value zero. Ideally, the fix would not increase wear level of NVDIMMs.

Comment 1 Stefan Hajnoczi 2017-03-24 11:27:26 UTC
Fixed by the following upstream patch in QEMU 2.9.0-rc1:

commit 9dc44aa5829eb3131a01378a738dee28a382bbc1
Author: Daniel P. Berrange <berrange>
Date:   Fri Mar 3 11:32:55 2017 +0000

    os: don't corrupt pre-existing memory-backend data with prealloc

Comment 2 Yumei Huang 2017-04-24 09:19:03 UTC
Reproduce:
qemu-kvm-rhev-2.8.0-6.el7
kernel-3.10.0-655.el7.x86_64

Steps:

1. # echo -n 'A' > /tmp/nvdimm.dat

2. # truncate -s 10M /tmp/nvdimm.dat 

3. # hexdump -C /tmp/nvdimm.dat 
00000000  41 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |A...............|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00a00000

4. # /usr/libexec/qemu-kvm -m 4G,slots=40,maxmem=40G \

-drive file=rhel74.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none  -device virtio-blk-pci,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1  \

-netdev tap,id=idinWyYp -device virtio-net-pci,mac=42:ce:a9:d2:4d:d7,id=idlbq7eA,netdev=idinWyYp \

-vnc :0 -monitor stdio -machine pc,nvdimm  \

-object memory-backend-file,id=mem1,share=on,mem-path=/tmp/nvdimm.dat,size=$((10 * 1024 * 1024)) -device nvdimm,id=nvdimm1,memdev=mem1 \

 -mem-prealloc

5. # hexdump -C /tmp/nvdimm.dat 
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00a00000


Verify:
qemu-kvm-rhev-2.9.0-1.el7
kernel-3.10.0-655.el7.x86_64

With same steps as above, after step5, 

# hexdump -C /tmp/nvdimm.dat 
00000000  41 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |A...............|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00a00000

The first byte of the file is not changed. So the bug is fixed.

Comment 4 errata-xmlrpc 2017-08-01 23:44:45 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, 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-2017:2392

Comment 5 errata-xmlrpc 2017-08-02 01:22:26 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, 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-2017:2392

Comment 6 errata-xmlrpc 2017-08-02 02:14:23 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, 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-2017:2392

Comment 7 errata-xmlrpc 2017-08-02 02:55:11 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, 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-2017:2392

Comment 8 errata-xmlrpc 2017-08-02 03:19:49 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, 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-2017:2392

Comment 9 errata-xmlrpc 2017-08-02 03:37:31 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, 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-2017:2392


Note You need to log in before you can comment on or make changes to this bug.