[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH v2 20/20] qemu: ensure that memory 'discard' is used if specified in XML



On Fri, Aug 10, 2018 at 09:26:27AM +0200, Michal Privoznik wrote:
> On 08/09/2018 02:38 PM, Pavel Hrdina wrote:
> > Signed-off-by: Pavel Hrdina <phrdina redhat com>
> > ---
> >  src/qemu/qemu_command.c                        |  4 +++-
> >  .../pages-discard-hugepages.args               | 11 +++++++----
> >  tests/qemuxml2argvdata/pages-discard.args      | 18 ++++++++++++++----
> >  3 files changed, 24 insertions(+), 9 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> > index dbeb3a54f6..a7859feae6 100644
> > --- a/src/qemu/qemu_command.c
> > +++ b/src/qemu/qemu_command.c
> > @@ -3147,6 +3147,7 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
> >          return -1;
> >  
> >      if (useHugepage || mem->nvdimmPath || memAccess ||
> > +        discard == VIR_TRISTATE_BOOL_YES ||
> >          def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) {
> >  
> >          if (useHugepage) {
> > @@ -3228,7 +3229,8 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
> >      if (!needHugepage && !mem->sourceNodes && !nodeSpecified &&
> >          !mem->nvdimmPath &&
> >          memAccess == VIR_DOMAIN_MEMORY_ACCESS_DEFAULT &&
> > -        def->mem.source != VIR_DOMAIN_MEMORY_SOURCE_FILE && !force) {
> > +        def->mem.source != VIR_DOMAIN_MEMORY_SOURCE_FILE && !force &&
> > +        discard != VIR_TRISTATE_BOOL_YES) {
> >          /* report back that using the new backend is not necessary
> >           * to achieve the desired configuration */
> >          ret = 1;
> > diff --git a/tests/qemuxml2argvdata/pages-discard-hugepages.args b/tests/qemuxml2argvdata/pages-discard-hugepages.args
> > index 2dfacefe4a..d859480c26 100644
> > --- a/tests/qemuxml2argvdata/pages-discard-hugepages.args
> > +++ b/tests/qemuxml2argvdata/pages-discard-hugepages.args
> > @@ -10,10 +10,13 @@ QEMU_AUDIO_DRV=none \
> >  -machine pc,accel=tcg,usb=off,dump-guest-core=off \
> >  -m 1024 \
> >  -smp 2,sockets=2,cores=1,threads=1 \
> > --mem-prealloc \
> > --mem-path /dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu \
> > --numa node,nodeid=0,cpus=0,mem=256 \
> > --numa node,nodeid=1,cpus=1,mem=768 \
> > +-object memory-backend-file,id=ram-node0,prealloc=yes,\
> > +mem-path=/dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu,size=268435456 \
> > +-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
> > +-object memory-backend-file,id=ram-node1,prealloc=yes,\
> > +mem-path=/dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu,\
> > +discard-data=yes,size=805306368 \
> > +-numa node,nodeid=1,cpus=1,memdev=ram-node1 \
> 
> This will break migration. But at the same time, it's very unlikely that
> anybody is using discard without hugepages.

So there is different issue, with this patch guest without any hugepages
will fail to start as the memory file is generated in
/var/lib/libvirt/qemu/ram/libvirt/ and QEMU exits with:

memory.c:2053: memory_region_get_ram_ptr: Assertion `mr->ram_block' failed.

I'm dropping this patch :/.

Pavel

> 
> Michal
> 
> --
> libvir-list mailing list
> libvir-list redhat com
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]