From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966604AbcAZQQr (ORCPT ); Tue, 26 Jan 2016 11:16:47 -0500 Received: from casper.infradead.org ([85.118.1.10]:60943 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964834AbcAZQQp (ORCPT ); Tue, 26 Jan 2016 11:16:45 -0500 Date: Tue, 26 Jan 2016 17:16:37 +0100 From: Peter Zijlstra To: Alexei Starovoitov Cc: Alexander Shishkin , Ingo Molnar , linux-kernel@vger.kernel.org, vince@deater.net, eranian@google.com, Arnaldo Carvalho de Melo , Jiri Olsa , Daniel Borkmann , Wang Nan Subject: Re: [PATCH v2] perf: Synchronously cleanup child events Message-ID: <20160126161637.GF6357@twins.programming.kicks-ass.net> References: <20160118144410.GS6357@twins.programming.kicks-ass.net> <1453216354-9282-1-git-send-email-alexander.shishkin@linux.intel.com> <20160119200558.GC6357@twins.programming.kicks-ass.net> <87lh7hhmnn.fsf@ashishki-desk.ger.corp.intel.com> <20160122123847.GS6357@twins.programming.kicks-ass.net> <20160122194403.GC11338@ast-mbp.thefacebook.com> <20160125114846.GW6357@twins.programming.kicks-ass.net> <20160125145414.GG6375@twins.programming.kicks-ass.net> <20160125210410.GH6375@twins.programming.kicks-ass.net> <20160126045947.GA40151@ast-mbp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160126045947.GA40151@ast-mbp.thefacebook.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 25, 2016 at 08:59:49PM -0800, Alexei Starovoitov wrote: > I think I understand what you're trying to do and > the patch looks good to me. Great, thanks! > As far as BPF side I did the following... > does it match the model you outlined above? Yes, a few comments/questions below. > > Subject: [PATCH ] perf,bpf: convert perf_event_array to use struct file > > Signed-off-by: Alexei Starovoitov Can I take this through the tip/perf tree so that all these changes land together? > diff --git a/kernel/events/core.c b/kernel/events/core.c > index 06ae52e99ac2..2a95e0d2370f 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -8896,21 +8896,17 @@ void perf_event_delayed_put(struct task_struct *task) > WARN_ON_ONCE(task->perf_event_ctxp[ctxn]); > } > > +struct file *perf_event_get(unsigned int fd) > { > + struct file *file; > > + file = fget_raw(fd); fget_raw() to guarantee the return value isn't NULL? afaict the O_PATH stuff does not apply to perf events, so you'd put any fd for which the distinction matters anyway. > + if (file->f_op != &perf_fops) { > + fput(file); > + return ERR_PTR(-EBADF); > + } > > + return file; > }