On 2/8/25 1:02 AM, Andrew Cooper wrote:
Three architectures have an identical dump_execution_state(), and PPC has a
stub for show_execution_state() that just isn't wired up yet.

show_execution_state() is declared in a common header, meaning that
dump_execution_state() really ought to be too.  Move them both into xen/bug.h
as they're tightly tied to run_in_exception_handler().  Drop the include of
xen/kernel.h from ubsan.c which was required reviously for RISC-V to compile.

No functional change.

Signed-off-by: Andrew Cooper<andrew.coop...@citrix.com>
---
CC: Jan Beulich<jbeul...@suse.com>
CC: Roger Pau Monné<roger....@citrix.com>
CC: Stefano Stabellini<sstabell...@kernel.org>
CC: Julien Grall<jul...@xen.org>
CC: Volodymyr Babchuk<volodymyr_babc...@epam.com>
CC: Bertrand Marquis<bertrand.marq...@arm.com>
CC: Michal Orzel<michal.or...@amd.com>
CC: Oleksii Kurochko<oleksii.kuroc...@gmail.com>
CC: Shawn Anastasio<sanasta...@raptorengineering.com>
---
  xen/arch/arm/include/asm/processor.h   | 2 --
  xen/arch/riscv/include/asm/processor.h | 2 --

Reviewed-by: Oleksii Kurochko<oleksii.kuroc...@gmail.com>.

Thanks.

~ Oleksii

  xen/arch/x86/include/asm/processor.h   | 1 -
  xen/common/ubsan/ubsan.c               | 1 -
  xen/include/xen/bug.h                  | 3 +++
  xen/include/xen/kernel.h               | 2 --
  6 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/include/asm/processor.h 
b/xen/arch/arm/include/asm/processor.h
index d80d44aeaa8f..f2c4d990c71c 100644
--- a/xen/arch/arm/include/asm/processor.h
+++ b/xen/arch/arm/include/asm/processor.h
@@ -577,8 +577,6 @@ void panic_PAR(uint64_t par);
  void show_registers(const struct cpu_user_regs *regs);
  void show_stack(const struct cpu_user_regs *regs);
-#define dump_execution_state() run_in_exception_handler(show_execution_state)
-
  #define cpu_relax() barrier() /* Could yield? */
/* All a bit UP for the moment */
diff --git a/xen/arch/riscv/include/asm/processor.h 
b/xen/arch/riscv/include/asm/processor.h
index 39696fb58dc6..90b800956303 100644
--- a/xen/arch/riscv/include/asm/processor.h
+++ b/xen/arch/riscv/include/asm/processor.h
@@ -91,8 +91,6 @@ static inline void sfence_vma(void)
      asm volatile ( "sfence.vma" ::: "memory" );
  }
-#define dump_execution_state() run_in_exception_handler(show_execution_state)
-
  #endif /* __ASSEMBLY__ */
#endif /* ASM__RISCV__PROCESSOR_H */
diff --git a/xen/arch/x86/include/asm/processor.h 
b/xen/arch/x86/include/asm/processor.h
index d247ef8dd226..c2eafaecfd40 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -405,7 +405,6 @@ static always_inline void rep_nop(void)
  void show_code(const struct cpu_user_regs *regs);
  void show_stack_overflow(unsigned int cpu, const struct cpu_user_regs *regs);
  void show_registers(const struct cpu_user_regs *regs);
-#define dump_execution_state() run_in_exception_handler(show_execution_state)
  void show_page_walk(unsigned long addr);
  void noreturn fatal_trap(const struct cpu_user_regs *regs, bool show_remote);
diff --git a/xen/common/ubsan/ubsan.c b/xen/common/ubsan/ubsan.c
index e99370322b44..a96153c08078 100644
--- a/xen/common/ubsan/ubsan.c
+++ b/xen/common/ubsan/ubsan.c
@@ -11,7 +11,6 @@
   */
#include <xen/bitops.h>
-#include <xen/kernel.h>
  #include <xen/lib.h>
  #include <xen/percpu.h>
  #include <xen/spinlock.h>
diff --git a/xen/include/xen/bug.h b/xen/include/xen/bug.h
index 99814c4bef36..2325a46e7f61 100644
--- a/xen/include/xen/bug.h
+++ b/xen/include/xen/bug.h
@@ -155,6 +155,9 @@ int do_bug_frame(const struct cpu_user_regs *regs, unsigned 
long pc);
#endif /* CONFIG_GENERIC_BUG_FRAME */ +void cf_check show_execution_state(const struct cpu_user_regs *regs);
+#define dump_execution_state() run_in_exception_handler(show_execution_state)
+
  #endif /* !__ASSEMBLY__ */
#endif /* __XEN_BUG_H__ */
diff --git a/xen/include/xen/kernel.h b/xen/include/xen/kernel.h
index c5b6cc977772..57a1ef4e17b7 100644
--- a/xen/include/xen/kernel.h
+++ b/xen/include/xen/kernel.h
@@ -94,10 +94,8 @@ bool is_active_kernel_text(unsigned long addr);
  extern const char xen_config_data[];
  extern const unsigned int xen_config_data_size;
-struct cpu_user_regs;
  struct vcpu;
-void cf_check show_execution_state(const struct cpu_user_regs *regs);
  void vcpu_show_execution_state(struct vcpu *v);
#endif /* _LINUX_KERNEL_H */

Reply via email to