Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp869069ybh; Tue, 21 Jul 2020 09:47:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAnEHTk927mXTT4feTYMr6E8/4M4EbL0EcWjyoqGEU85eYGBSXq05vGtmFx6lBh+yncGy0 X-Received: by 2002:a17:906:c083:: with SMTP id f3mr24992344ejz.530.1595350020041; Tue, 21 Jul 2020 09:47:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595350020; cv=none; d=google.com; s=arc-20160816; b=uSZfV2BG5/1kvX3IvwrYv2fktkbfK4AuB6rZ+/Bf//+pqExvWbGzMusianQu/ctUZB 0U0Zt0Aynifbj3bSJjdZisC29lfoDEKWNoYTSDIlMGeWc5U3CJcprmY3+pE/D4PyEP9a t1k+1cVV46Ai2nfYGKyvSin7z6ELH/uCtyV24yvbfn3fX1Z455W0jiflPqIY0pwaRjph NI8s8ogQoOdpY5ynOGQwroJVYUYItUe9sl415F1WtLdbbGCvujLI/3Fd37HBUFrUfKwK 8l0/liq/Ab6KJOcH0T57ksWZ3kpyZi4T0v9WwvoU5EkcY7zuAMEIkO/N++BU9kFcTPjh B4EA== 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:subject:cc:to:from:date; bh=eqAsKylHVL0ZoERjm/jc1Q6lZr22cJgkMbZ45upRuMw=; b=zwXfQSycMC0Leu+76nKQXOl4bKZZ69NY2q5nZ4GrRyN8hrMqYlcYz3g7nhZG3JUxYP P2CVKx3qtTA7Vi6cln0fatAStlzFcIAxbjbRRfZowcglnZOa/21zWldCoICqRp32I42R Jh3qorJDbNEgJDRzHK+PGA7V98+WyHmWbcH9Gxxa6nA3jZ2RK9ePhqIzg+HKR4JBwbpB wCkDemw5LlIFOKfSXKHguGTv0GpydrGupp3J5gInJXUeP+J6L6sUC+F+NBBShzvymb8W 0yLz5Lvtq3mQ0sa1FBYwo3n/yMRn1dkwz7RjOYE80T9Mkg6v42Fzt7Pidw8b+MW0vYlB 5H3g== ARC-Authentication-Results: i=1; mx.google.com; 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 nw19si12854198ejb.264.2020.07.21.09.46.37; Tue, 21 Jul 2020 09:47:00 -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; 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 S1730876AbgGUQnq (ORCPT + 99 others); Tue, 21 Jul 2020 12:43:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:43648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730391AbgGUQno (ORCPT ); Tue, 21 Jul 2020 12:43:44 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BA78C207BB; Tue, 21 Jul 2020 16:43:43 +0000 (UTC) Date: Tue, 21 Jul 2020 12:43:42 -0400 From: Steven Rostedt To: Tingwei Zhang Cc: Ingo Molnar , tsoni@codeaurora.org, Sai Prakash Ranjan , Mao Jinlong , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] tracing: add trace_export support for event trace Message-ID: <20200721124342.422ee784@oasis.local.home> In-Reply-To: <20200721123733.1a87568a@oasis.local.home> References: <20200720022117.9375-1-tingwei@codeaurora.org> <20200720022117.9375-3-tingwei@codeaurora.org> <20200721123733.1a87568a@oasis.local.home> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 21 Jul 2020 12:37:33 -0400 Steven Rostedt wrote: > On Mon, 20 Jul 2020 10:21:15 +0800 > Tingwei Zhang wrote: > > > Only function traces can be exported to other destinations currently. > > This patch exports event trace as well. > > > > Signed-off-by: Tingwei Zhang > > --- > > kernel/trace/trace.c | 24 +++++++++++++----------- > > 1 file changed, 13 insertions(+), 11 deletions(-) > > > > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c > > index bb62269724d5..aef6330836e2 100644 > > --- a/kernel/trace/trace.c > > +++ b/kernel/trace/trace.c > > @@ -2697,17 +2697,6 @@ int tracepoint_printk_sysctl(struct ctl_table *table, int write, > > return ret; > > } > > > > -void trace_event_buffer_commit(struct trace_event_buffer *fbuffer) > > -{ > > - if (static_key_false(&tracepoint_printk_key.key)) > > - output_printk(fbuffer); > > - > > - event_trigger_unlock_commit_regs(fbuffer->trace_file, fbuffer->buffer, > > - fbuffer->event, fbuffer->entry, > > - fbuffer->flags, fbuffer->pc, fbuffer->regs); > > -} > > -EXPORT_SYMBOL_GPL(trace_event_buffer_commit); > > - > > Please move the ftrace_exports routines up, instead of moving the > trace_event_buffer_commit() down. As it fits better where it is (next > to the other buffer_commit code). > > -- Steve > > > > /* > > * Skip 3: > > * > > @@ -2868,6 +2857,19 @@ int unregister_ftrace_export(struct > > trace_export *export) } > > EXPORT_SYMBOL_GPL(unregister_ftrace_export); > > > > +void trace_event_buffer_commit(struct trace_event_buffer *fbuffer) > > +{ > > + if (static_key_false(&tracepoint_printk_key.key)) > > + output_printk(fbuffer); > > + > > + if (static_branch_unlikely(&ftrace_exports_enabled)) > > + ftrace_exports(fbuffer->event); I would also recommend making each static branch a separate variable. That way you could pick and choose what you want to enable. If you only want events, and functions are being traced, it will add a bit of overhead to handle the functions to just ignore them. That is: ftrace_exports_enabled, trace_event_exports_enabled, trace_marker_exports_enabled. -- Steve > > + event_trigger_unlock_commit_regs(fbuffer->trace_file, > > fbuffer->buffer, > > + fbuffer->event, fbuffer->entry, > > + fbuffer->flags, fbuffer->pc, > > fbuffer->regs); +} > > +EXPORT_SYMBOL_GPL(trace_event_buffer_commit); > > + > > void > > trace_function(struct trace_array *tr, > > unsigned long ip, unsigned long parent_ip, unsigned > > long flags, >