|
|
dc2b6e |
From f745b9ae2d12df0c0f2253c295f3d411a8a4165d Mon Sep 17 00:00:00 2001
|
|
|
dc2b6e |
Message-Id: <f745b9ae2d12df0c0f2253c295f3d411a8a4165d@dist-git>
|
|
|
dc2b6e |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
dc2b6e |
Date: Mon, 5 Sep 2022 10:34:44 +0200
|
|
|
dc2b6e |
Subject: [PATCH] qemu_process: Don't require a hugetlbfs mount for memfd
|
|
|
dc2b6e |
|
|
|
dc2b6e |
The aim of qemuProcessNeedHugepagesPath() is to determine whether
|
|
|
dc2b6e |
a hugetlbfs mount point is required for given domain (as in
|
|
|
dc2b6e |
whether qemuBuildMemoryBackendProps() picks up
|
|
|
dc2b6e |
memory-backend-file pointing to a hugetlbfs mount point). Well,
|
|
|
dc2b6e |
when domain is configured to use memfd backend then that
|
|
|
dc2b6e |
condition can never be true. Therefore, skip creating domain's
|
|
|
dc2b6e |
private path under hugetlbfs mount points.
|
|
|
dc2b6e |
|
|
|
dc2b6e |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
dc2b6e |
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
dc2b6e |
(cherry picked from commit f14f8dff9330ed51d817f190a2ee9ac76dfac00b)
|
|
|
dc2b6e |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2123196
|
|
|
dc2b6e |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
dc2b6e |
---
|
|
|
dc2b6e |
src/qemu/qemu_process.c | 12 +++++++++++-
|
|
|
dc2b6e |
1 file changed, 11 insertions(+), 1 deletion(-)
|
|
|
dc2b6e |
|
|
|
dc2b6e |
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
|
|
dc2b6e |
index 5c6657a876..540eee9ff0 100644
|
|
|
dc2b6e |
--- a/src/qemu/qemu_process.c
|
|
|
dc2b6e |
+++ b/src/qemu/qemu_process.c
|
|
|
dc2b6e |
@@ -3810,8 +3810,18 @@ qemuProcessNeedHugepagesPath(virDomainDef *def,
|
|
|
dc2b6e |
const long system_pagesize = virGetSystemPageSizeKB();
|
|
|
dc2b6e |
size_t i;
|
|
|
dc2b6e |
|
|
|
dc2b6e |
- if (def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE)
|
|
|
dc2b6e |
+ switch ((virDomainMemorySource)def->mem.source) {
|
|
|
dc2b6e |
+ case VIR_DOMAIN_MEMORY_SOURCE_FILE:
|
|
|
dc2b6e |
+ /* This needs a hugetlbfs mount. */
|
|
|
dc2b6e |
return true;
|
|
|
dc2b6e |
+ case VIR_DOMAIN_MEMORY_SOURCE_MEMFD:
|
|
|
dc2b6e |
+ /* memfd works without a hugetlbfs mount */
|
|
|
dc2b6e |
+ return false;
|
|
|
dc2b6e |
+ case VIR_DOMAIN_MEMORY_SOURCE_NONE:
|
|
|
dc2b6e |
+ case VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS:
|
|
|
dc2b6e |
+ case VIR_DOMAIN_MEMORY_SOURCE_LAST:
|
|
|
dc2b6e |
+ break;
|
|
|
dc2b6e |
+ }
|
|
|
dc2b6e |
|
|
|
dc2b6e |
for (i = 0; i < def->mem.nhugepages; i++) {
|
|
|
dc2b6e |
if (def->mem.hugepages[i].size != system_pagesize)
|
|
|
dc2b6e |
--
|
|
|
dc2b6e |
2.38.0
|
|
|
dc2b6e |
|