Skip to contentSkip to conversation

x86/ACPI: annotate assembly data with type and size

PATCH In review Jan Beulich 2 participants 4 messages Oct 2, 2024 – Mar 5, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/ACPI: annotate assembly data with type and size

Further use the generic framework from xen/linkage.h. While there drop excess alignment and move to .bss.

---
Of course alongside ASM_INT() we could introduce ASM_QUAD() and ASM_QUAD_LOCAL() (only the latter needed right here) to aid readability. Thoughts?

xen/arch/x86/acpi/wakeup_prot.S +14 -5
@@ -1,3 +1,5 @@
+#define DATA_FILL 0 /* For the .bss contributions at the bottom. */
+
 #include <asm/asm_defns.h>
 #include <asm/msr-index.h>
 #include <asm/page.h>
@@ -134,13 +136,20 @@ LABEL(s3_resume)
         ret
 END(do_suspend_lowlevel)
 
-.data
-        .align 16
+        .bss
 
-saved_rsp:      .quad   0
-saved_cr0:      .quad   0
+DATA_LOCAL(saved_rsp, 8)
+        .quad   0
+END(saved_rsp)
+DATA_LOCAL(saved_cr0, 8)
+        .quad   0
+END(saved_cr0)
 #ifdef CONFIG_XEN_SHSTK
-saved_ssp:      .quad   0
+DATA_LOCAL(saved_ssp, 8)
+        .quad   0
+END(saved_ssp)
 #endif
 
+        .data
+
 ASM_INT(saved_magic, 0x9abcdef0)
#1 lore raw
Quoted 9 lines · Jan Beulich

Further use the generic framework from xen/linkage.h. While there drop excess alignment and move to .bss.

---
Of course alongside ASM_INT() we could introduce ASM_QUAD() and ASM_QUAD_LOCAL() (only the latter needed right here) to aid readability. Thoughts?

Honestly, ASM_INT() hiding a .long is confusing enough already.

ASM_C_{INT,LONG}() wouldn't be as bad.  At least they're clear about being a particular type in another language.

xen/arch/x86/acpi/wakeup_prot.S line 2

Quoted 5 lines
xen/arch/x86/acpi/wakeup_prot.S +2 -0
@@ -1,3 +1,5 @@
+#define DATA_FILL 0 /* For the .bss contributions at the bottom. */
+

I really feel that here is the wrong place for this to live.

Why isn't it in xen/linkage.h?  When is data typically padded with anything other than 0's?

~Andrew

#2 lore raw
Quoted 11 lines · Andrew Cooper
Quoted 9 lines · Jan Beulich

Further use the generic framework from xen/linkage.h. While there drop excess alignment and move to .bss.

---
Of course alongside ASM_INT() we could introduce ASM_QUAD() and ASM_QUAD_LOCAL() (only the latter needed right here) to aid readability. Thoughts?

Quoted 4 lines

Honestly, ASM_INT() hiding a .long is confusing enough already.

ASM_C_{INT,LONG}() wouldn't be as bad.  At least they're clear about being a particular type in another language.

I don't think the _C_ would add much; we all know C is the language Xen is written in. ASM_LONG() / ASM_C_LONG() would not be generalizable, i.e. couldn't be put in xen/linkage.h without arch customization, as that can neither expand uniformly to .long nor to .quad. It's all solvable, but would be getting involved.

Quoted 10 lines

xen/arch/x86/acpi/wakeup_prot.S line 2

Quoted 5 lines
xen/arch/x86/acpi/wakeup_prot.S +2 -0
@@ -1,3 +1,5 @@
+#define DATA_FILL 0 /* For the .bss contributions at the bottom. */
+

I really feel that here is the wrong place for this to live.

Why isn't it in xen/linkage.h?  When is data typically padded with anything other than 0's?

As per what we currently have, the default data padding is ~0. Personally I consider this marginally better than 0, but it could of course be changed.

Jan

#3 lore raw

Ping: [PATCH] x86/ACPI: annotate assembly data with type and size

In reply to Jan Beulich
Quoted 5 lines · Jan Beulich

Further use the generic framework from xen/linkage.h. While there drop excess alignment and move to .bss.

May I please ask for an ack or otherwise?

Jan

Quoted 39 lines

---
Of course alongside ASM_INT() we could introduce ASM_QUAD() and ASM_QUAD_LOCAL() (only the latter needed right here) to aid readability. Thoughts?

xen/arch/x86/acpi/wakeup_prot.S +14 -5
@@ -1,3 +1,5 @@
+#define DATA_FILL 0 /* For the .bss contributions at the bottom. */
+
 #include <asm/asm_defns.h>
 #include <asm/msr-index.h>
 #include <asm/page.h>
@@ -134,13 +136,20 @@ LABEL(s3_resume)
         ret
 END(do_suspend_lowlevel)
 
-.data
-        .align 16
+        .bss
 
-saved_rsp:      .quad   0
-saved_cr0:      .quad   0
+DATA_LOCAL(saved_rsp, 8)
+        .quad   0
+END(saved_rsp)
+DATA_LOCAL(saved_cr0, 8)
+        .quad   0
+END(saved_cr0)
 #ifdef CONFIG_XEN_SHSTK
-saved_ssp:      .quad   0
+DATA_LOCAL(saved_ssp, 8)
+        .quad   0
+END(saved_ssp)
 #endif
 
+        .data
+
 ASM_INT(saved_magic, 0x9abcdef0)