Bug 1813852 - report proper error if 'memfd' is requested as memory backing but qemu doesn't support it
Summary: report proper error if 'memfd' is requested as memory backing but qemu doesn'...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.2
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: pre-dev-freeze
: 8.3
Assignee: Ján Tomko
QA Contact: Jing Qi
URL:
Whiteboard:
Depends On: 1738626
Blocks: 1740797
TreeView+ depends on / blocked
 
Reported: 2020-03-16 10:07 UTC by Jing Qi
Modified: 2020-11-17 17:48 UTC (History)
15 users (show)

Fixed In Version: libvirt-6.2.0-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1738626
Environment:
Last Closed: 2020-11-17 17:47:36 UTC
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)

Comment 2 Jing Qi 2020-03-16 10:18:23 UTC
Additional information, with libvirt-libs-6.0.0-9.virtcov.el8.x86_64 & qemu-kvm-core-4.2.0-10.module+el8.2.0+5740+c3dff59e.x86_64

1. Config a domain xml with memoryBacking as memfd set and there are numa cells in the domain.
   
<memoryBacking>
    <source type='memfd'/>
  </memoryBacking>
  <vcpu placement='static'>4</vcpu>
...
    <numa>
      <cell id='0' cpus='0-1' memory='512000' unit='KiB'/>
      <cell id='1' cpus='2-3' memory='512000' unit='KiB'/>
    </numa>

#virsh start avocado-vt
error: Failed to start domain avocado-vt
error: internal error: process exited while connecting to monitor: 2020-03-16T09:37:58.331359Z qemu-kvm: -object memory-backend-memfd,id=ram-node0,size=1073741824: invalid object type: memory-backend-memfd

2.  Config a domain xml with memoryBacking as memfd set and there is no numa cell.
the domain can be started successfully.

Comment 3 Peter Krempa 2020-03-16 12:01:54 UTC
Could you please run:

 grep -e '\(memfd\|packa\)' /var/cache/libvirt/qemu/capabilities/*

and paste the output here.

Then please delete everything in /var/cache/libvirt/qemu/capabilities/ and restart libvirtd and try again.

If it fails please paste the output of the above command again.

Comment 4 Jing Qi 2020-03-17 00:20:01 UTC
Here is the result as you request, please have a look.

# grep -e '\(memfd\|packa\)' /var/cache/libvirt/qemu/capabilities/*
  <package>qemu-kvm-4.2.0-10.module+el8.2.0+5740+c3dff59e</package>

# rm -rf /var/cache/libvirt/qemu/capabilities/*

# systemctl restart libvirtd

# grep -e '\(memfd\|packa\)' /var/cache/libvirt/qemu/capabilities/*
  <package>qemu-kvm-4.2.0-10.module+el8.2.0+5740+c3dff59e</package>

Comment 5 Peter Krempa 2020-03-17 07:39:33 UTC
Ok, so this boils down to validation not being done on the input definition as the capability is not present but we'll attempt to start the VM.

Comment 6 Ján Tomko 2020-03-17 09:05:24 UTC
Case #1 was fixed upstream by:
commit 8400b6c1983dd1e4504fe19d3421fff0e5866091
Author:     Ján Tomko <jtomko@redhat.com>
CommitDate: 2020-02-24 13:46:51 +0100

    qemu: use correct backendType when checking memfd capability
    
    The backend name is memory-backend-memfd but we've been checking
    for memory-backend-memory.
    
    Reported by GCC on rawhide:
    ../../../src/internal.h:75:22: error: 'strcmp' of a string of length 21 and
    an array of size 21 evaluates to nonzero [-Werror=string-compare]
    ../../../src/qemu/qemu_command.c:3525:20: note: in expansion of macro 'STREQ'
     3525 |         } else if (STREQ(backendType, "memory-backend-memory") &&
          |                    ^~~~~
    
    Signed-off-by: Ján Tomko <jtomko@redhat.com>
    Fixes: 24b74d187cab48a9dc9f409ea78900154c709579
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

git describe: v6.0.0-468-g8400b6c198 contains: v6.1.0-rc1~62

Case #2 is a separate problem common for all memory backends.

Comment 9 Jing Qi 2020-06-18 03:13:16 UTC
Verified with libvirt-6.4.0-1.module+el8.3.0+6881+88468c00.x86_64 & qemu-kvm-5.0.0-0.module+el8.3.0+6620+5d5e1420.x86_64

1. The domain xml has below part:
      
<memoryBacking>
    <source type='memfd'/>
  </memoryBacking>
  <vcpu placement='static'>4</vcpu>
...
    <numa>
      <cell id='0' cpus='0-1' memory='512000' unit='KiB'/>
      <cell id='1' cpus='2-3' memory='512000' unit='KiB'/>
    </numa>

2. # virsh start avocado-vt-vm1
error: Failed to start domain avocado-vt-vm1
error: unsupported configuration: this qemu doesn't support the memory-backend-memfd object

There is no libvirt error message reported.

Comment 12 errata-xmlrpc 2020-11-17 17:47:36 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 (virt:8.3 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/RHBA-2020:5137


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