Skip to contentSkip to conversation

x86/current: Annotate get_cpu_info() as attr_const

PATCH In review Andrew Cooper 2 participants 2 messages Aug 12, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/current: Annotate get_cpu_info() as attr_const

The result of this calculation will always be identical, even across context switch in x86. Tell the compiler.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>

add/remove: 0/0 grow/shrink: 0/15 up/down: 0/-300 (-300)

  Function                                     old     new   delta
  nsvm_vcpu_vmexit_event                       114     111      -3
  nsvm_vcpu_reset                              178     175      -3
  nestedsvm_vcpu_interrupt                     302     299      -3
  compat_memory_op.cold                        200     197      -3
  vcpu_block_enable_events                      30      26      -4
  nestedsvm_vmexit_defer                        90      86      -4
  dom0_construct                              8441    8435      -6
  svm_vmexit_do_clgi                           206     198      -8
  nsvm_vcpu_vmrun                             2530    2522      -8
  compat_multicall                            1194    1178     -16
  arch_do_domctl                              8621    8605     -16
  hvm_set_param.cold                            74      44     -30
  do_multicall                                1165    1133     -32
  ept_set_entry                               2023    1978     -45
  compat_memory_op                            7440    7321    -119
---
 xen/arch/x86/include/asm/current.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/include/asm/current.h +1 -1
index a7c9473428b2..fd30422707d9 100644
@@ -83,7 +83,7 @@ static inline struct cpu_info *get_cpu_info_from_stack(unsigned long sp)
     return (struct cpu_info *)((sp | (STACK_SIZE - 1)) + 1) - 1;
 }
 
-static inline struct cpu_info *get_cpu_info(void)
+static inline attr_const struct cpu_info *get_cpu_info(void)
 {
 #ifdef __clang__
     /* Clang complains that sp in the else case is not initialised. */
Signature · 1 line
2.39.5