From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755338AbbFLNKC (ORCPT ); Fri, 12 Jun 2015 09:10:02 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:38854 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752968AbbFLNJ7 (ORCPT ); Fri, 12 Jun 2015 09:09:59 -0400 Date: Fri, 12 Jun 2015 15:09:53 +0200 From: Peter Zijlstra To: Alexander Shishkin Cc: Ingo Molnar , linux-kernel@vger.kernel.org, adrian.hunter@intel.com, x86@kernel.org, hpa@zytor.com, acme@infradead.org Subject: Re: [PATCH 2/2] perf/x86/intel: Fix PMI handling for Intel PT Message-ID: <20150612130953.GA19282@twins.programming.kicks-ass.net> References: <1434024837-9916-1-git-send-email-alexander.shishkin@linux.intel.com> <1434024837-9916-3-git-send-email-alexander.shishkin@linux.intel.com> <20150611140020.GU19282@twins.programming.kicks-ass.net> <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: <87k2v92t0s.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, Jun 12, 2015 at 12:08:35PM +0300, Alexander Shishkin wrote: > From: Alexander Shishkin > Date: Tue, 9 Jun 2015 13:03:26 +0300 > Subject: [PATCH] perf/x86/intel: Fix PMI handling for Intel PT > > Since Intel PT is a separate pmu and is not using any of the x86_pmu > code paths, which means in particular that active_events counter remains > intact when new PT events are created. However, PT uses x86_pmu PMI > handler for its PMI handling needs. The problem here is that the latter > checks active_events and in case of it being zero, exits without calling > the actual x86_pmu.handle_nmi(), which results in unknown NMI errors and > massive data loss for PT. > > The effect is not visible if there are other perf events in the system > at the same time that keep active_events counter non-zero, for instance > if the NMI watchdog is running, so one needs to disable it to reproduce > the problem. > > At the same time, the active_events counter besides doing what the name > suggests also implicitly serves as a pmc hardware and DS area reference > counter. > > This patch adds a separate reference counter for the pmc hardware, leaving > active_events for actually counting the events and makes sure it also > counts PT and BTS events. > > Signed-off-by: Alexander Shishkin Thanks.