All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH v3] xen: make tracebuffer configurable
@ 2019-06-05  1:27 Baodong Chen
  2019-06-05 10:38 ` George Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: Baodong Chen @ 2019-06-05  1:27 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich, Baodong Chen

Xen internal running status(trace event) will be saved to
trace memory when enabled. trace event data and config params can be
read/changed by system control hypercall at run time.

Can be disabled for smaller code footprint.

Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
---
 xen/common/Kconfig      |  9 +++++++++
 xen/common/Makefile     |  2 +-
 xen/include/xen/trace.h | 26 ++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index c838506..d908fe1 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -368,4 +368,13 @@ config DOM0_MEM
 
 	  Leave empty if you are not sure what to specify.
 
+config TRACEBUFFER
+	bool "Enable tracing infrastructure"  if EXPERT = "y"
+	default y
+	---help---
+	  Enable in tracing infrastructure and pre-defined tracepoints within Xen.
+	  This will allow live information about Xen’s execution and performance
+	  to be collected at run time for debugging or performance analysis.
+	  Memory and execution overhead when not active is minimal.
+
 endmenu
diff --git a/xen/common/Makefile b/xen/common/Makefile
index bca48e6..9fd1bd2 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -56,7 +56,7 @@ obj-y += sysctl.o
 obj-y += tasklet.o
 obj-y += time.o
 obj-y += timer.o
-obj-y += trace.o
+obj-$(CONFIG_TRACEBUFFER) += trace.o
 obj-y += version.o
 obj-y += virtual_region.o
 obj-y += vm_event.o
diff --git a/xen/include/xen/trace.h b/xen/include/xen/trace.h
index 12966ea..fad92c7 100644
--- a/xen/include/xen/trace.h
+++ b/xen/include/xen/trace.h
@@ -21,12 +21,18 @@
 #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 <public/sysctl.h>
 #include <public/trace.h>
 #include <asm/trace.h>
 
+#ifdef CONFIG_TRACEBUFFER
 /* Used to initialise trace buffer functionality */
 void init_trace_bufs(void);
 
@@ -47,6 +53,26 @@ static inline void trace_var(u32 event, int cycles, int extra,
 void __trace_hypercall(uint32_t event, unsigned long op,
                        const xen_ulong_t *args);
 
+#else
+static inline void init_trace_bufs(void) {}
+static inline int tb_control(struct xen_sysctl_tbuf_op *tbc)
+{
+    return -ENOSYS;
+}
+
+static inline int trace_will_trace_event(uint32_t event)
+{
+    return 0;
+}
+
+static inline void trace_var(uint32_t event, int cycles, int extra,
+                             const void *extra_data) {}
+static inline void __trace_var(uint32_t event, bool cycles, unsigned int extra,
+                               const void *extra_data) {}
+static inline void __trace_hypercall(uint32_t event, unsigned long op,
+                                     const xen_ulong_t *args) {}
+#endif
+
 /* Convenience macros for calling the trace function. */
 #define TRACE_0D(_e)                            \
     do {                                        \
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Xen-devel] [PATCH v3] xen: make tracebuffer configurable
  2019-06-05  1:27 [Xen-devel] [PATCH v3] xen: make tracebuffer configurable Baodong Chen
@ 2019-06-05 10:38 ` George Dunlap
  2019-06-10  1:00   ` chenbaodong
  0 siblings, 1 reply; 3+ messages in thread
From: George Dunlap @ 2019-06-05 10:38 UTC (permalink / raw)
  To: Baodong Chen
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	Andrew Cooper, Tim (Xen.org),
	George Dunlap, Julien Grall, Jan Beulich, Ian Jackson, xen-devel



> On Jun 5, 2019, at 2:27 AM, Baodong Chen <chenbaodong@mxnavi.com> wrote:
> 
> Xen internal running status(trace event) will be saved to
> trace memory when enabled. trace event data and config params can be
> read/changed by system control hypercall at run time.
> 
> Can be disabled for smaller code footprint.
> 
> Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
> ---
> xen/common/Kconfig      |  9 +++++++++
> xen/common/Makefile     |  2 +-
> xen/include/xen/trace.h | 26 ++++++++++++++++++++++++++
> 3 files changed, 36 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/common/Kconfig b/xen/common/Kconfig
> index c838506..d908fe1 100644
> --- a/xen/common/Kconfig
> +++ b/xen/common/Kconfig
> @@ -368,4 +368,13 @@ config DOM0_MEM
> 
> 	  Leave empty if you are not sure what to specify.
> 
> +config TRACEBUFFER
> +	bool "Enable tracing infrastructure"  if EXPERT = "y"
> +	default y
> +	---help---
> +	  Enable in tracing infrastructure and pre-defined tracepoints within Xen.

Sorry, an editing mistake caused me to include a stray ‘in’ in this sentence when I suggested this text. :-)

This could be removed on check-in.  With that fixed, the commit message looks OK to me.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xen-devel] [PATCH v3] xen: make tracebuffer configurable
  2019-06-05 10:38 ` George Dunlap
@ 2019-06-10  1:00   ` chenbaodong
  0 siblings, 0 replies; 3+ messages in thread
From: chenbaodong @ 2019-06-10  1:00 UTC (permalink / raw)
  To: George Dunlap
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	Andrew Cooper, Tim (Xen.org),
	Julien Grall, Jan Beulich, Ian Jackson, xen-devel


On 6/5/19 18:38, George Dunlap wrote:
>
>> On Jun 5, 2019, at 2:27 AM, Baodong Chen <chenbaodong@mxnavi.com> wrote:
>>
>> Xen internal running status(trace event) will be saved to
>> trace memory when enabled. trace event data and config params can be
>> read/changed by system control hypercall at run time.
>>
>> Can be disabled for smaller code footprint.
>>
>> Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
>> ---
>> xen/common/Kconfig      |  9 +++++++++
>> xen/common/Makefile     |  2 +-
>> xen/include/xen/trace.h | 26 ++++++++++++++++++++++++++
>> 3 files changed, 36 insertions(+), 1 deletion(-)
>>
>> diff --git a/xen/common/Kconfig b/xen/common/Kconfig
>> index c838506..d908fe1 100644
>> --- a/xen/common/Kconfig
>> +++ b/xen/common/Kconfig
>> @@ -368,4 +368,13 @@ config DOM0_MEM
>>
>> 	  Leave empty if you are not sure what to specify.
>>
>> +config TRACEBUFFER
>> +	bool "Enable tracing infrastructure"  if EXPERT = "y"
>> +	default y
>> +	---help---
>> +	  Enable in tracing infrastructure and pre-defined tracepoints within Xen.
> Sorry, an editing mistake caused me to include a stray ‘in’ in this sentence when I suggested this text. :-)
>
> This could be removed on check-in.  With that fixed, the commit message looks OK to me.

Hello George,

sorry for the late reply.

Fixed according to your comments in v4.

>   -George
>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-10  1:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-05  1:27 [Xen-devel] [PATCH v3] xen: make tracebuffer configurable Baodong Chen
2019-06-05 10:38 ` George Dunlap
2019-06-10  1:00   ` chenbaodong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.