From: Andrew Cooper <andrew.cooper3@citrix.com>
To: "Edwin Török" <edwin.torok@cloud.com>, xen-devel@lists.xenproject.org
Cc: "Jan Beulich" <jbeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Anthony PERARD" <anthony.perard@vates.tech>,
"Michal Orzel" <michal.orzel@amd.com>,
"Julien Grall" <julien@xen.org>,
"Stefano Stabellini" <sstabellini@kernel.org>,
andriy.sultanov@vates.tech, boris.ostrovsky@oracle.com
Subject: Re: [RFC PATCH v1 01/10] pmu.h: add a BUILD_BUG_ON to ensure it fits within one page
Date: Mon, 28 Jul 2025 11:21:14 +0100 [thread overview]
Message-ID: <0cd10fcf-d017-4a85-b248-e29e77903349@citrix.com> (raw)
In-Reply-To: <80e7ae8bc1546b004e2b3dcc3f3e57563ff741d2.1753372928.git.edwin.torok@cloud.com>
On 25/07/2025 4:06 pm, Edwin Török wrote:
> Linux already has a similar BUILD_BUG_ON.
> Currently this struct is ~224 bytes on x86-64.
>
> No functional change.
>
> Signed-off-by: Edwin Török <edwin.torok@cloud.com>
> ---
> xen/arch/x86/cpu/vpmu.c | 1 +
> xen/include/public/pmu.h | 3 +++
> 2 files changed, 4 insertions(+)
>
> diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
> index c28192ea26..7be79c2d00 100644
> --- a/xen/arch/x86/cpu/vpmu.c
> +++ b/xen/arch/x86/cpu/vpmu.c
> @@ -401,6 +401,7 @@ static int vpmu_arch_initialise(struct vcpu *v)
> uint8_t vendor = current_cpu_data.x86_vendor;
> int ret;
>
> + BUILD_BUG_ON(sizeof(struct xen_pmu_data) > PAGE_SIZE);
> BUILD_BUG_ON(sizeof(struct xen_pmu_intel_ctxt) > XENPMU_CTXT_PAD_SZ);
> BUILD_BUG_ON(sizeof(struct xen_pmu_amd_ctxt) > XENPMU_CTXT_PAD_SZ);
> BUILD_BUG_ON(sizeof(struct xen_pmu_regs) > XENPMU_REGS_PAD_SZ);
This is fine (even if it ought to be elsewhere, but don't worry about that).
> diff --git a/xen/include/public/pmu.h b/xen/include/public/pmu.h
> index af8b7babdd..15decc024d 100644
> --- a/xen/include/public/pmu.h
> +++ b/xen/include/public/pmu.h
> @@ -93,6 +93,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_pmu_params_t);
> * Architecture-independent fields of xen_pmu_data are WO for the hypervisor
> * and RO for the guest but some fields in xen_pmu_arch can be writable
> * by both the hypervisor and the guest (see arch-$arch/pmu.h).
> + *
> + * PAGE_SIZE bytes of memory are allocated.
> + * This struct cannot be larger than PAGE_SIZE.
This isn't. Xen's PAGE_SIZE is not necessarily the same as PAGE_SIZE in
the guest consuming this header.
This highlights one of the problems that Xen's ABI entrenches. Being
x86-only, it's 4k in practice, but there's no easy solution.
I'd just skip this comment. Anything else is going to get tied up in
unrelated bigger problems.
~Andrew
next prev parent reply other threads:[~2025-07-28 10:21 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-25 15:06 [RFC PATCH v1 00/10] Xen flamegraph (hypervisor stacktrace profile) support Edwin Török
2025-07-25 15:06 ` [RFC PATCH v1 01/10] pmu.h: add a BUILD_BUG_ON to ensure it fits within one page Edwin Török
2025-07-28 10:08 ` Jan Beulich
2025-07-28 10:21 ` Andrew Cooper [this message]
2025-07-28 10:22 ` Edwin Torok
2025-07-28 10:25 ` Jan Beulich
2025-07-25 15:06 ` [RFC PATCH v1 02/10] arch-x86/pmu.h: document current memory layout for VPMU Edwin Török
2025-07-25 15:06 ` [RFC PATCH v1 03/10] arch-x86/pmu.h: convert ascii art drawing to Unicode Edwin Török
2025-07-28 10:22 ` Jan Beulich
2025-07-28 16:07 ` Edwin Torok
2025-07-29 6:45 ` Jan Beulich
2025-07-25 15:06 ` [RFC PATCH v1 04/10] vpmu.c: factor out register conversion Edwin Török
2025-07-28 10:25 ` Andrew Cooper
2025-07-28 14:17 ` Edwin Torok
2025-07-25 15:06 ` [RFC PATCH v1 05/10] pmu.h: introduce a stacktrace area Edwin Török
2025-08-05 6:40 ` Andriy Sultanov
2025-08-28 12:04 ` Jan Beulich
2025-07-25 15:06 ` [RFC PATCH v1 06/10] arch-x86/pmu.h: convert ascii art diagram to Unicode Edwin Török
2025-07-31 15:35 ` Jan Beulich
2025-08-01 9:53 ` Edwin Torok
2025-07-25 15:06 ` [RFC PATCH v1 07/10] arch-x86/vpmu.c: store guest registers when domain_id == DOMID_XEN Edwin Török
2025-07-25 15:06 ` [RFC PATCH v1 08/10] pmu.h: expose a hypervisor stacktrace feature Edwin Török
2025-07-25 15:06 ` [RFC PATCH v1 09/10] vpmu.c hypervisor stacktrace support in vPMU Edwin Török
2025-07-25 15:06 ` [RFC PATCH v1 10/10] xen/tools/pyperf.py: example script to parse perf output Edwin Török
2025-07-25 15:06 ` [RFC LINUX PATCH v1 1/3] perf kvm: introduce a hypervisor_callchain callback Edwin Török
2025-07-25 15:06 ` [RFC LINUX PATCH v1 2/3] xen/{interface,xenpmu}.h: update with VPMU 0.2 from Xen Edwin Török
2025-07-25 15:06 ` [RFC LINUX PATCH v1 3/3] perf kvm: implement Xen hypervisor stacktraces Edwin Török
2025-07-25 15:48 ` [RFC PATCH v1 00/10] Xen flamegraph (hypervisor stacktrace profile) support Edwin Torok
2025-07-25 22:25 ` Demi Marie Obenour
2025-07-28 9:25 ` Edwin Torok
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=0cd10fcf-d017-4a85-b248-e29e77903349@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=andriy.sultanov@vates.tech \
--cc=anthony.perard@vates.tech \
--cc=boris.ostrovsky@oracle.com \
--cc=edwin.torok@cloud.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.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.