Re: [RFC PATCH 6/6] qemu: Format pseries.cap-hpt-mps on the command line

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

 



On Wed, May 23, 2018 at 18:18:02 +0200, Andrea Bolognani wrote:
> This makes the feature fully functional.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1571078
> 
> Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
> ---
>  src/qemu/qemu_command.c                      | 26 ++++++++++++++++++++
>  tests/qemuxml2argvdata/pseries-features.args |  3 ++-
>  2 files changed, 28 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index b446a08613..983839e81c 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -7193,6 +7193,32 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
>  
>              virBufferAsprintf(&buf, ",resize-hpt=%s", str);
>          }
> +
> +        if (def->hpt_maxpagesize > 0) {
> +            unsigned long long tmp = def->hpt_maxpagesize;
> +            unsigned int shifts = 0;
> +
> +            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MPS)) {
> +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                               _("Limiting the page size for HPT guest is "
> +                                 "not supported by this QEMU binary"));
> +                goto cleanup;
> +            }
> +
> +            /* QEMU expects the argument to be a number of left shifts:
> +             * for example, if you wanted to limit the guest to 4 KiB pages,
> +             * since 4096 == 1 << 12, you would need to add cap-hpt-mps=12
> +             * to the command line.

So basically you need to pass the exponent of a power of 2 that yields
this number. The number of left shifts may be slightly confusing ...

> +             *
> +             * Convert from our internal representation, which is bytes,
> +             * to the one QEMU expects */
> +            while (tmp > 1) {
> +                tmp = tmp >> 1;
> +                shifts++;
> +            }
> +
> +            virBufferAsprintf(&buf, ",cap-hpt-mps=%u", shifts);
> +        }
>      }
>  
>      if (cpu && cpu->model &&
> diff --git a/tests/qemuxml2argvdata/pseries-features.args b/tests/qemuxml2argvdata/pseries-features.args
> index f5c1959cca..4e581a69a1 100644
> --- a/tests/qemuxml2argvdata/pseries-features.args
> +++ b/tests/qemuxml2argvdata/pseries-features.args
> @@ -7,7 +7,8 @@ QEMU_AUDIO_DRV=none \
>  /usr/bin/qemu-system-ppc64 \
>  -name guest \
>  -S \
> --machine pseries,accel=tcg,usb=off,dump-guest-core=off,resize-hpt=required \
> +-machine pseries,accel=tcg,usb=off,dump-guest-core=off,resize-hpt=required,\
> +cap-hpt-mps=30 \
>  -m 512 \
>  -smp 1,sockets=1,cores=1,threads=1 \
>  -uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \
> -- 
> 2.17.0
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: PGP signature

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