Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1952951imc; Tue, 12 Mar 2019 04:14:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKlqTi50IEGydNeT6R/spir7Zu/LgK/5qEX+X/M+MubDuI58MFTLCDALYy6r6QrVMkC/T7 X-Received: by 2002:a17:902:e40a:: with SMTP id ci10mr15709127plb.77.1552389257661; Tue, 12 Mar 2019 04:14:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552389257; cv=none; d=google.com; s=arc-20160816; b=XWKWlKDePEW0jb9pebS+yg8jkVLASRwh9HycLVY7Y/80k8R+MtjTSpM5bLftrjJn0N VXZjqxEA24LWI/U4PX/tQEqhyvf5CWy1Zl8JKP5tJhhXI0zyzmWP/OzIBGbk1C2c0dgh itVCsnkCJuFwX/AyFV35eL2HjjKvY1XFUx2Wdh0PktNBWkiO1DAMh3MPr+boyUApSoPI HAoEEWCjFX/LyoEDk58M8djUkMzqbbYfsSR+fANuAllYlltzX499RF8P8OkIlq4mUWPy meRwo78thZmxt8ImrVdxJCUaatn2bkUI3CfASGkSjZBh9vrsEjzWYjC+w155f1xfTqJJ wwMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=JCdd/14I4dM3aUrsmim2vHdfjtaXeeSlyBQmxaCVDL0=; b=U6zrGlTGNPiUUexm3Suu07eZrRggO/cfry08LX98eoD2mm55ZBY7owOX4Vhbug9emi gywhXP6R9jqV9uMPszlDmpym4lhaOBpfHN8E39GaaB5mLQZrsjkjmvMUdimOPcwMh5uq BKrlftmKUNHAnm2nCgNRPXFOHjezuZOaekgjjD9pRqJfq2/uM3YmUIhhkfPOQrKAlxiH ndUpHc2FN/t3Mxe6X72tRNEfShdV+M4YYsaU/PWKEbLoabF0PDnt54+SO5c/9oQvKFAr viEQ4f4mk7M9bKMTBxaRWttaIps/L6CgB4efoCNa6zN01N438SnYNM7YsbrZ8Qy292t7 PfJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ck9si8491204plb.196.2019.03.12.04.14.02; Tue, 12 Mar 2019 04:14:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726524AbfCLLNc (ORCPT + 99 others); Tue, 12 Mar 2019 07:13:32 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:40594 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725811AbfCLLNc (ORCPT ); Tue, 12 Mar 2019 07:13:32 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 77642374; Tue, 12 Mar 2019 04:13:31 -0700 (PDT) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A98043F59C; Tue, 12 Mar 2019 04:13:29 -0700 (PDT) Date: Tue, 12 Mar 2019 11:13:26 +0000 From: Qais Yousef To: Steven Rostedt , Ingo Molnar Cc: Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , "bpf@vger.kernel.org" Subject: Re: [RFC][PATCH] Export supported trace features in debugfs Message-ID: <20190312111326.nz3wgdy64g2nk44v@e107158-lin.cambridge.arm.com> References: <20190312110437.5977-1-qais.yousef@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190312110437.5977-1-qais.yousef@arm.com> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/12/19 11:07, Qais Yousef wrote: > eBPF tools like bcc-tools have hard time figuring out when features like > raw_tracepoint are supported in the kernel on which we are running. At > the moment a fragile mechanism of matching bpf_find_raw_tracepoint() > function in /proc/kallsyms is used to find out whether raw tracepoints > can be used or not. But when this function was renamed recently to > bpf_get_raw_tracepoint() the tool started to fail to use raw > tracepoints. > > To help in providing a more reliable way to detect features like > RAW_TRACEPOINT, add a new file in trace debugfs to export the supported > features. > > $cat /sys/kernel/debug/tracing/supported_features > RAW_TRACEPOINT > EXAMPLE_FEATURE_1 > EXAMPLE_FEATURE_2 > > Signed-off-by: Qais Yousef > --- > > This is a half baked patch to probe the potential of this solution. > > The breakage mentioned in the commit message is here: > > https://github.com/iovisor/bcc/pull/2241/commits/0f5849187972a50adf0d9eaa8788c11f9fd926ea > > I am not sure what else beside raw_tracepoint makes sense to expose right now. > > kernel/trace/trace.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c > index c4238b441624..daae09238e62 100644 > --- a/kernel/trace/trace.c > +++ b/kernel/trace/trace.c > @@ -6670,6 +6670,28 @@ static const struct file_operations snapshot_raw_fops = { > > #endif /* CONFIG_TRACER_SNAPSHOT */ > > +#define TRACE_FEATURE(feat)__stringify(feat) "\n" > + > +#define TRACE_FEATURES\ > +TRACE_FEATURE(RAW_TRACEPOINT)\ > +TRACE_FEATURE(EXAMPLE_FEATUTE_1)\ > +TRACE_FEATURE(EXAMPLE_FEATUTE_2) > + > +static ssize_t > +tracing_read_trace_features(struct file *filp, char __user *ubuf, > +size_t cnt, loff_t *ppos) > +{ > +char *buf = TRACE_FEATURES; > +size_t len = sizeof(TRACE_FEATURES); > + > +return simple_read_from_buffer(ubuf, cnt, ppos, buf, len); > +} > + > +static const struct file_operations show_trace_features_fops = { > +.read = tracing_read_trace_features, > +.llseek = no_llseek, > +}; > + > static int tracing_buffers_open(struct inode *inode, struct file *filp) > { > struct trace_array *tr = inode->i_private; > @@ -8242,6 +8264,9 @@ static __init int tracer_init_tracefs(void) > &ftrace_update_tot_cnt, &tracing_dyn_info_fops); > #endif > > +trace_create_file("trace_features", 0444, d_tracer, > +NULL, &show_trace_features_fops); > + > create_trace_instances(d_tracer); > > update_tracer_options(&global_trace); > -- > 2.17.1 > > IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. Apologies that shouldn't have appeared. I can resend the patch if it matters. -- Qais Yousef