Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp141851pxk; Wed, 2 Sep 2020 17:18:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1Fe6s4hgU0LAQEJLKq626kqHbg4pe//KcZrFji/ckE10rFaMQoOx6hwN6WmUGsA8WueE1 X-Received: by 2002:a17:906:3955:: with SMTP id g21mr662446eje.69.1599092339255; Wed, 02 Sep 2020 17:18:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599092339; cv=none; d=google.com; s=arc-20160816; b=GQP//PUjga2GYKJDMfSsa3rxVWu35MpOOvmH1wK4jIeuvFOIjviVUSyoCOG5fpOnnT 17WSdq25DDlBnXMLd6EpxplNkOLVrjGu+Vbdiphe2mcWLjfzx4ipNV7zz+DguhcH1cwj gIaFPh9dHvwm89sE9PZvO1Ak3rheKgfSc1tWVS5SCsEhr2nlYWN2QqIVRnFzP68jOAJ5 Mi9P8jkTlLvsj2zb66ocN/VU2yMiiNBzRXV3sMWJgN+LlS0CMJ401gOZwwvHhEllM2W3 cAmH7Wygf4xPqnQ58AO5RHP1WmFGOpky7leOFMXClp1nTg6KTStm1eIhDoW9GTKvRfEV x8jw== 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=rqK+k/4hBxQdd9EAYLsZsIrOsm2wX+fMy38F+Qs6593j6BjAfrA/hOCHmMFzm8KV+T ytEOlW9BAs+Hcy4exTlgHwWioj5fiTDw4ZN2k/p+kiNmIxjJm3CeOD0WAJb3LP7EWs2S cvynByr0JeSSm+XoPavcfShqTR2vBx/wG+gs/5aJLBgqWMMtHnGfR9Q+ZK5A3o8mkJO6 gRenKZ3G0A4GFIOctFpN3BC2FYvOY+IPTq7vGhb8GiSN+f2RAs/G7DuHE4pKQBA1LyI4 aK3fkFb+uUGuAiALV2MEx4ZgYStrwa1NBZfuXxb9+27vFkPBB/D7oYZgi04XFPgpmel+ q2qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=gk1aQ7Ji; 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 z62si646477ede.173.2020.09.02.17.18.35; Wed, 02 Sep 2020 17:18:59 -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=gk1aQ7Ji; 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 S1727783AbgICARw (ORCPT + 99 others); Wed, 2 Sep 2020 20:17:52 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:33955 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726377AbgICARs (ORCPT ); Wed, 2 Sep 2020 20:17:48 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1599092267; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=J+GkYlJeue+xhm0JgHaodonblQjXsPYjEk8/Vc2LCdw=; b=gk1aQ7JiUiJGLX3vSzzvpZi4ssBC86BCdi2LoAWZFTbi2kiMpoOr2qJa0tmR4Y6lf+azo3JS wMIFmQPtAF9XlSnHhup0qroZVjwYg79ljC2Ny5RMm4DR7Ayu0t9+4OiHOY/5Hdel+K0JsshP N97oKphTtKF5u8hKgPQK6Gu4/M0= X-Mailgun-Sending-Ip: 104.130.122.29 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-n05.prod.us-east-1.postgun.com with SMTP id 5f50362b9f3347551f28739b (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 03 Sep 2020 00:17:47 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id CA28DC433A0; Thu, 3 Sep 2020 00:17:46 +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=unavailable 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 2A74CC433C9; Thu, 3 Sep 2020 00:17:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2A74CC433C9 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 , 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 v3 4/6] tracing: add trace_export support for trace_marker Date: Thu, 3 Sep 2020 08:17:04 +0800 Message-Id: <20200903001706.28147-5-tingwei@codeaurora.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20200903001706.28147-1-tingwei@codeaurora.org> References: <20200903001706.28147-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