Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161232AbbBDQnj (ORCPT ); Wed, 4 Feb 2015 11:43:39 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:33288 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966320AbbBDQnh (ORCPT ); Wed, 4 Feb 2015 11:43:37 -0500 Date: Wed, 4 Feb 2015 17:43:27 +0100 From: Peter Zijlstra To: Jiri Olsa Cc: Vince Weaver , mingo@kernel.org, linux-kernel@vger.kernel.org, eranian@gmail.com, mark.rutland@arm.com, torvalds@linux-foundation.org, tglx@linutronix.de Subject: Re: [RFC][PATCH 2/3] perf: Add a bit of paranoia Message-ID: <20150204164327.GL24151@twins.programming.kicks-ass.net> References: <20150123125159.696530128@infradead.org> <20150123125834.150481799@infradead.org> <20150126162639.GA21418@twins.programming.kicks-ass.net> <20150129144749.GC24151@twins.programming.kicks-ass.net> <20150202154240.GG26304@twins.programming.kicks-ass.net> <20150202173232.GG24151@twins.programming.kicks-ass.net> <20150204145136.GB31111@krava.brq.redhat.com> <20150204163336.GC5029@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150204163336.GC5029@twins.programming.kicks-ass.net> 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 Content-Length: 1556 Lines: 41 On Wed, Feb 04, 2015 at 05:33:36PM +0100, Peter Zijlstra wrote: > On Wed, Feb 04, 2015 at 03:51:36PM +0100, Jiri Olsa wrote: > > On Mon, Feb 02, 2015 at 06:32:32PM +0100, Peter Zijlstra wrote: > > > > That looks like tail recursive fun! An irq work that raises and irq work > > > > ad infinitum. Lemme see if I can squash that.. didn't we have something > > > > like this before... /me goes look. > > > > > > > > > Does this make it go away? > > > > > > --- a/kernel/events/core.c > > > +++ b/kernel/events/core.c > > > @@ -4413,6 +4413,8 @@ static void perf_pending_event(struct ir > > > struct perf_event *event = container_of(entry, > > > struct perf_event, pending); > > > > > > + int rctx = perf_swevent_get_recursion_context(); > > > + > > > > hum, you should check the rctx > > > > if (rctx == -1) > > return; > > D'uh, yes. Hmm, that's not actually so, we need to process the irq_work, but we want no further nested swevents. We cannot not do the irq_work; so I think what we want is a conditional put, seeing how if we fail the get, the recursion counter is already raised and nested events won't happen. Now in practise its very unlikely to ever happen; you need nested IRQs for this and most of those have been killed, some legacy drivers might maybe still use them but I forgot. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/