From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932488AbcDYNKV (ORCPT ); Mon, 25 Apr 2016 09:10:21 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:34133 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932174AbcDYNKU (ORCPT ); Mon, 25 Apr 2016 09:10:20 -0400 Date: Mon, 25 Apr 2016 15:10:13 +0200 From: Peter Zijlstra To: Alexander Shishkin Cc: Ingo Molnar , linux-kernel@vger.kernel.org, vince@deater.net, eranian@google.com, Arnaldo Carvalho de Melo , Mathieu Poirier Subject: Re: [PATCH v1 4/5] perf: Introduce address range filtering Message-ID: <20160425131013.GD3448@twins.programming.kicks-ass.net> References: <1461251823-12416-1-git-send-email-alexander.shishkin@linux.intel.com> <1461251823-12416-5-git-send-email-alexander.shishkin@linux.intel.com> <20160422074555.GB3448@twins.programming.kicks-ass.net> <87zisl8vls.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87zisl8vls.fsf@ashishki-desk.ger.corp.intel.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 Fri, Apr 22, 2016 at 07:19:11PM +0300, Alexander Shishkin wrote: > +static int perf_event_restart(struct perf_event *event) > +{ > + struct stop_event_data sd = { > + .event = event, > + .restart = 1, > + }; > + int ret = 0; > + > + do { > + if (READ_ONCE(event->state) != PERF_EVENT_STATE_ACTIVE) > + return 0; > + > + /* matches smp_wmb() in event_sched_in() */ > + smp_rmb(); > + > + ret = cpu_function_call(READ_ONCE(event->oncpu), > + __perf_event_stop, &sd); > + } while (ret == -EAGAIN); > + > + return ret; > +} A few concerns with this; - if I understand things right; this will loose a bit of trace when people tickle the ioctl(), right? This might want a note of sorts, - you need to handle event->oncpu == -1, - can we race with an actual stop, and accidentally re-enable the thing? If not, this might be a good place for a comment explaining how.