[RFC PATCH v1 06/10] arch-x86/pmu.h: convert ascii art diagram to Unicode

Edwin Török posted 10 patches 4 months, 3 weeks ago
[RFC PATCH v1 06/10] arch-x86/pmu.h: convert ascii art diagram to Unicode
Posted by Edwin Török 4 months, 3 weeks ago
Using `aa2u` tool.

Signed-off-by: Edwin Török <edwin.torok@cloud.com>
---
 xen/include/public/arch-x86/pmu.h | 47 ++++++++++++++++---------------
 xen/include/public/pmu.h          |  2 +-
 2 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/xen/include/public/arch-x86/pmu.h b/xen/include/public/arch-x86/pmu.h
index bdc8218cbe..92ae4dbb1d 100644
--- a/xen/include/public/arch-x86/pmu.h
+++ b/xen/include/public/arch-x86/pmu.h
@@ -75,8 +75,10 @@ DEFINE_XEN_GUEST_HANDLE(xen_pmu_regs_t);
 #define PMU_SAMPLE_PV      (1<<3) /* Sample from a PV guest */
 
 /*
- * Architecture-specific information describing the state of the guest at
- * the time of a PMU interrupt.
+ * Architecture-specific information describing state of the guest at
+ * the time of PMU interrupt.
+ * Even if the interrupt arrived while inside Xen, this will always contain
+ * the guest's state.
  */
 struct xen_pmu_arch_guest {
     union {
@@ -146,11 +148,10 @@ struct xen_pmu_arch {
 typedef struct xen_pmu_arch xen_pmu_arch_t;
 DEFINE_XEN_GUEST_HANDLE(xen_pmu_arch_t);
 
-
 /* Memory layout:
  *                ╭─────────────────────╮
  *                │ struct xen_pmu_data │
- * ╒══════════════╧═════════════════════╧═══════════════════════╕ ◁╮
+ * ╒══════════════╧═════════════════════╧═══════════════════════╕ ◁│
  * │ vcpu_id                                                    │  │
  * ├────────────────────────────────────────────────────────────┤  │
  * │ pcpu_id                                                    │  │
@@ -207,25 +208,25 @@ DEFINE_XEN_GUEST_HANDLE(xen_pmu_arch_t);
  * ┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆  ┆
  * ┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆┆  ┆
  * │████████████████████████████████████████████████████████████│  │
- * |############################################################|  |
- * |##########.------------------------------.##################|  |
- * |##########| struct xen_pmu_hv_stacktrace |##################|  |
- * +==========+==============================+==================+  |
- * |                              ^ [stacktrace_nr-1]           |  |
- * |                              :                             |  |
- * | stacktrace[stacktrace_nr]    : [0]                         |  |
- * +------------------------------------------------------------+  |
- * | stacktrace_nr                                              |  |
- * +------------------------------------------------------------+  |
- * | guest_domain_id                                            |  |
- * +------------------------------------------------------------+  |
- * |##pad#######################################################|  |
- * +=======+=+===+==================+===========================+  |
- * | guest | | r | regs             |##pad######################|  |
- * +-------. +---. (xen or guest)   |###########################|  |
- * |         +======================+===========================+  |
- * |         |##pad2############################################|  | PAGE_SIZE
- * +=========+==================================================+ <.
+ * │████████████████████████████████████████████████████████████│  │
+ * │██████████╭──────────────────────────────╮██████████████████│  │
+ * │██████████│ struct xen_pmu_hv_stacktrace │██████████████████│  │
+ * ╞══════════╧══════════════════════════════╧══════════════════╡  │
+ * │                              △ [stacktrace_nr-1]           │  │
+ * │                              ┆                             │  │
+ * │ stacktrace[stacktrace_nr]    ┆ [0]                         │  │
+ * ├────────────────────────────────────────────────────────────┤  │
+ * │ stacktrace_nr                                              │  │
+ * ├────────────────────────────────────────────────────────────┤  │
+ * │ guest_domain_id                                            │  │
+ * ├────────────────────────────────────────────────────────────┤  │
+ * │██pad███████████████████████████████████████████████████████│  │
+ * ╞═══════╤═╤═══╤══════════════════╤═══════════════════════════╡  │
+ * │ guest │ │ r │ regs             │██pad██████████████████████│  │
+ * ├───────╯ ├───╯ (xen or guest)   │███████████████████████████│  │
+ * │         ╞══════════════════════╧═══════════════════════════╡  │
+ * │         │██pad2████████████████████████████████████████████│  │ PAGE_SIZE
+ * ╘═════════╧══════════════════════════════════════════════════╛ ◁╯
 */
 
 #endif /* __XEN_PUBLIC_ARCH_X86_PMU_H__ */
diff --git a/xen/include/public/pmu.h b/xen/include/public/pmu.h
index 1879914ea6..6366a79169 100644
--- a/xen/include/public/pmu.h
+++ b/xen/include/public/pmu.h
@@ -148,7 +148,7 @@ struct xen_pmu_hv_stacktrace {
     * arrives while in Xen.
     * */
     struct xen_pmu_arch_guest guest;
-#define XEN_PMU_STACKTRACE_PAD 48
+#define XEN_PMU_STACKTRACE_PAD 56
     uint8_t pad2[XEN_PMU_STACKTRACE_PAD];
 };
 
-- 
2.47.1


Re: [RFC PATCH v1 06/10] arch-x86/pmu.h: convert ascii art diagram to Unicode
Posted by Jan Beulich 4 months, 2 weeks ago
On 25.07.2025 17:06, Edwin Török wrote:
> Using `aa2u` tool.
> 
> Signed-off-by: Edwin Török <edwin.torok@cloud.com>

How come the use of that tool made ...

> --- a/xen/include/public/arch-x86/pmu.h
> +++ b/xen/include/public/arch-x86/pmu.h
> @@ -75,8 +75,10 @@ DEFINE_XEN_GUEST_HANDLE(xen_pmu_regs_t);
>  #define PMU_SAMPLE_PV      (1<<3) /* Sample from a PV guest */
>  
>  /*
> - * Architecture-specific information describing the state of the guest at
> - * the time of a PMU interrupt.
> + * Architecture-specific information describing state of the guest at
> + * the time of PMU interrupt.
> + * Even if the interrupt arrived while inside Xen, this will always contain
> + * the guest's state.
>   */
>  struct xen_pmu_arch_guest {

... this comment change, or yet more interesting, ...

> --- a/xen/include/public/pmu.h
> +++ b/xen/include/public/pmu.h
> @@ -148,7 +148,7 @@ struct xen_pmu_hv_stacktrace {
>      * arrives while in Xen.
>      * */
>      struct xen_pmu_arch_guest guest;
> -#define XEN_PMU_STACKTRACE_PAD 48
> +#define XEN_PMU_STACKTRACE_PAD 56
>      uint8_t pad2[XEN_PMU_STACKTRACE_PAD];
>  };

... this value in the public interface?

Jan

Re: [RFC PATCH v1 06/10] arch-x86/pmu.h: convert ascii art diagram to Unicode
Posted by Edwin Torok 4 months, 2 weeks ago
On Thu, Jul 31, 2025 at 4:35 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 25.07.2025 17:06, Edwin Török wrote:
> > Using `aa2u` tool.
> >
> > Signed-off-by: Edwin Török <edwin.torok@cloud.com>
>
> How come the use of that tool made ...
>
> > --- a/xen/include/public/arch-x86/pmu.h
> > +++ b/xen/include/public/arch-x86/pmu.h
> > @@ -75,8 +75,10 @@ DEFINE_XEN_GUEST_HANDLE(xen_pmu_regs_t);
> >  #define PMU_SAMPLE_PV      (1<<3) /* Sample from a PV guest */
> >
> >  /*
> > - * Architecture-specific information describing the state of the guest at
> > - * the time of a PMU interrupt.
> > + * Architecture-specific information describing state of the guest at
> > + * the time of PMU interrupt.
> > + * Even if the interrupt arrived while inside Xen, this will always contain
> > + * the guest's state.
> >   */
> >  struct xen_pmu_arch_guest {

Thanks for spotting, according to my evolog this one ended up here
while fixing a rebase conflict:
```
○  lrwoxosk hidden edwin.torok@cloud.com 2025-07-24 13:20:56 215f9e58
│  arch-x86/pmu.h: convert ascii art diagram to Unicode
│  -- operation 073584199528 (2025-07-24 13:20:56) snapshot working copy
│  diff --git a/xen/include/public/arch-x86/pmu.h
b/xen/include/public/arch-x86/pmu.h
│  index 0000000000..4dc3d9a20a 100644
│  --- a/xen/include/public/arch-x86/pmu.h
│  +++ b/xen/include/public/arch-x86/pmu.h
│  @@ -75,8 +75,10 @@
│   #define PMU_SAMPLE_PV      (1<<3) /* Sample from a PV guest */
│
│   /*
│  - * Architecture-specific information describing the state of the guest at
│  - * the time of a PMU interrupt.
│  + * Architecture-specific information describing state of the guest at
│  + * the time of PMU interrupt.
│  + * Even if the interrupt arrived while inside Xen, this will always contain
│  + * the guest's state.
│    */
│   struct xen_pmu_arch_guest {
│       union {
│  @@ -149,178 +151,89 @@
│   typedef struct xen_pmu_arch xen_pmu_arch_t;
│   DEFINE_XEN_GUEST_HANDLE(xen_pmu_arch_t);
│
│  -
│   /* Memory layout:
│  -<<<<<<< Conflict 1 of 1
│  -+++++++ Contents of side #1
```

>
> ... this comment change, or yet more interesting, ...
>
> > --- a/xen/include/public/pmu.h
> > +++ b/xen/include/public/pmu.h
> > @@ -148,7 +148,7 @@ struct xen_pmu_hv_stacktrace {
> >      * arrives while in Xen.
> >      * */
> >      struct xen_pmu_arch_guest guest;
> > -#define XEN_PMU_STACKTRACE_PAD 48
> > +#define XEN_PMU_STACKTRACE_PAD 56
> >      uint8_t pad2[XEN_PMU_STACKTRACE_PAD];
> >  };
>
> ... this value in the public interface?

Thanks for spotting, it doesn't belong in this commit.

I would assume that this happened by squashing a commit into the wrong
place, or by editing the wrong commit while rebasing.
Luckily I use 'jj', and it has an evolog that stores the full history
of how a commit changed over split/squash/rebase, so I don't have to
guess, but can give you a precise answer.

My evolog says that this change came from editing the source code
while having the wrong commit checked out (I kept tweaking those
values):
```
○  lrwoxosk hidden edwin.torok@cloud.com 2025-07-24 13:46:44 bfa29564
│  arch-x86/pmu.h: convert ascii art diagram to Unicode
│  -- operation 3f48136a1b6a (2025-07-24 13:46:44) snapshot working copy
│  diff --git a/xen/include/public/pmu.h b/xen/include/public/pmu.h
│  index 1879914ea6..6366a79169 100644
│  --- a/xen/include/public/pmu.h
│  +++ b/xen/include/public/pmu.h
│  @@ -148,7 +148,7 @@
│       * arrives while in Xen.
│       * */
│       struct xen_pmu_arch_guest guest;
│  -#define XEN_PMU_STACKTRACE_PAD 48
│  +#define XEN_PMU_STACKTRACE_PAD 56
│       uint8_t pad2[XEN_PMU_STACKTRACE_PAD];
│   };
```

Before I submit the next version I'll check whether the other hunks
ended up in the right place  after all the
squashing/rebasing/splitting

Best regards,
--Edwin
>
> Jan