From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Luca Fancellu <luca.fancellu@arm.com>
Cc: xen-devel@lists.xenproject.org, bertrand.marquis@arm.com,
wei.chen@arm.com, George Dunlap <george.dunlap@citrix.com>,
Nick Rosbrook <rosbrookn@gmail.com>, Wei Liu <wl@xen.org>,
Anthony PERARD <anthony.perard@citrix.com>,
Juergen Gross <jgross@suse.com>,
Christian Lindig <christian.lindig@citrix.com>,
David Scott <dave@recoil.org>
Subject: Re: [PATCH 08/10] tools: add SVE capability and SVE vector length for physinfo
Date: Thu, 2 Feb 2023 13:38:23 +0100 [thread overview]
Message-ID: <Y9uuv05ekRLW94CT@mail-itl> (raw)
In-Reply-To: <20230202110816.1252419-9-luca.fancellu@arm.com>
[-- Attachment #1: Type: text/plain, Size: 3999 bytes --]
On Thu, Feb 02, 2023 at 11:08:14AM +0000, Luca Fancellu wrote:
> Recent changes added in struct xen_sysctl_physinfo a new flag for
> arch_capabilities to understand when the platform is SVE capable,
> another field having the maximum SVE vector length in bits was
> added as well, so update the tools to handle these new fields.
>
> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
> ---
> Changes from RFC:
> - new patch
> ---
> This patch is mostly dependent on the decisions we make in the previous, anyway
> I touched some part of the toolstack where my knowledge is limited (ocaml) so
> I might need a feedback for something I may have done wrong.
> ---
> tools/golang/xenlight/helpers.gen.go | 4 ++++
> tools/golang/xenlight/types.gen.go | 2 ++
> tools/include/libxl.h | 8 ++++++++
> tools/libs/light/libxl.c | 3 +++
> tools/libs/light/libxl_types.idl | 2 ++
> tools/ocaml/libs/xc/xenctrl.ml | 4 +++-
> tools/ocaml/libs/xc/xenctrl.mli | 4 +++-
> tools/ocaml/libs/xc/xenctrl_stubs.c | 17 +++++++++++++----
> tools/python/xen/lowlevel/xc/xc.c | 17 +++++++++++++++--
> tools/xl/xl_info.c | 10 ++++++++++
> 10 files changed, 63 insertions(+), 8 deletions(-)
For the python part:
> diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
> index fd008610329b..516fa57161a6 100644
> --- a/tools/python/xen/lowlevel/xc/xc.c
> +++ b/tools/python/xen/lowlevel/xc/xc.c
> @@ -870,6 +870,11 @@ static PyObject *pyxc_physinfo(XcObject *self)
> const char *virtcap_names[] = { "hvm", "pv" };
> const unsigned virtcaps_bits[] = { XEN_SYSCTL_PHYSCAP_hvm,
> XEN_SYSCTL_PHYSCAP_pv };
> +#if defined(__aarch64__)
> + const char py_buildval[] = "{s:i,s:i,s:i,s:i,s:l,s:l,s:l,s:i,s:s,s:s,s:i}";
> +#else
> + const char py_buildval[] = "{s:i,s:i,s:i,s:i,s:l,s:l,s:l,s:i,s:s,s:s}";
> +#endif
I don't like this #if for a different return format depending on the
architecture, especially when the underlying structure is in fact the
same (just not all fields are used for every arch). It would make adding
further fields unnecessarily error-prone.
Instead, you can do common stuff with Py_BuildValue and then add
architecture-specific stuff with PyDict_SetItemString:
https://docs.python.org/3/c-api/dict.html
> if ( xc_physinfo(self->xc_handle, &pinfo) != 0 )
> return pyxc_error_to_exception(self->xc_handle);
> @@ -893,10 +898,14 @@ static PyObject *pyxc_physinfo(XcObject *self)
> for ( i = 0; i < ARRAY_SIZE(virtcaps_bits); i++ )
> if ( pinfo.capabilities & virtcaps_bits[i] )
> p += sprintf(p, "%s_directio ", virtcap_names[i]);
> +#if defined(__aarch64__)
> + if ( pinfo.arch_capabilities & XEN_SYSCTL_PHYSCAP_ARM_sve )
> + p += sprintf(p, "%s ", "arm_sve");
> +#endif
> if ( p != virt_caps )
> *(p-1) = '\0';
>
> - return Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:l,s:i,s:s,s:s}",
> + return Py_BuildValue(py_buildval,
> "nr_nodes", pinfo.nr_nodes,
> "threads_per_core", pinfo.threads_per_core,
> "cores_per_socket", pinfo.cores_per_socket,
> @@ -906,7 +915,11 @@ static PyObject *pyxc_physinfo(XcObject *self)
> "scrub_memory", pages_to_kib(pinfo.scrub_pages),
> "cpu_khz", pinfo.cpu_khz,
> "hw_caps", cpu_cap,
> - "virt_caps", virt_caps);
> + "virt_caps", virt_caps
> +#if defined(__aarch64__)
> + , "arm_sve_vl_bits", pinfo.arm_sve_vl_bits
> +#endif
> + );
> }
>
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2023-02-02 12:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-02 11:08 [PATCH 00/10] SVE feature for arm guests Luca Fancellu
2023-02-02 11:08 ` [PATCH 01/10] xen/arm: enable SVE extension for Xen Luca Fancellu
2023-02-02 11:08 ` [PATCH 02/10] xen/arm: add sve_vl_bits field to domain Luca Fancellu
2023-02-02 11:08 ` [PATCH 03/10] xen/arm: Expose SVE feature to the guest Luca Fancellu
2023-02-02 11:08 ` [PATCH 04/10] xen/arm: add SVE exception class handling Luca Fancellu
2023-02-02 11:08 ` [PATCH 05/10] arm/sve: save/restore SVE context switch Luca Fancellu
2023-02-02 11:08 ` [PATCH 06/10] xen/arm: enable Dom0 to use SVE feature Luca Fancellu
2023-02-02 11:08 ` [PATCH 07/10] xen/physinfo: add arm SVE arch capability and vector length Luca Fancellu
2023-02-02 12:05 ` Jan Beulich
2023-02-10 15:54 ` Luca Fancellu
2023-02-13 8:36 ` Jan Beulich
2023-02-23 14:00 ` Bertrand Marquis
2023-03-02 2:57 ` Stefano Stabellini
2023-02-02 11:08 ` [PATCH 08/10] tools: add SVE capability and SVE vector length for physinfo Luca Fancellu
2023-02-02 12:38 ` Marek Marczykowski-Górecki [this message]
2023-02-02 14:12 ` Andrew Cooper
2023-02-02 11:08 ` [PATCH 09/10] xen/tools: add sve parameter in XL configuration Luca Fancellu
2023-02-02 11:08 ` [PATCH 10/10] xen/arm: add sve property for dom0less domUs Luca Fancellu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y9uuv05ekRLW94CT@mail-itl \
--to=marmarek@invisiblethingslab.com \
--cc=anthony.perard@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=christian.lindig@citrix.com \
--cc=dave@recoil.org \
--cc=george.dunlap@citrix.com \
--cc=jgross@suse.com \
--cc=luca.fancellu@arm.com \
--cc=rosbrookn@gmail.com \
--cc=wei.chen@arm.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.