Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5633819imu; Mon, 26 Nov 2018 03:17:33 -0800 (PST) X-Google-Smtp-Source: AJdET5emYlBR0mXcc6XzysxQMLq2HeMNoo1YsqnfnKDenUSm7Xl36iZHU2z9lFbwj9vTI7mie+zT X-Received: by 2002:a62:b9a:: with SMTP id 26mr27734283pfl.196.1543231053560; Mon, 26 Nov 2018 03:17:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543231053; cv=none; d=google.com; s=arc-20160816; b=UotzKGABA/CcS0mZ2Cr/c+ogRTfMKZu7I1WTazA1O16VjtH2cCKLdVlxT9azrcIC2r 185uDBxBnNWplJS+tu7FPQIXhMVGF6qtiY/bFUelQZHNwszNm7+LuBMwAOVcOBsimP72 AOUMkVWArIcJpevlbdEsrEBazrGbIpcRjTS6GLlJdVU+vrg0evrp3uLgRvVSCdnYrpRb 6ceesOV3bB5ZSH5EsCUirYyzdIEV7PNLEa9qNYAC1h4egvvjdhAAw7zjzy+03qpW1/Rc bzpyZagtf3F1mZuT2EBdtompVqrVNSYxA1DPJpMZvMboY94V8X/rVUojMnndVweEYoff mEsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=yRIGxvBuVNj48Jte+Lsel8F0BrVSTZS9+PlaFc5Z5wU=; b=VnQh4S981IW6wzkFvocYauTAkbRvjVI8dPVtLwJE1aQHu/Eop7h4TGUisRCyLGM4f3 bv0JHytvzNQjq0vH2HmrcSqLD+Ik6dUudXGR2yzKRGcL28dXrA4XwK01nZfOSDMx90b0 ycLnjb1W5lCa61jVSmwe9OY20Q0F0T2CKqOnq4/sAaoNGoGHkIdBLp9cwFkMM/z7XBoL X86WAz+E4pb1vwKBNXYnQhH1JP+hzn8qf3EmHWAkWFO/wiZGoKA2wSarGpFWyn8u5kPn KEsfQrwqxlXjeHXnGtjodYl2nIhpkucrs82SgrG+fSNNTAURAFkyLqK2PXzWUa0opiUq GydQ== 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 g33si43240345pgm.426.2018.11.26.03.17.18; Mon, 26 Nov 2018 03:17:33 -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 S1730990AbeKZWIi (ORCPT + 99 others); Mon, 26 Nov 2018 17:08:38 -0500 Received: from foss.arm.com ([217.140.101.70]:33170 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730003AbeKZWIh (ORCPT ); Mon, 26 Nov 2018 17:08:37 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1388B3918; Mon, 26 Nov 2018 03:14:50 -0800 (PST) Received: from e119886-lin.cambridge.arm.com (unknown [10.37.6.11]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2FD493F5AF; Mon, 26 Nov 2018 03:14:45 -0800 (PST) From: Andrew Murray To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Shawn Guo , Sascha Hauer , Will Deacon , Mark Rutland , Benjamin Herrenschmidt , Thomas Gleixner , Borislav Petkov , x86@kernel.org, Ralf Baechle , Paul Burton , James Hogan , Martin Schwidefsky , Heiko Carstens , "David S . Miller" , sparclinux@vger.kernel.org, Michael Ellerman Cc: linux-s390@vger.kernel.org, linux-mips@linux-mips.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-alpha@vger.kernel.org Subject: [PATCH v2 17/20] x86: perf/core: remove unnecessary checks for exclusion Date: Mon, 26 Nov 2018 11:12:33 +0000 Message-Id: <1543230756-15319-18-git-send-email-andrew.murray@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543230756-15319-1-git-send-email-andrew.murray@arm.com> References: <1543230756-15319-1-git-send-email-andrew.murray@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For drivers that do not support context exclusion we do not advertise the PERF_PMU_CAP_EXCLUDE capability. This ensures that perf will prevent us from handling events where any exclusion flags are set. Let's remove the now unnecessary check for exclusion flags. Signed-off-by: Andrew Murray --- arch/x86/events/amd/ibs.c | 12 ------------ arch/x86/events/amd/power.c | 9 +-------- arch/x86/events/intel/cstate.c | 8 +------- arch/x86/events/intel/rapl.c | 8 +------- arch/x86/events/intel/uncore_snb.c | 8 +------- arch/x86/events/msr.c | 8 +------- 6 files changed, 5 insertions(+), 48 deletions(-) diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c index d50bb4d..9e43ef6 100644 --- a/arch/x86/events/amd/ibs.c +++ b/arch/x86/events/amd/ibs.c @@ -253,15 +253,6 @@ static int perf_ibs_precise_event(struct perf_event *event, u64 *config) return -EOPNOTSUPP; } -static const struct perf_event_attr ibs_notsupp = { - .exclude_user = 1, - .exclude_kernel = 1, - .exclude_hv = 1, - .exclude_idle = 1, - .exclude_host = 1, - .exclude_guest = 1, -}; - static int perf_ibs_init(struct perf_event *event) { struct hw_perf_event *hwc = &event->hw; @@ -282,9 +273,6 @@ static int perf_ibs_init(struct perf_event *event) if (event->pmu != &perf_ibs->pmu) return -ENOENT; - if (perf_flags(&event->attr) & perf_flags(&ibs_notsupp)) - return -EINVAL; - if (config & ~perf_ibs->config_mask) return -EINVAL; diff --git a/arch/x86/events/amd/power.c b/arch/x86/events/amd/power.c index 2aefacf..ef80c60 100644 --- a/arch/x86/events/amd/power.c +++ b/arch/x86/events/amd/power.c @@ -136,14 +136,7 @@ static int pmu_event_init(struct perf_event *event) return -ENOENT; /* Unsupported modes and filters. */ - if (event->attr.exclude_user || - event->attr.exclude_kernel || - event->attr.exclude_hv || - event->attr.exclude_idle || - event->attr.exclude_host || - event->attr.exclude_guest || - /* no sampling */ - event->attr.sample_period) + if (event->attr.sample_period) return -EINVAL; if (cfg != AMD_POWER_EVENTSEL_PKG) diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c index 9f8084f..af919c4 100644 --- a/arch/x86/events/intel/cstate.c +++ b/arch/x86/events/intel/cstate.c @@ -280,13 +280,7 @@ static int cstate_pmu_event_init(struct perf_event *event) return -ENOENT; /* unsupported modes and filters */ - if (event->attr.exclude_user || - event->attr.exclude_kernel || - event->attr.exclude_hv || - event->attr.exclude_idle || - event->attr.exclude_host || - event->attr.exclude_guest || - event->attr.sample_period) /* no sampling */ + if (event->attr.sample_period) /* no sampling */ return -EINVAL; if (event->cpu < 0) diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c index 32f3e94..9cb94e6 100644 --- a/arch/x86/events/intel/rapl.c +++ b/arch/x86/events/intel/rapl.c @@ -397,13 +397,7 @@ static int rapl_pmu_event_init(struct perf_event *event) return -EINVAL; /* unsupported modes and filters */ - if (event->attr.exclude_user || - event->attr.exclude_kernel || - event->attr.exclude_hv || - event->attr.exclude_idle || - event->attr.exclude_host || - event->attr.exclude_guest || - event->attr.sample_period) /* no sampling */ + if (event->attr.sample_period) /* no sampling */ return -EINVAL; /* must be done before validate_group */ diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c index 8527c3e..26441eb 100644 --- a/arch/x86/events/intel/uncore_snb.c +++ b/arch/x86/events/intel/uncore_snb.c @@ -374,13 +374,7 @@ static int snb_uncore_imc_event_init(struct perf_event *event) return -EINVAL; /* unsupported modes and filters */ - if (event->attr.exclude_user || - event->attr.exclude_kernel || - event->attr.exclude_hv || - event->attr.exclude_idle || - event->attr.exclude_host || - event->attr.exclude_guest || - event->attr.sample_period) /* no sampling */ + if (event->attr.sample_period) /* no sampling */ return -EINVAL; /* diff --git a/arch/x86/events/msr.c b/arch/x86/events/msr.c index b4771a6..c4fa5d4 100644 --- a/arch/x86/events/msr.c +++ b/arch/x86/events/msr.c @@ -160,13 +160,7 @@ static int msr_event_init(struct perf_event *event) return -ENOENT; /* unsupported modes and filters */ - if (event->attr.exclude_user || - event->attr.exclude_kernel || - event->attr.exclude_hv || - event->attr.exclude_idle || - event->attr.exclude_host || - event->attr.exclude_guest || - event->attr.sample_period) /* no sampling */ + if (event->attr.sample_period) /* no sampling */ return -EINVAL; if (cfg >= PERF_MSR_EVENT_MAX) -- 2.7.4