Bug 1839030

Summary: RFE: enable the "memfd" memory backend
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Daniel Berrangé <berrange>
Component: qemu-kvmAssignee: Marc-Andre Lureau <marcandre.lureau>
qemu-kvm sub component: General QA Contact: Yumei Huang <yuhuang>
Status: CLOSED ERRATA Docs Contact:
Severity: urgent    
Priority: high CC: ddepaula, dgilbert, drjones, jinzhao, juzhang, mdeng, qzhang, virt-maint, yuhuang
Version: 8.3Keywords: RFE
Target Milestone: rc   
Target Release: 8.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-4.2.0-23.module+el8.2.1+6917+927fbb44 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-28 07:13:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Daniel Berrangé 2020-05-22 11:11:12 UTC
Description of problem:
The "memfd" memory backend in QEMU provides a way to back QEMU guest RAM with sharable memory that does not have to be backed by files. This supports use of both normal sized and huge pages.

This is desirable to support for KubeVirt, because their containers are blocked from accessing /dev/hugepages mount point with the default OpenShift SELinux policy. The memfd backend should give them a way to use hugepages without needing access to the mount point, thus eliminating a deployment permissions hurdle.

Version-Release number of selected component (if applicable):
qemu-4.2.0-19.el8_2

How reproducible:
Always

Steps to Reproduce:
1. # /usr/libexec/qemu-kvm     -object memory-backend-memfd,id=mem1,hugetlb=yes,hugetlbsize=2097152,size=268435456

Actual results:

qemu-kvm: -object memory-backend-memfd,id=mem1,size=1G: invalid object type: memory-backend-memfd


Expected results:

QEMU boots with huge pages used and /dev/hugepages does not need to be mounted / accessible

Comment 1 John Ferlan 2020-05-22 20:35:54 UTC
See bug 1837334 which links to bug 1738626 (explicit removal downstream in 8.1) as well as a couple of other bugs that would need to be unwound.

This could be duped there or vice-versa I believe.

Assigning to Marc-Andre for now so we can figure the best way forward as it seems from the removal description that more work is necessary.

Setting prio to high so that to work towards getting an answer more quickly.

Comment 3 Danilo de Paula 2020-05-25 19:16:58 UTC
Setting ITR=8.2.1 as the patch was sent targetting 8.2.1
Marc Andre, please check if this is intended.

@QA: QA_ACK, please.

Comment 4 John Ferlan 2020-05-26 19:57:22 UTC
*** Bug 1837334 has been marked as a duplicate of this bug. ***

Comment 8 Yumei Huang 2020-06-05 06:24:30 UTC
Verify:
qemu-kvm-4.2.0-23.module+el8.2.1+6917+927fbb44
kernel-4.18.0-193.6.1.el8_2.x86_64

Steps: Setup hugepages on host, boot guest with memory-backend-memfd, and hotplug memory with memory-backend-memfd, guest works well, host hugepages are consumed as expected.

QEMU cli:
/usr/libexec/qemu-kvm \
    -m 4G,slots=20,maxmem=20G \
    -object memory-backend-memfd,id=mem1,hugetlb=yes,hugetlbsize=2M,size=1G \
    -device pc-dimm,id=dimm1,memdev=mem1 \
    ...

Hotplug memory,
(qemu) object_add memory-backend-memfd,id=mem2,hugetlb=yes,hugetlbsize=2M,size=1G
(qemu) device_add pc-dimm,memdev=mem2,id=dimm2

Comment 10 errata-xmlrpc 2020-07-28 07:13: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/RHBA-2020:3172