Re: [RFC] qemu: virtiofs can be used without NUMA nodes

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

 



On Tue, Oct 06, 2020 at 06:20 PM +0200, Marc Hartmayer <mhartmay@xxxxxxxxxxxxx> wrote:
> ...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@xxxxxxxxxxxxx>
> ---
> Note: There are still some TODOs left... e.g. adapt the virtiofs
> documentation of libvirt.
> ---
>  src/qemu/qemu_validate.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
> index a212605579d2..077a85b30802 100644
> --- a/src/qemu/qemu_validate.c
> +++ b/src/qemu/qemu_validate.c
> @@ -3470,14 +3470,21 @@ 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)) {
> +        /* TODO do we need further checks here (e.g. check whether
> +         * memory backend is supported by the QEMU binary)? */
>          virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -                       _("virtiofs requires one or more NUMA nodes"));
> +                       _("virtiofs requires shared memory"));
>          return -1;
>      }
>  
> @@ -3591,7 +3598,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
>

Gentle ping :)

-- 
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





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux