Bug 1629720 - [Intel 7.6 BUG][Crystal Ridge] pc_dimm_get_free_addr: assertion failed: (QEMU_ALIGN_UP(address_space_start, align) == address_space_start)
Summary: [Intel 7.6 BUG][Crystal Ridge] pc_dimm_get_free_addr: assertion failed: (QEMU...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.6
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: David Hildenbrand
QA Contact: Yumei Huang
URL:
Whiteboard:
Depends On:
Blocks: 1649160 1630116 1651787
TreeView+ depends on / blocked
 
Reported: 2018-09-17 12:05 UTC by Yumei Huang
Modified: 2019-08-22 09:19 UTC (History)
10 users (show)

Fixed In Version: qemu-kvm-rhev-2.12.0-19.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1630116 (view as bug list)
Environment:
Last Closed: 2019-08-22 09:18:53 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:2553 None None None 2019-08-22 09:19:46 UTC

Description Yumei Huang 2018-09-17 12:05:02 UTC
Description of problem:
Boot guest with nvdimm device, set align>=2G, qemu core dumped.

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.12.0-16.el7
kernel-3.10.0-948.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. Boot guest with nvdimm device, set align=2G

#/usr/libexec/qemu-kvm -m 4G,slots=20,maxmem=50G -M pc,nvdimm -object memory-backend-file,id=mem1,size=2G,mem-path=/tmp/nvdimm1,share,align=2G -device nvdimm,memdev=mem1,id=nv1


Actual results:
ERROR:hw/mem/pc-dimm.c:301:pc_dimm_get_free_addr: assertion failed: (QEMU_ALIGN_UP(address_space_start, align) == address_space_start)
Aborted (core dumped)


Expected results:
No core dumped.

Additional info:

Comment 2 Yumei Huang 2018-09-17 12:16:55 UTC
It is introduced by commit '9837684316 hostmem-file: add "align" option'.

Comment 4 Ademar Reis 2018-09-17 16:40:10 UTC
Amnon: can you clarify how customers are affected by this problem? In the meanwhile, I'm lowering the severity and deferring it to 7.7 + 7.6.z, because I don't think this should block RHEL-7.6.

Below is the commit which introduced it:

commit 983768431676f9ab8599a0b4813e1ca17af70838
Author: Haozhong Zhang <haozhong.zhang@intel.com>
Date:   Mon Dec 11 15:28:04 2017 +0800

    hostmem-file: add "align" option
    
    When mmap(2) the backend files, QEMU uses the host page size
    (getpagesize(2)) by default as the alignment of mapping address.
    However, some backends may require alignments different than the page
    size. For example, mmap a device DAX (e.g., /dev/dax0.0) on Linux
    kernel 4.13 to an address, which is 4K-aligned but not 2M-aligned,
    fails with a kernel message like
    
    [617494.969768] dax dax0.0: qemu-system-x86: dax_mmap: fail, unaligned vma (0x7fa37c579000 - 0x7fa43c579000, 0x1fffff)
    
    Because there is no common approach to get such alignment requirement,
    we add the 'align' option to 'memory-backend-file', so that users or
    management utils, which have enough knowledge about the backend, can
    specify a proper alignment via this option.
    
    Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
    Message-Id: <20171211072806.2812-2-haozhong.zhang@intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    [ehabkost: fixed typo, fixed error_setg() format string]
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Comment 5 pagupta 2018-09-19 10:01:47 UTC
Hello Yumei,

align=2G,4g is not supported value for x86. This check is to avoid guest physical memory fragmentation. 
The assert is being changed in upstream[2] with a check which does not cause qemu to crash. It avoids Qemu from starting up with a message[1]. This change is part of memory device series which is committed in upstream qemu-kvm-3.0 onwards.

Thanks,
Pankaj

------------
[1] (qemu) qemu-system-x86_64: -device nvdimm,memdev=mem1,id=nv1: the alignment (080000000) is not supported

commit 4d8938a05db15dea2c86c4ab9c5f872f160d2188
Author: David Hildenbrand <david@redhat.com>
Date:   Thu Jun 7 17:47:04 2018 +0200

    memory-device: turn alignment assert into check
    
    The start of the address space indicates which maximum alignment is
    supported by our machine (e.g. ppc, x86 1GB). This is helpful to
    catch fragmenting guest physical memory in strange fashions.
    
    Right now we can crash QEMU by e.g. (there might be easier examples)
    
    qemu-system-x86_64 -m 256M,maxmem=20G,slots=2 \
     -object memory-backend-file,id=mem0,size=8192M,mem-path=/dev/zero,align=8192M \
     -device pc-dimm,id=dimm1,memdev=mem0
    
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Message-Id: <20180607154705.6316-2-david@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Igor Mammedov <imammedo@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Comment 6 Yumei Huang 2018-09-19 10:52:12 UTC
(In reply to pagupta from comment #5)
> Hello Yumei,
> 
> align=2G,4g is not supported value for x86. This check is to avoid guest
> physical memory fragmentation. 
> The assert is being changed in upstream[2] with a check which does not cause
> qemu to crash. It avoids Qemu from starting up with a message[1]. This
> change is part of memory device series which is committed in upstream
> qemu-kvm-3.0 onwards.

Thanks for helping check in upstream. So the maximum value for align is 1G, and it works for both nvdimm and pc-dimm. 

> 
> Thanks,
> Pankaj
> 
> ------------
> [1] (qemu) qemu-system-x86_64: -device nvdimm,memdev=mem1,id=nv1: the
> alignment (080000000) is not supported
> 
> commit 4d8938a05db15dea2c86c4ab9c5f872f160d2188
> Author: David Hildenbrand <david@redhat.com>
> Date:   Thu Jun 7 17:47:04 2018 +0200
> 
>     memory-device: turn alignment assert into check
>     
>     The start of the address space indicates which maximum alignment is
>     supported by our machine (e.g. ppc, x86 1GB). This is helpful to
>     catch fragmenting guest physical memory in strange fashions.
>     
>     Right now we can crash QEMU by e.g. (there might be easier examples)
>     
>     qemu-system-x86_64 -m 256M,maxmem=20G,slots=2 \
>      -object
> memory-backend-file,id=mem0,size=8192M,mem-path=/dev/zero,align=8192M \
>      -device pc-dimm,id=dimm1,memdev=mem0
>     
>     Signed-off-by: David Hildenbrand <david@redhat.com>
>     Message-Id: <20180607154705.6316-2-david@redhat.com>
>     Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>     Reviewed-by: Igor Mammedov <imammedo@redhat.com>
>     Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Comment 7 Miroslav Rezanina 2018-11-21 15:14:28 UTC
Fix included in qemu-kvm-rhev-2.12.0-19.el7

Comment 8 Yumei Huang 2018-11-29 07:49:04 UTC
Verify:
qemu-kvm-rhev-2.12.0-19.el7

Ran some negative tests for align option, gets corresponding error message, and no core dumped.

# /usr/libexec/qemu-kvm -m 4G,slots=20,maxmem=50G -M pc,nvdimm -object memory-backend-file,id=mem1,size=2G,mem-path=/tmp/nvdimm1,share,align=2G -device nvdimm,memdev=mem1,id=nv1
qemu-kvm: -device nvdimm,memdev=mem1,id=nv1: the alignment (0x80000000) is not supported

# /usr/libexec/qemu-kvm -m 4G,slots=20,maxmem=50G -M pc,nvdimm -object memory-backend-file,id=mem1,size=2G,mem-path=/tmp/nvdimm1,share,align=1.5G -device nvdimm,memdev=mem1,id=nv1
qemu-kvm: -object memory-backend-file,id=mem1,size=2G,mem-path=/tmp/nvdimm1,share,align=1.5G: alignment 0x60000000 must be a power of two

# /usr/libexec/qemu-kvm -m 4G,slots=20,maxmem=50G -M pc,nvdimm -object memory-backend-file,id=mem1,size=2G,mem-path=/tmp/nvdimm1,share,align=8 -device nvdimm,memdev=mem1,id=nv1
qemu-kvm: -object memory-backend-file,id=mem1,size=2G,mem-path=/tmp/nvdimm1,share,align=8: alignment 0x8 must be multiples of page size 0x1000

# /usr/libexec/qemu-kvm -m 4G,slots=20,maxmem=50G -M pc,nvdimm -object memory-backend-file,id=mem1,size=2G,mem-path=/tmp/nvdimm1,share,align=-1 -device nvdimm,memdev=mem1,id=nv1
qemu-kvm: -object memory-backend-file,id=mem1,size=2G,mem-path=/tmp/nvdimm1,share,align=-1: Parameter 'align' expects a size value

Comment 10 errata-xmlrpc 2019-08-22 09:18:53 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-2019:2553


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