[PATCH 0/2] virtiofs can be used without NUMA

Halil Pasic (1): Reflect in virtiofs.rst that virtiofs can be used without NUMA Marc Hartmayer (1): qemu: virtiofs can be used without NUMA nodes docs/kbase/virtiofs.rst | 17 ++++++++++++----- src/qemu/qemu_validate.c | 13 +++++++++---- 2 files changed, 21 insertions(+), 9 deletions(-) -- 2.25.4

...if a machine memory-backend using shared memory is configured for the guest. This is especially important for QEMU machine types that don't have NUMA but virtiofs support. An example snippet: <domain type='kvm'> <name>test</name> <memory unit='KiB'>2097152</memory> <memoryBacking> <access mode='shared'/> </memoryBacking> <devices> <filesystem type='mount' accessmode='passthrough'> <driver type='virtiofs'/> <source dir='/tmp/test'/> <target dir='coffee'/> </filesystem> ... </devices> ... </domain> and the corresponding QEMU command line: /usr/bin/qemu-system-s390x \ -machine s390-ccw-virtio-5.2,memory-backend=s390.ram \ -m 2048 \ -object memory-backend-file,id=s390.ram,mem-path=/var/lib/libvirt/qemu/ram/46-test/s390.ram,share=yes,size=2147483648 \ ... Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> --- src/qemu/qemu_validate.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 27e10d59fd25..bc3043bb3f0d 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3470,14 +3470,19 @@ qemuValidateDomainDeviceDefGraphics(const virDomainGraphicsDef *graphics, static int -qemuValidateDomainDefVirtioFSSharedMemory(const virDomainDef *def) +qemuValidateDomainDefVirtioFSSharedMemory(const virDomainDef *def, + virQEMUCapsPtr qemuCaps) { + const char *defaultRAMId = virQEMUCapsGetMachineDefaultRAMid(qemuCaps, + def->virtType, + def->os.machine); size_t numa_nodes = virDomainNumaGetNodeCount(def->numa); size_t i; - if (numa_nodes == 0) { + if (numa_nodes == 0 && + !(defaultRAMId && def->mem.access == VIR_DOMAIN_MEMORY_ACCESS_SHARED)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("virtiofs requires one or more NUMA nodes")); + _("virtiofs requires shared memory")); return -1; } @@ -3591,7 +3596,7 @@ qemuValidateDomainDeviceDefFS(virDomainFSDefPtr fs, _("virtiofs does not support multidevs")); return -1; } - if (qemuValidateDomainDefVirtioFSSharedMemory(def) < 0) + if (qemuValidateDomainDefVirtioFSSharedMemory(def, qemuCaps) < 0) return -1; break; -- 2.25.4

From: Halil Pasic <pasic@linux.ibm.com> Reflect in the virtiofs documentation that virtiofs can now be used even without NUMA. While at it, be more precise where and why shared memory is required. Signed-off-by: Halil Pasic <pasic@linux.ibm.com> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> --- docs/kbase/virtiofs.rst | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/kbase/virtiofs.rst b/docs/kbase/virtiofs.rst index dea8e79f833c..01440420d76d 100644 --- a/docs/kbase/virtiofs.rst +++ b/docs/kbase/virtiofs.rst @@ -16,10 +16,17 @@ See https://virtio-fs.gitlab.io/ Host setup ========== -The host-side virtiofsd daemon, like other vhost-user backed devices, -requires shared memory between the host and the guest. As of QEMU 4.2, this -requires specifying a NUMA topology for the guest and explicitly specifying -a memory backend. Multiple options are available: +Almost all virtio devices (all that use virtqueues) require access to +at least certain portions of guest RAM (possibly policed by DMA). In +case of virtiofsd, much like in case of other vhost-user (see +https://www.qemu.org/docs/master/interop/vhost-user.html) virtio +devices that are realized by an userspace process, this in practice +means that QEMU needs to allocate the backing memory for all the guest +RAM as shared memory. As of QEMU 4.2, it is possible to explicitly +specify a memory backend when specifying the NUMA topology. This +method is however only viable for machine types that do support +NUMA. As of QEMU 5.0.0, it is possible to specify the memory backend +without NUMA (using the so called memobject interface). Either of the following: @@ -46,7 +53,7 @@ Either of the following: Guest setup =========== -#. Specify the NUMA topology +#. Specify the NUMA topology (this step is only required for the NUMA case) in the domain XML of the guest. For the simplest one-node topology for a guest with 2GiB of RAM and 8 vCPUs: -- 2.25.4

On 10/13/20 6:53 PM, Marc Hartmayer wrote:
Halil Pasic (1): Reflect in virtiofs.rst that virtiofs can be used without NUMA
Marc Hartmayer (1): qemu: virtiofs can be used without NUMA nodes
docs/kbase/virtiofs.rst | 17 ++++++++++++----- src/qemu/qemu_validate.c | 13 +++++++++---- 2 files changed, 21 insertions(+), 9 deletions(-)
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> and pushed. Michal

On Tue, Oct 13, 2020 at 07:10 PM +0200, Michal Privoznik <mprivozn@redhat.com> wrote:
On 10/13/20 6:53 PM, Marc Hartmayer wrote:
Halil Pasic (1): Reflect in virtiofs.rst that virtiofs can be used without NUMA
Marc Hartmayer (1): qemu: virtiofs can be used without NUMA nodes
docs/kbase/virtiofs.rst | 17 ++++++++++++----- src/qemu/qemu_validate.c | 13 +++++++++---- 2 files changed, 21 insertions(+), 9 deletions(-)
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
and pushed.
Michal
Thanks. -- Kind regards / Beste Grüße Marc Hartmayer IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
participants (2)
-
Marc Hartmayer
-
Michal Privoznik