diff mbox series

[v2,11/12] xen/arch: Drop asm-*/trace.h

Message ID 20210920172529.24932-12-andrew.cooper3@citrix.com (mailing list archive)
State New, archived
Headers show
Series xen/trace: Fix leakage of uninitialised stack into the tracebuffer | expand

Commit Message

Andrew Cooper Sept. 20, 2021, 5:25 p.m. UTC
The feature is x86 and pv-dom0 specific, and each architecture's main trace.h
files are empty.  Don't force all new architectures to create an empty file.

While moving the declaration of tb_init_done, change from int to bool.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien@xen.org>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>

v2:
 * New
---
 xen/common/trace.c          |  2 +-
 xen/include/asm-arm/trace.h | 12 ------------
 xen/include/asm-x86/trace.h |  4 ----
 xen/include/xen/trace.h     | 13 +++++--------
 4 files changed, 6 insertions(+), 25 deletions(-)
 delete mode 100644 xen/include/asm-arm/trace.h
 delete mode 100644 xen/include/asm-x86/trace.h

Comments

Jan Beulich Sept. 21, 2021, 4:01 p.m. UTC | #1
On 20.09.2021 19:25, Andrew Cooper wrote:
> The feature is x86 and pv-dom0 specific, and each architecture's main trace.h
> files are empty.  Don't force all new architectures to create an empty file.

The first half sentence looks to be wrong according to Julien's
reply to patch 16. But the change here doesn't seem to depend on
that aspect in any way.

> While moving the declaration of tb_init_done, change from int to bool.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

With a suitable adjustment to the text:
Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan
Julien Grall Oct. 12, 2021, 12:31 p.m. UTC | #2
Hi Andrew,

On 20/09/2021 18:25, Andrew Cooper wrote:
> The feature is x86 and pv-dom0 specific, and each architecture's main trace.h
> files are empty.  Don't force all new architectures to create an empty file.
> 
> While moving the declaration of tb_init_done, change from int to bool.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

For the Arm bits:

Acked-by: Julien Grall <jgrall@amazon.com>

Cheers,
diff mbox series

Patch

diff --git a/xen/common/trace.c b/xen/common/trace.c
index 41a3c170446b..a5dc468296d6 100644
--- a/xen/common/trace.c
+++ b/xen/common/trace.c
@@ -67,7 +67,7 @@  static DEFINE_PER_CPU(unsigned long, lost_records_first_tsc);
 
 /* a flag recording whether initialization has been done */
 /* or more properly, if the tbuf subsystem is enabled right now */
-int tb_init_done __read_mostly;
+bool __read_mostly tb_init_done;
 
 /* which CPUs tracing is enabled on */
 static cpumask_t tb_cpu_mask;
diff --git a/xen/include/asm-arm/trace.h b/xen/include/asm-arm/trace.h
deleted file mode 100644
index e06def61f6f3..000000000000
--- a/xen/include/asm-arm/trace.h
+++ /dev/null
@@ -1,12 +0,0 @@ 
-#ifndef __ASM_TRACE_H__
-#define __ASM_TRACE_H__
-
-#endif /* __ASM_TRACE_H__ */
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/include/asm-x86/trace.h b/xen/include/asm-x86/trace.h
deleted file mode 100644
index edef1bb099d4..000000000000
--- a/xen/include/asm-x86/trace.h
+++ /dev/null
@@ -1,4 +0,0 @@ 
-#ifndef __ASM_TRACE_H__
-#define __ASM_TRACE_H__
-
-#endif /* __ASM_TRACE_H__ */
diff --git a/xen/include/xen/trace.h b/xen/include/xen/trace.h
index 3cbb542af888..055883287e8c 100644
--- a/xen/include/xen/trace.h
+++ b/xen/include/xen/trace.h
@@ -21,19 +21,14 @@ 
 #ifndef __XEN_TRACE_H__
 #define __XEN_TRACE_H__
 
-/* Put 'tb_init_done' here because 'asm/trace.h' may use it */
-#ifdef CONFIG_TRACEBUFFER
-extern int tb_init_done;
-#else
-#define tb_init_done false
-#endif
-
 #include <xen/types.h>
 #include <public/sysctl.h>
 #include <public/trace.h>
-#include <asm/trace.h>
 
 #ifdef CONFIG_TRACEBUFFER
+
+extern bool tb_init_done;
+
 /* Used to initialise trace buffer functionality */
 void init_trace_bufs(void);
 
@@ -58,6 +53,8 @@  void __trace_hypercall(uint32_t event, unsigned long op,
 
 #include <xen/errno.h>
 
+#define tb_init_done false
+
 static inline void init_trace_bufs(void) {}
 static inline int tb_control(struct xen_sysctl_tbuf_op *tbc)
 {