Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1523896pxk; Fri, 25 Sep 2020 18:04:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXNjxQkpWma4+fMJUezQaa9s91YcOshjmiPymZeebCtHcbatfozdV36zwFZE0ZwPkRSEFB X-Received: by 2002:a17:906:f92:: with SMTP id q18mr5246572ejj.237.1601082249203; Fri, 25 Sep 2020 18:04:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601082249; cv=none; d=google.com; s=arc-20160816; b=I/sGnlPIFWyWAlN12dwvaFuuxVaTp8GDd2g+8wzYskvKDrdFQm4ZMZrZYQ6/9VutVT EkmvCGnTE/tpVrRA+xT16xIDmxjJAEu33eDHgfOkcBYhv5vzG0f7j1xSzw5PT89QUTIX nByG9fkS1XTzJtWc3+bylCBrhY6DKes0fWTCZ/M0mN1bh6tK4YbFhIAfNYTKWJwRQxNG 2uHcCw2lVO0SoKgMm7ju5n/NrmOlScZY3NzhWSV/x/iQM6SptCB9NiywKoebPZoPKWZ/ as+cV5goeGWYqC4HuqclLyBb7VRwCiC2ACCr6U02aeltx9jYVkRsQe55l3lkLfEnoFPs GQnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dmarc-filter:sender:dkim-signature; bh=KYo1MEwXVCcSihTHW3CCwSJaU7l9vAJrjZOB2qJD3BI=; b=IZ06UbAO11q3ziPUBVpHjJzezgm7wR+MNdsN5yaSttfTxZ0tzPex1L1rvjzNwbs8Gb aaJ+jrRKj0r/gjRaj6XWqhUdI+6q3t7kuuVwyh1hYr2yw10UhkOoJZNqoX/RyNK9ia1X PDzyiknDWiajad4T3Hk3ixAt+fkwBjT43/qqtnnm2dSRfkYERKRVILHsbxdOsdFq/uKO Rjzv7skbx419Vwcyn0jd2T4Ozme1yaRc/Sn4i1qzdSTCSnzov5L4Gx+sqAdzDju/7UDB sbJA6P8D9d9hu4F9ELBEDHor+5sT4mn1rvHGyW+CvMR0f17kllcB1zR1BQh+ekmPwC9R NEDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=C6WJos05; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ck10si2896178ejb.167.2020.09.25.18.03.46; Fri, 25 Sep 2020 18:04:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=C6WJos05; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729844AbgIZBBb (ORCPT + 99 others); Fri, 25 Sep 2020 21:01:31 -0400 Received: from m42-4.mailgun.net ([69.72.42.4]:35257 "EHLO m42-4.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728406AbgIZBBb (ORCPT ); Fri, 25 Sep 2020 21:01:31 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1601082090; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=KYo1MEwXVCcSihTHW3CCwSJaU7l9vAJrjZOB2qJD3BI=; b=C6WJos05KhllinVE+lWxMlPNFQYkFi9yhak9wdFfi18K7lfTOtOV0J5/HPBWzBhR960Rf8UH hZ6p5wsX+ckgYEZJHggg/XyjqQrhV0ajfTdV7d1BNwG005J+H5Wg4i+uc6FQ/0gVRTLjUOCV oaEMNuVYGCmzz4oHCmQ5YBh4dys= X-Mailgun-Sending-Ip: 69.72.42.4 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-west-2.postgun.com with SMTP id 5f6e92d2c7b67146cc8479fb (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sat, 26 Sep 2020 01:01:06 GMT Sender: tingwei=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id B2E50C433A1; Sat, 26 Sep 2020 01:01:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from tingweiz-gv.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tingwei) by smtp.codeaurora.org (Postfix) with ESMTPSA id 01043C433CA; Sat, 26 Sep 2020 01:01:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 01043C433CA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=tingwei@codeaurora.org From: Tingwei Zhang To: Steven Rostedt , Ingo Molnar , Alexander Shishkin , Maxime Coquelin , Alexandre Torgue Cc: Tingwei Zhang , Mathieu Poirier , Suzuki K Poulose , tsoni@codeaurora.org, Sai Prakash Ranjan , Mao Jinlong , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 4/6] tracing: add trace_export support for trace_marker Date: Sat, 26 Sep 2020 09:00:03 +0800 Message-Id: <20200926010005.14689-5-tingwei@codeaurora.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20200926010005.14689-1-tingwei@codeaurora.org> References: <20200926010005.14689-1-tingwei@codeaurora.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the support to route trace_marker buffer to other destination via trace_export. Signed-off-by: Tingwei Zhang Reviewed-by: Steven Rostedt (VMware) Reviewed-by: Alexander Shishkin --- include/linux/trace.h | 1 + kernel/trace/trace.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/linux/trace.h b/include/linux/trace.h index 86033d214972..886a4ffd9d45 100644 --- a/include/linux/trace.h +++ b/include/linux/trace.h @@ -6,6 +6,7 @@ #define TRACE_EXPORT_FUNCTION BIT(0) #define TRACE_EXPORT_EVENT BIT(1) +#define TRACE_EXPORT_MARKER BIT(2) /* * The trace export - an export of Ftrace output. The trace_export diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index a40ee413123c..6048fba2f590 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -271,6 +271,7 @@ static struct trace_export __rcu *ftrace_exports_list __read_mostly; static DEFINE_STATIC_KEY_FALSE(trace_function_exports_enabled); static DEFINE_STATIC_KEY_FALSE(trace_event_exports_enabled); +static DEFINE_STATIC_KEY_FALSE(trace_marker_exports_enabled); static inline void ftrace_exports_enable(struct trace_export *export) { @@ -279,6 +280,9 @@ static inline void ftrace_exports_enable(struct trace_export *export) if (export->flags & TRACE_EXPORT_EVENT) static_branch_inc(&trace_event_exports_enabled); + + if (export->flags & TRACE_EXPORT_MARKER) + static_branch_inc(&trace_marker_exports_enabled); } static inline void ftrace_exports_disable(struct trace_export *export) @@ -288,6 +292,9 @@ static inline void ftrace_exports_disable(struct trace_export *export) if (export->flags & TRACE_EXPORT_EVENT) static_branch_dec(&trace_event_exports_enabled); + + if (export->flags & TRACE_EXPORT_MARKER) + static_branch_dec(&trace_marker_exports_enabled); } static void ftrace_exports(struct ring_buffer_event *event, int flag) @@ -6687,6 +6694,8 @@ tracing_mark_write(struct file *filp, const char __user *ubuf, } else entry->buf[cnt] = '\0'; + if (static_branch_unlikely(&trace_marker_exports_enabled)) + ftrace_exports(event, TRACE_EXPORT_MARKER); __buffer_unlock_commit(buffer, event); if (tt) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project