Re: [PATCH v3 2/3] qemu: check memory-backend-memfd.hugetlb capability

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

 



On 11/15/2018 12:55 PM, marcandre.lureau@xxxxxxxxxx wrote:
> From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
> 
> QEMU 3.1 should only expose the property if the host is actually
> capable of creating hugetable-backed memfd. However, it may fail
> at runtime depending on requested "hugetlbsize".
> 
> Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/qemu/qemu_capabilities.c                  |   8 ++
>  src/qemu/qemu_capabilities.h                  |   1 +
>  .../caps_2.12.0.aarch64.replies               |  94 ++++++++++++---
>  .../caps_2.12.0.aarch64.xml                   |   3 +-
>  .../caps_2.12.0.ppc64.replies                 |  90 +++++++++++---
>  .../caps_2.12.0.ppc64.xml                     |   3 +-
>  .../caps_2.12.0.s390x.replies                 |  98 ++++++++++++----
>  .../caps_2.12.0.s390x.xml                     |   3 +-
>  .../caps_2.12.0.x86_64.replies                | 110 +++++++++++++-----
>  .../caps_2.12.0.x86_64.xml                    |   3 +-
>  .../caps_3.0.0.ppc64.replies                  |  90 +++++++++++---
>  .../qemucapabilitiesdata/caps_3.0.0.ppc64.xml |   3 +-
>  .../caps_3.0.0.riscv32.replies                |  86 +++++++++++---
>  .../caps_3.0.0.riscv32.xml                    |   1 +
>  .../caps_3.0.0.riscv64.replies                |  86 +++++++++++---
>  .../caps_3.0.0.riscv64.xml                    |   1 +
>  .../caps_3.0.0.s390x.replies                  |  98 ++++++++++++----
>  .../qemucapabilitiesdata/caps_3.0.0.s390x.xml |   4 +-
>  .../caps_3.0.0.x86_64.replies                 | 110 +++++++++++++-----
>  .../caps_3.0.0.x86_64.xml                     |   3 +-
>  20 files changed, 718 insertions(+), 177 deletions(-)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 5d15e6d3fb..eab2444c5d 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -510,6 +510,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
>                "blockdev",
>                "vfio-ap",
>                "memory-backend-memfd",
> +              "memory-backend-memfd.hugetlb",
>      );
>  
>  
> @@ -1358,6 +1359,10 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsMemoryBackendFile[] =
>      { "discard-data", QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD },
>  };
>  
> +static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsMemoryBackendMemfd[] = {
> +    { "hugetlb", QEMU_CAPS_OBJECT_MEMORY_MEMFD_HUGETLB },
> +};
> +
>  static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsSPAPRMachine[] = {
>      { "cap-hpt-max-page-size", QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE },
>      { "cap-htm", QEMU_CAPS_MACHINE_PSERIES_CAP_HTM },
> @@ -1367,6 +1372,9 @@ static virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = {
>      { "memory-backend-file", virQEMUCapsObjectPropsMemoryBackendFile,
>        ARRAY_CARDINALITY(virQEMUCapsObjectPropsMemoryBackendFile),
>        QEMU_CAPS_OBJECT_MEMORY_FILE },
> +    { "memory-backend-memfd", virQEMUCapsObjectPropsMemoryBackendMemfd,
> +      ARRAY_CARDINALITY(virQEMUCapsObjectPropsMemoryBackendMemfd),
> +      QEMU_CAPS_OBJECT_MEMORY_FILE },

This needs to be QEMU_CAPS_OBJECT_MEMORY_MEMFD. This is conditional
capability, which means "memory-backend-memfd" object props will be
queried on if this capability is set. And since there are qemus which do
support memory-backend-file and do not support memory-backend-memfd this
would try to query the props even if it shouldn't.

>      { "spapr-machine", virQEMUCapsObjectPropsSPAPRMachine,
>        ARRAY_CARDINALITY(virQEMUCapsObjectPropsSPAPRMachine),
>        -1 },

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[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