From: Baodong Chen <chenbaodong@mxnavi.com> To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wei.liu2@citrix.com>, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>, George Dunlap <George.Dunlap@eu.citrix.com>, Andrew Cooper <andrew.cooper3@citrix.com>, Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>, Julien Grall <julien.grall@arm.com>, Jan Beulich <jbeulich@suse.com>, Baodong Chen <chenbaodong@mxnavi.com> Subject: [PATCH v1] xen: make tracebuffer configurable Date: Tue, 4 Jun 2019 08:44:56 +0800 [thread overview] Message-ID: <1559609096-11356-1-git-send-email-chenbaodong@mxnavi.com> (raw) 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 | 12 ++++++++++++ xen/common/Makefile | 2 +- xen/include/xen/trace.h | 17 +++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/xen/common/Kconfig b/xen/common/Kconfig index c838506..3459f56 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -368,4 +368,16 @@ config DOM0_MEM Leave empty if you are not sure what to specify. +config TRACEBUFFER + bool "Enable trace event logs" if EXPERT = "y" + ---help--- + 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. + + This is used to record xen internal running status. + with a litte performance overhead. + Can be set to 'N' if you dont want this function. + When not configured, 'XEN_STSCTL_tbuf_op' command will result 'ENOSYS'. + 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..da781fa 100644 --- a/xen/include/xen/trace.h +++ b/xen/include/xen/trace.h @@ -21,12 +21,15 @@ #ifndef __XEN_TRACE_H__ #define __XEN_TRACE_H__ +#ifdef CONFIG_TRACEBUFFER extern int tb_init_done; +#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 +50,20 @@ 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 +#define tb_init_done false +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
WARNING: multiple messages have this Message-ID (diff)
From: Baodong Chen <chenbaodong@mxnavi.com> To: <xen-devel@lists.xenproject.org> Cc: Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wei.liu2@citrix.com>, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>, George Dunlap <George.Dunlap@eu.citrix.com>, Andrew Cooper <andrew.cooper3@citrix.com>, Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>, Julien Grall <julien.grall@arm.com>, Jan Beulich <jbeulich@suse.com>, Baodong Chen <chenbaodong@mxnavi.com> Subject: [Xen-devel] [PATCH v1] xen: make tracebuffer configurable Date: Tue, 4 Jun 2019 08:44:56 +0800 [thread overview] Message-ID: <1559609096-11356-1-git-send-email-chenbaodong@mxnavi.com> (raw) Message-ID: <20190604004456.t3kLnARj5pHoS3wJFmIxQYnSKvszH80ph44-DlQ1Exo@z> (raw) 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 | 12 ++++++++++++ xen/common/Makefile | 2 +- xen/include/xen/trace.h | 17 +++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/xen/common/Kconfig b/xen/common/Kconfig index c838506..3459f56 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -368,4 +368,16 @@ config DOM0_MEM Leave empty if you are not sure what to specify. +config TRACEBUFFER + bool "Enable trace event logs" if EXPERT = "y" + ---help--- + 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. + + This is used to record xen internal running status. + with a litte performance overhead. + Can be set to 'N' if you dont want this function. + When not configured, 'XEN_STSCTL_tbuf_op' command will result 'ENOSYS'. + 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..da781fa 100644 --- a/xen/include/xen/trace.h +++ b/xen/include/xen/trace.h @@ -21,12 +21,15 @@ #ifndef __XEN_TRACE_H__ #define __XEN_TRACE_H__ +#ifdef CONFIG_TRACEBUFFER extern int tb_init_done; +#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 +50,20 @@ 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 +#define tb_init_done false +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
next reply other threads:[~2019-06-04 0:45 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-06-04 0:44 Baodong Chen [this message] 2019-06-04 0:44 ` [Xen-devel] [PATCH v1] xen: make tracebuffer configurable Baodong Chen 2019-06-04 7:10 ` Jan Beulich 2019-06-04 7:10 ` [Xen-devel] " Jan Beulich 2019-06-04 8:39 ` chenbaodong 2019-06-04 8:39 ` [Xen-devel] " chenbaodong 2019-06-04 10:49 ` George Dunlap 2019-06-04 11:43 ` Jan Beulich 2019-06-05 1:28 ` chenbaodong
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1559609096-11356-1-git-send-email-chenbaodong@mxnavi.com \ --to=chenbaodong@mxnavi.com \ --cc=George.Dunlap@eu.citrix.com \ --cc=andrew.cooper3@citrix.com \ --cc=ian.jackson@eu.citrix.com \ --cc=jbeulich@suse.com \ --cc=julien.grall@arm.com \ --cc=konrad.wilk@oracle.com \ --cc=sstabellini@kernel.org \ --cc=tim@xen.org \ --cc=wei.liu2@citrix.com \ --cc=xen-devel@lists.xenproject.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.