From nobody Sun Dec 14 05:53:39 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=cloud.com ARC-Seal: i=1; a=rsa-sha256; t=1753456068; cv=none; d=zohomail.com; s=zohoarc; b=RPzEFUJpBjzMCJeKY3hqtDX2MGvMmYJsHeiVSOjTl4K9DKeUSLjAeH7ai5NNi7yCFeFMorAT4nkdtkNoaiQWblT2EZg10l12HfPr4YLB95Sa+SHFigF5Y8mbeVyZ0vPQQIwqP+GV4BgT+nyOcJ7Iy0ZfZbKZB4IYZ3pZGxtpAyY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753456068; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WjJUuOkVkjeeAsMY8i9Mv8bOHKA0v2O1WG6n4OAsjLs=; b=FsS7xWgCOeAODDmMarjHYNn6UVL2ppdP5YF5q0kj6nWh9j6yIpMVJOLqZRBg2fbWsXFk0DbxEkdLV8ieG544s47BTzpKmR34/fCv60nfHuyQPg9arsMP7l6RFEEvYCAJcEZPM5SqGl2T4Ss1a6zJxEwmrwwN9JsicpVWZ1YZZGQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1753456068549845.9256725100956; Fri, 25 Jul 2025 08:07:48 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1058057.1425727 (Exim 4.92) (envelope-from ) id 1ufK0y-0002Z7-JM; Fri, 25 Jul 2025 15:07:16 +0000 Received: by outflank-mailman (output) from mailman id 1058057.1425727; Fri, 25 Jul 2025 15:07:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ufK0y-0002VC-E0; Fri, 25 Jul 2025 15:07:16 +0000 Received: by outflank-mailman (input) for mailman id 1058057; Fri, 25 Jul 2025 15:07:15 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ufK0x-0002MQ-GZ for xen-devel@lists.xenproject.org; Fri, 25 Jul 2025 15:07:15 +0000 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [2a00:1450:4864:20::532]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 0ba6d494-6969-11f0-b895-0df219b8e170; Fri, 25 Jul 2025 17:07:13 +0200 (CEST) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-60c5b8ee2d9so4565899a12.2 for ; Fri, 25 Jul 2025 08:07:13 -0700 (PDT) Received: from localhost.localdomain ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-614cd0f730fsm2194208a12.22.2025.07.25.08.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Jul 2025 08:07:12 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 0ba6d494-6969-11f0-b895-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1753456033; x=1754060833; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WjJUuOkVkjeeAsMY8i9Mv8bOHKA0v2O1WG6n4OAsjLs=; b=V7R/CHIEcs+Qh4oC+N3xAobvNmlCX8H3WOOMPQcUkYJAAS2Ep68MKbefaRZJru0rk2 YLBsfNZONcRP9sn5mckq129mcyUpzzQpcLZ52mWUrt8o6x1+mDenJiq8e0xNMZsrVn9B 1C/kv6V+rwu09tjEOSpdaM/0XTMNeOzWANCCU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753456033; x=1754060833; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WjJUuOkVkjeeAsMY8i9Mv8bOHKA0v2O1WG6n4OAsjLs=; b=sOFIBt4u6gZd4YQj4JbD+BqjBtf56ruA7b5FnlcOVkHaqcTo0KSxdA92E6CJTXeGwU NHcPNb+Q1Cxdbmth/PrVfVqQJNhQeiN/B+2YqAQ6FGBPmUolivAZDZIQpnz/Vs4NjKU8 Cjk/r4teU24bJa3BBW746yzO2oCPHuSExyYhi7TOVXsXx4kbKyR9j/PgpK4aEzc32e3G tyCZBpEWDmWv5hKJ/JkmsUQj7DkuimJ6rsJx0WKSE2Erp3W6nETZvupbgnDD1IS3coUg dEEvpK0zf+vWr/d8sZHRXh4DdlfQAnYWnAtVDrLZ1jgzicayTOFBD7cIFfbqgR2ZYbb9 rafQ== X-Gm-Message-State: AOJu0YxSUGCnuKQJdB8ujRSyRg8RPO+6KUbzTqCimhG8dkPGFFBvmMlh NsxqV3iS3hBh6mHbp6S9/wJ1H62aXuRpJ61mIxdM4X+BVwikPkcmUyViEYoNB51GJjgu1h1VnrI GuKR/oIU= X-Gm-Gg: ASbGnct1GBID54CDFwspivGH3/n+ocAC0XsGoeBb9d1mVou1nl8c7vdix9VVh5wRgV8 SbgYcsmjnZMelJVWoX8hD8V4pikjgnmbihqGeWpRyykJUl7DLf4YUXMHRy0bjzkaGVi2Q10SyRd 5Bqj+N2V8Z1MYUnXGfJFvj09IgPHZhLfwToBYlbint3yMx1ONrOcAPUroMt9dK3C8NdMcIdDeei PfuXsD6iM3gDHvxfXw4MBrTlFssRiL3vLXzSJrlaxgolhP1vQTelX1dnTPFlv/wukW/hxZbFObv 62Sy4wiSaJlaC5A0rnPxTBtG+qLHu5juJ1Y87UDn3dUEhadamPaHBbfCsW2zBl/KveFAzOT6vY5 NeOIONYGa22I7OV6wGgJf9K3/pqYVz+IotYpr X-Google-Smtp-Source: AGHT+IE1RlHK5S4tEzuYbFc3r98R2pHtlcQZi02L4eIuKkTVKrqlsurFhfmiXkDse6o9kTwjD6XcgQ== X-Received: by 2002:a05:6402:1ed6:b0:60c:461e:7199 with SMTP id 4fb4d7f45d1cf-614f1bb98f0mr2068972a12.9.1753456033074; Fri, 25 Jul 2025 08:07:13 -0700 (PDT) From: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , andriy.sultanov@vates.tech, boris.ostrovsky@oracle.com Subject: [RFC PATCH v1 02/10] arch-x86/pmu.h: document current memory layout for VPMU Date: Fri, 25 Jul 2025 16:06:38 +0100 Message-ID: <5602e488bfa9b06e46e2a374d40ff4a617feb512.1753372928.git.edwin.torok@cloud.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @cloud.com) X-ZM-MESSAGEID: 1753456072620116600 There are nested structs, unions, padding and flexible array members. The interpretation of the flexible array members is all done with pointer arithmetic, it is useful to visualize the actual memory layout. The ascii-art drawing is compatible with ascii-art-to-unicode (aa2u) fro m hackage. No functional change. Signed-off-by: Edwin T=C3=B6r=C3=B6k --- xen/include/public/arch-x86/pmu.h | 63 +++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/xen/include/public/arch-x86/pmu.h b/xen/include/public/arch-x8= 6/pmu.h index d0a99268af..8be71a88ee 100644 --- a/xen/include/public/arch-x86/pmu.h +++ b/xen/include/public/arch-x86/pmu.h @@ -129,6 +129,69 @@ struct xen_pmu_arch { typedef struct xen_pmu_arch xen_pmu_arch_t; DEFINE_XEN_GUEST_HANDLE(xen_pmu_arch_t); =20 +/* Memory layout: +* .---------------------. +* | struct xen_pmu_data | +* +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ <. +* | vcpu_id | | +* +------------------------------------------------------------+ | +* | pcpu_id | | +* +------------------------------------------------------------+ | +* | domain_id | | +* +------------------------------------------------------------+ | +* |##pad#######################################################| | +* +=3D=3D=3D=3D+=3D+=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ | +* | pmu| | r | regs |##pad#########################| | +* +----. +---. (xen or guest) |##############################| | +* | +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D+ | +* | | pmu_flags | | +* | +=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D+ | +* | | l | lapic_lvtpc |############################| | +* | +---. ###################|##pad#######################| | +* | | ###################|############################| | +* | +=3D=3D=3D+=3D+=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D+=3D=3D=3D=3D= +=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D= =3D=3D+ | +* | | c | | | amd | | | intel | |#####| | +* | +---+ | .-----. | .-------. |#####| | +* | | | counter | fixed_counters |#####| |=20 +* | | +------------------+----------------------+#####| | +* | | | ctrls | arch_counters |#####| | +* | | +=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D+-------= ---------------+#####| | +* | | | | regs[] | :| global_ctrl |#####| | +* | | | +--------. :+----------------------+#####| | +* | | |struct :| global_ovf_ctrl |#####| | +* | | |xen_pmu_cntr_pair:+----------------------+#####| | +* | | |[counters] :| global_status |#####| | +* | | | :+----------------------+#####| | +* | | | :| fixed_ctrl |#####| | +* | | | :+----------------------+#####| | +* | | | :| ds_area |#####| | +* | | | :+----------------------+#####| | +* | | | :| pebs_enable |#pad#| | +* | | | :+----------------------+#####| | +* | | | v| debugctl |#####| | +* | | |##################+=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D= =3D=3D=3D+=3D=3D=3D=3D=3D+#####| | +* | | |##################| | regs[] | :[0]|#####| | +* | | |##################| +--------. : |#####| | +* | | |##################| uint64_t : |#####| | +* | | |##################| [fixed_counters] : |#####| | +* | | |##################| : |#####| | +* | | |##################| : |#####| | +* | | |##################| -----------------: |#####| | +* | | |##################| struct : |#####| | +* | | |##################| xen_pmu_cntr_pair: |#####| | +* | | +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ [a= rch_counters] : +=3D=3D=3D=3D=3D+ |=20 +* | | | : | | | +* | | | v | | | +* | | +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D+ | | +* | +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D+ | +* +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ | +* |############################################################| | +* :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: : +* :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: : +* |############################################################| | PAGE_S= IZE +* +=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ <. +*/ + #endif /* __XEN_PUBLIC_ARCH_X86_PMU_H__ */ /* * Local variables: --=20 2.47.1