Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp120709pxa; Mon, 10 Aug 2020 20:59:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPwCLVQ32BxZio71qoRFJOCiiLAbijliX3mQUQLT8B0xOV+Uoxhcli6XzALc4iP48zgE+v X-Received: by 2002:a50:d2c7:: with SMTP id q7mr23149137edg.61.1597118344704; Mon, 10 Aug 2020 20:59:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597118344; cv=none; d=google.com; s=arc-20160816; b=vUz5w5EvmH8rFgS52lptzcNJ6wkso0GzV3LF0AeFTWKMCOo7SUgFGe6JUdpf7OrZUe bjkvKPvVm8HNiWqlX46a847/mNg7ksegKMjosam5u7k3IJc1SuyTDfDP2G01jRXmAiXM ouBldU3SU9U+++OXbfP5UvXWRcZmL16vqYMFx2+KGWAJ8kZpPJzI/PLscaYIQfs2nJZQ MU31XuEFd99ka5TJlQWxeLedDs0fAVFwOabJ2Sms7Yz89GSIHW1/CN+ajYXCgdWXcyQG yZOHXxqQqP++WacOdxMuieyMfxji3MGJK1KtZryTCGovypMQutKlWXdudGZVGkpDsJ/b 1f+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature; bh=J+GkYlJeue+xhm0JgHaodonblQjXsPYjEk8/Vc2LCdw=; b=oybukIMVG38gWRfTUU7zC+l0vnXrOWWlRB9plyK1FeV5RAqRKh+MU3bntfaMh2/taH r3l33WNbxbhOqQR2UWiQ9pmSUfxd5lJyncX3eXq/q0lF5KMEpRUAS8ZXMRc4dNGW4Bau a+GhKBOtdUuRIqHuE5Z5kjlDxFTYZdf6Sftyuhjm6g9wcjMBWwGROvC1qagbThHzPq8j sME2Q7HMPAipUMBc0jynH8iq7RjaxheO8/ewKfvU5Mb21Wh+zLk81zXYKW5/Px6VpGgB 4b/bDfKxlNZBlJIGhoITTmTFTPKQHAsox/M1acGl8reyxNyxhuGLGc9R1+Il/TRTeikN ZPpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=PV4bHLMN; 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 gv12si11655532ejb.430.2020.08.10.20.58.42; Mon, 10 Aug 2020 20:59:04 -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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=PV4bHLMN; 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 S1728295AbgHKD6A (ORCPT + 99 others); Mon, 10 Aug 2020 23:58:00 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:56858 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728196AbgHKD57 (ORCPT ); Mon, 10 Aug 2020 23:57:59 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1597118279; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=J+GkYlJeue+xhm0JgHaodonblQjXsPYjEk8/Vc2LCdw=; b=PV4bHLMNFS5h/wi6Hol+qm3lXsV68mmmL18qgMup4YVB2itpb8kM9dzzZTqgqaOoqFZVO01G ohH1Yh1qUwzvmT4xFZNzR1gveGD3DWAvnMvO4+jwCEU9ULmJU2uTnsN0VtN7QAijnb9oXznB r1y8Wi+NK8o8+egpWj7PfLHFP60= X-Mailgun-Sending-Ip: 69.72.43.7 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-n11.prod.us-east-1.postgun.com with SMTP id 5f321742d78a2e58330c6777 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 11 Aug 2020 03:57:54 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id A794CC433C6; Tue, 11 Aug 2020 03:57:53 +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=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=ham 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 4EE52C43391; Tue, 11 Aug 2020 03:57:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4EE52C43391 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=none smtp.mailfrom=tingwei@codeaurora.org From: Tingwei Zhang To: Steven Rostedt , Ingo Molnar , Mathieu Poirier , Suzuki K Poulose Cc: Tingwei Zhang , tsoni@codeaurora.org, Sai Prakash Ranjan , Mao Jinlong , linux-kernel@vger.kernel.org, coresight@lists.linaro.org Subject: [PATCH v3 4/6] tracing: add trace_export support for trace_marker Date: Tue, 11 Aug 2020 11:57:24 +0800 Message-Id: <20200811035726.10379-5-tingwei@codeaurora.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20200811035726.10379-1-tingwei@codeaurora.org> References: <20200811035726.10379-1-tingwei@codeaurora.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org 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) --- 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 5a01eeffb254..80b7df68bc0f 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 2f9302a8b322..67993abda394 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) @@ -6648,6 +6655,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