Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5631802imu; Mon, 26 Nov 2018 03:15:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/UYQdFmLeC5UEvHrvDjD2eTcL5Dns4AaQ3eA0af9ivdY1z/VUTuPlNIp5AjrPsRUXxOmISQ X-Received: by 2002:a17:902:8604:: with SMTP id f4-v6mr27019275plo.206.1543230949485; Mon, 26 Nov 2018 03:15:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543230949; cv=none; d=google.com; s=arc-20160816; b=C1982HJFbmliWR+Xh+XBN9FmjiQdhnZQs4RrQPM6/fdIOLV4k5ZZyb43AZ9H313Uo2 rzXZXwMX1ZxyTEgeRR7l8teJqJZygJFL2AFv4HnAHrMj4rNGknsb2/8O56yknOpOuA0T /IjZEeAGOOgEpbz8pRTc93dlDFKCz8UMH6Eq4fPDfC8UgEX/BKGp7NV+wjXNgGvG6ocY t7aNuiLdpBze9bDiHzcf7OOh7tCC9BioK63xUfW8+gvh93B9zkv1sRs+12QFbyKB6onY 4uuWQEds7LSuKl932TP8vSJbDnQlLWiq8ZYLS5EbTf8DadRPh8sKOi1MYnxevOC6deyr yDFw== 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=Ii3uspVRvUxQmK+uHeos0M4o7BDxKV0Q+UIguUMztJ0=; b=fjIZWSN25DPwGxv1LZVnSPUoaIdj2YVOQFMb0Lcr9yt5i73hniW8RlAOPnFv4HwIX+ ST2R+5ePxX/8yuJu5JVbljDaIHPW1bVVabhg8KnZ9KklauPis1NlW9V81mPOvaMRISDz nedzvj5nGhvQLL5krVMjQl7zucPhwiUYv3mvtYbDoqFi6Awbks8hCOL19wP+xyuPwMGJ gikEKoHnrVNWmwzHgnOuKrsOJK6iJqEKDR/JxoUxizlMZXBuubHMvo35Xj7xeSlE7joK banECyx1DX97V5nfQn7VRi3E5lszXDCWCP9qPgYieJ4B8UE3ZcW9MIPfpB2bGUc/A+1t PQgA== 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 s4si45275235plr.306.2018.11.26.03.15.35; Mon, 26 Nov 2018 03:15:49 -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 S1730874AbeKZWIC (ORCPT + 99 others); Mon, 26 Nov 2018 17:08:02 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:32886 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729507AbeKZWIC (ORCPT ); Mon, 26 Nov 2018 17:08:02 -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 C2B4A3916; Mon, 26 Nov 2018 03:14:14 -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 186F03F5AF; Mon, 26 Nov 2018 03:14:09 -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 10/20] drivers/perf: perf/core: remove unnecessary checks for exclusion Date: Mon, 26 Nov 2018 11:12:26 +0000 Message-Id: <1543230756-15319-11-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. This change means that qcom_{l2|l3}_pmu will now also indicate that they do not support exclude_{host|guest} and that xgene_pmu does not also support exclude_idle and exclude_hv. Note that for qcom_l2_pmu we now implictly return -EINVAL instead of -EOPNOTSUPP. This change will result in the perf userspace utility retrying the perf_event_open system call with fallback event attributes that do not fail. Signed-off-by: Andrew Murray --- drivers/perf/qcom_l2_pmu.c | 8 -------- drivers/perf/qcom_l3_pmu.c | 7 ------- drivers/perf/xgene_pmu.c | 5 ----- 3 files changed, 20 deletions(-) diff --git a/drivers/perf/qcom_l2_pmu.c b/drivers/perf/qcom_l2_pmu.c index 842135c..518e18c 100644 --- a/drivers/perf/qcom_l2_pmu.c +++ b/drivers/perf/qcom_l2_pmu.c @@ -509,14 +509,6 @@ static int l2_cache_event_init(struct perf_event *event) return -EOPNOTSUPP; } - /* We cannot filter accurately so we just don't allow it. */ - if (event->attr.exclude_user || event->attr.exclude_kernel || - event->attr.exclude_hv || event->attr.exclude_idle) { - dev_dbg_ratelimited(&l2cache_pmu->pdev->dev, - "Can't exclude execution levels\n"); - return -EOPNOTSUPP; - } - if (((L2_EVT_GROUP(event->attr.config) > L2_EVT_GROUP_MAX) || ((event->attr.config & ~L2_EVT_MASK) != 0)) && (event->attr.config != L2CYCLE_CTR_RAW_CODE)) { diff --git a/drivers/perf/qcom_l3_pmu.c b/drivers/perf/qcom_l3_pmu.c index 2dc63d6..e28bd2f 100644 --- a/drivers/perf/qcom_l3_pmu.c +++ b/drivers/perf/qcom_l3_pmu.c @@ -495,13 +495,6 @@ static int qcom_l3_cache__event_init(struct perf_event *event) return -ENOENT; /* - * There are no per-counter mode filters in the PMU. - */ - if (event->attr.exclude_user || event->attr.exclude_kernel || - event->attr.exclude_hv || event->attr.exclude_idle) - return -EINVAL; - - /* * Sampling not supported since these events are not core-attributable. */ if (hwc->sample_period) diff --git a/drivers/perf/xgene_pmu.c b/drivers/perf/xgene_pmu.c index 0e31f13..bdc55de 100644 --- a/drivers/perf/xgene_pmu.c +++ b/drivers/perf/xgene_pmu.c @@ -914,11 +914,6 @@ static int xgene_perf_event_init(struct perf_event *event) if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK) return -EINVAL; - /* SOC counters do not have usr/os/guest/host bits */ - if (event->attr.exclude_user || event->attr.exclude_kernel || - event->attr.exclude_host || event->attr.exclude_guest) - return -EINVAL; - if (event->cpu < 0) return -EINVAL; /* -- 2.7.4