From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753273AbbFXNRM (ORCPT ); Wed, 24 Jun 2015 09:17:12 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:40944 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753183AbbFXNRG (ORCPT ); Wed, 24 Jun 2015 09:17:06 -0400 Date: Wed, 24 Jun 2015 15:16:48 +0200 From: Peter Zijlstra To: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, mingo@kernel.org, alexander.shishkin@linux.intel.com, hpa@zytor.com, bp@alien8.de, brgerst@gmail.com, luto@amacapital.net, oleg@redhat.com, akpm@linux-foundation.org, tglx@linutronix.de, dvlasenk@redhat.com Cc: linux-tip-commits@vger.kernel.org Subject: Re: [tip:perf/urgent] perf/x86/intel: Fix PMI handling for Intel PT Message-ID: <20150624131648.GM3644@twins.programming.kicks-ass.net> References: <87k2v92t0s.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Jun 19, 2015 at 10:58:36AM -0700, tip-bot for Alexander Shishkin wrote: > @@ -371,12 +373,24 @@ int x86_add_exclusive(unsigned int what) > > out: > mutex_unlock(&pmc_reserve_mutex); > + > + /* > + * Assuming that all exclusive events will share the PMI handler > + * (which checks active_events for whether there is work to do), > + * we can bump active_events counter right here, except for > + * x86_lbr_exclusive_lbr events that go through x86_pmu_event_init() > + * path, which already bumps active_events for them. > + */ > + if (!ret && what != x86_lbr_exclusive_lbr) > + atomic_inc(&active_events); > + > return ret; > } > > void x86_del_exclusive(unsigned int what) > { > atomic_dec(&x86_pmu.lbr_exclusive[what]); > + atomic_dec(&active_events); > } > This, conditional inc, unconditional dec. This leads to active_events == 0 even though there's still the NMI watchdog active generating NMIs. I would say, drop the condition on inc, double inc isn't a problem as long as we match with a double dec and that results in simpler code too.