Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755014AbdLTKOp (ORCPT ); Wed, 20 Dec 2017 05:14:45 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:39805 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754824AbdLTKOc (ORCPT ); Wed, 20 Dec 2017 05:14:32 -0500 Date: Wed, 20 Dec 2017 11:14:26 +0100 From: Peter Zijlstra To: Song Liu Cc: rostedt@goodmis.org, mingo@redhat.com, davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, daniel@iogearbox.net, kernel-team@fb.com Subject: Re: [PATCH v5 3/6] perf: implement pmu perf_kprobe Message-ID: <20171220101426.cquh5uv4bgj4bk7y@hirez.programming.kicks-ass.net> References: <20171206224518.3598254-1-songliubraving@fb.com> <20171206224518.3598254-6-songliubraving@fb.com> <20171220100301.bvacqfua4hj2onzq@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171220100301.bvacqfua4hj2onzq@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1524 Lines: 51 On Wed, Dec 20, 2017 at 11:03:01AM +0100, Peter Zijlstra wrote: > On Wed, Dec 06, 2017 at 02:45:15PM -0800, Song Liu wrote: > > @@ -8537,7 +8620,7 @@ static int perf_event_set_filter(struct perf_event *event, void __user *arg) > > char *filter_str; > > int ret = -EINVAL; > > > > - if ((event->attr.type != PERF_TYPE_TRACEPOINT || > > + if ((!perf_event_is_tracing(event) || > > !IS_ENABLED(CONFIG_EVENT_TRACING)) && > > !has_addr_filter(event)) > > return -EINVAL; > > You actually missed an instance later in this same function... fixing > that. @@ -8518,23 +8601,19 @@ perf_event_set_addr_filter(struct perf_e static int perf_event_set_filter(struct perf_event *event, void __user *arg) { - char *filter_str; int ret = -EINVAL; - - if ((event->attr.type != PERF_TYPE_TRACEPOINT || - !IS_ENABLED(CONFIG_EVENT_TRACING)) && - !has_addr_filter(event)) - return -EINVAL; + char *filter_str; filter_str = strndup_user(arg, PAGE_SIZE); if (IS_ERR(filter_str)) return PTR_ERR(filter_str); - if (IS_ENABLED(CONFIG_EVENT_TRACING) && - event->attr.type == PERF_TYPE_TRACEPOINT) - ret = ftrace_profile_set_filter(event, event->attr.config, - filter_str); - else if (has_addr_filter(event)) +#ifdef CONFIG_EVENT_TRACING + if (perf_event_is_tracing(event)) + ret = ftrace_profile_set_filter(event, event->attr.config, filter_str); + else +#endif + if (has_addr_filter(event)) ret = perf_event_set_addr_filter(event, filter_str); kfree(filter_str); Is that right?