Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1913468imu; Thu, 10 Jan 2019 05:18:30 -0800 (PST) X-Google-Smtp-Source: ALg8bN6dMIdUcANZ/GbtcBal6GRp26bdZVSd2/HCrNRxfm36S6gm1g4NnFCiAzWVyAvSacvI+XmW X-Received: by 2002:a63:d157:: with SMTP id c23mr9280547pgj.170.1547126310123; Thu, 10 Jan 2019 05:18:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547126310; cv=none; d=google.com; s=arc-20160816; b=0FPbKuD9Z/idENAv26M3mYmgDJmsJEc3a1n6HGn6XLUlCsuywhTkOn1f9Uj9e05SRg CcqFZEMjrqU2qAAlElbvICARpIoXDcFsVpFBNddI4lerAD16H44XzTR7trdOTTK36uZN xlRL78QQemwqPyGlg85sPHEZNWDtZAsRZbROEZ52thW8Kp3r0I/x1AOpU57mDedntrVw 8IVhSa41UM85npFRMitJqLZBARIEF2JSaxqD/trx511zNbEeiVSslvgtiv012dT+S2eY G0QYACu2zGMm7olFs9uLxCEZmMqBb5yUHIeJJ5y0AD47FggqH0QrRIyMRqXwk4rEREKG 69WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=p8WSDHEmysY9Haq0HiJgD1dVVy9sp5J1q7M+DFtVf0w=; b=ELfYsIJqzUWaZlyOI0ro6geMQLr5mo9buKAUngeVLhbs8i3nh6dLYCFBuqo+12RBh4 dwr8XWrzAa8t5FldlrvdXoEijM0V6ko+5eCVt7Yy35jI4sYOLmA83VADaBK8gZ7adP6X bomD2G3W3CesODDTD4eQeIgGJ6W1kaFThGD2K8GsIog6cT7l94iQoPRcIC/kfkLboEH8 sRnms7Qt51hb+zirlSNf/ClGy3LYdsM6Q5DArUZ8LKGYkHnqRuzvm+RUwS+rAM1JRCsl ALi6XFNtFXtVOMMkOgqk7e5cslQpsaO+eF0AnPWT8aP1bhM4uC/e/FJxC9foGCaQF+01 JB+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d34si19086358pgb.43.2019.01.10.05.18.14; Thu, 10 Jan 2019 05:18:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728779AbfAJNPX (ORCPT + 99 others); Thu, 10 Jan 2019 08:15:23 -0500 Received: from ozlabs.org ([203.11.71.1]:48317 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727847AbfAJNPX (ORCPT ); Thu, 10 Jan 2019 08:15:23 -0500 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 43b61H3QY0z9sLt; Fri, 11 Jan 2019 00:15:15 +1100 (AEDT) From: Michael Ellerman To: Peter Zijlstra , Andrew Murray Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Richard Henderson , Ivan Kokshaysky , Matt Turner , Will Deacon , Mark Rutland , Shawn Guo , Sascha Hauer , Benjamin Herrenschmidt , Paul Mackerras , Thomas Gleixner , Borislav Petkov , Russell King , suzuki.poulose@arm.com, robin.murphy@arm.com, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-alpha@vger.kernel.org, boris.ostrovsky@oracle.com, jgross@suse.com Subject: Re: [PATCH v4 10/13] x86: perf/core: use PERF_PMU_CAP_NO_EXCLUDE for exclude incapable PMUs In-Reply-To: <20190108104841.GD6808@hirez.programming.kicks-ass.net> References: <1546878450-20341-1-git-send-email-andrew.murray@arm.com> <1546878450-20341-11-git-send-email-andrew.murray@arm.com> <20190108104841.GD6808@hirez.programming.kicks-ass.net> Date: Fri, 11 Jan 2019 00:15:13 +1100 Message-ID: <87ef9kslge.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter Zijlstra writes: > On Mon, Jan 07, 2019 at 04:27:27PM +0000, Andrew Murray wrote: >> For drivers that do not support context exclusion let's advertise the >> PERF_PMU_CAP_NOEXCLUDE capability. This ensures that perf will >> prevent us from handling events where any exclusion flags are set. >> Let's also remove the now unnecessary check for exclusion flags. >> >> Signed-off-by: Andrew Murray >> --- >> arch/x86/events/amd/ibs.c | 13 +------------ >> arch/x86/events/amd/power.c | 10 ++-------- >> arch/x86/events/intel/cstate.c | 12 +++--------- >> arch/x86/events/intel/rapl.c | 9 ++------- >> arch/x86/events/intel/uncore_snb.c | 9 ++------- >> arch/x86/events/msr.c | 10 ++-------- >> 6 files changed, 12 insertions(+), 51 deletions(-) > > You (correctly) don't add CAP_NO_EXCLUDE to the main x86 pmu code, but > then you also don't check if it handles all the various exclude options > correctly/consistently. > > Now; I must admit that that is a bit of a maze, but I think we can at > least add exclude_idle and exclude_hv fails in there, nothing uses those > afaict. > > On the various exclude options; they are as follows (IIUC): > > - exclude_guest: we're a HV/host-kernel and we don't want the counter > to run when we run a guest context. > > - exclude_host: we're a HV/host-kernel and we don't want the counter > to run when we run in host context. > > - exclude_hv: we're a guest and don't want the counter to run in HV > context. > > Now, KVM always implies exclude_hv afaict (for guests) On Power it mostly does. There's some host code that can run in real mode (MMU off) and therefore doesn't do a full context switch out of the guest (including the PMU), so that's host code that is running while the guest PMCs are still counting. cheers