From nobody Wed Apr 24 19:26:31 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1559698198; cv=none; d=zoho.com; s=zohoarc; b=oUcLKiYiXEf+E/IAC0zNxDAPKbYuoo+byS832nv1+eAIR3IsgFYwN7sNd6CMx8xtOzw10mNjlXCIWzGHEflC7Ql4sBq/Fg70yd0XLMal2o6a9MDb/sfAPP1quJgLvuVjpzyOB3B9pLcJYHgScaUh532m75/3xYGhmG9gDQCsL0M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559698198; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=pMSlqs6YaVTddBFYUV5zgGNl7ZOyX9j5uKY28HUX26U=; b=jGe2ykHAG8oy5xwRhm4XBan9spC8s0xj7MRU7IykUuF0duuJqAjsDT4cwmYg7LAjvx9ExwgQX716t8b+dimKZoGdcSb8DZp295kCzpABcyh7Nz+CcfwDbZV4A57PbiLcg1WnozKqaX6RHJa+rHnlao24oF3D8S/CiEcqRWsiq+4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1559698197826906.0726502070378; Tue, 4 Jun 2019 18:29:57 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hYKiu-00033I-2U; Wed, 05 Jun 2019 01:28:16 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hYKis-00033B-Ar for xen-devel@lists.xenproject.org; Wed, 05 Jun 2019 01:28:14 +0000 Received: from mxnavi-mail.mxnavi.com (unknown [116.90.87.199]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 2de3b133-8731-11e9-8980-bc764e045a96; Wed, 05 Jun 2019 01:28:11 +0000 (UTC) Received: from localhost.localdomain (61.161.186.150) by mxnavi-mail.mxnavi.com (116.90.87.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1591.10; Wed, 5 Jun 2019 09:25:59 +0800 X-Inumbo-ID: 2de3b133-8731-11e9-8980-bc764e045a96 From: Baodong Chen To: Date: Wed, 5 Jun 2019 09:27:56 +0800 Message-ID: <1559698076-17247-1-git-send-email-chenbaodong@mxnavi.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [61.161.186.150] X-ClientProxiedBy: mxnavi-mail.mxnavi.com (116.90.87.199) To mxnavi-mail.mxnavi.com (116.90.87.199) Subject: [Xen-devel] [PATCH v3] xen: make tracebuffer configurable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Baodong Chen Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 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 --- 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 =20 Leave empty if you are not sure what to specify. =20 +config TRACEBUFFER + bool "Enable tracing infrastructure" if EXPERT =3D "y" + default y + ---help--- + Enable in tracing infrastructure and pre-defined tracepoints within Xen. + This will allow live information about Xen=E2=80=99s execution and perf= ormance + 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 +=3D sysctl.o obj-y +=3D tasklet.o obj-y +=3D time.o obj-y +=3D timer.o -obj-y +=3D trace.o +obj-$(CONFIG_TRACEBUFFER) +=3D trace.o obj-y +=3D version.o obj-y +=3D virtual_region.o obj-y +=3D 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__ =20 +/* 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 =20 #include #include #include =20 +#ifdef CONFIG_TRACEBUFFER /* Used to initialise trace buffer functionality */ void init_trace_bufs(void); =20 @@ -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); =20 +#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 e= xtra, + 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 { \ --=20 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel