Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4203444pxb; Mon, 8 Feb 2021 10:17:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwrJNDIaLotihHVXClh/Y0zQwMglNrnTe0w3gVlKuIGihwstVQmRvg6WjHcHNjHItYqKOp6 X-Received: by 2002:a17:906:1389:: with SMTP id f9mr18406583ejc.442.1612808219850; Mon, 08 Feb 2021 10:16:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612808219; cv=none; d=google.com; s=arc-20160816; b=j1sXZ8M9si1A3FTYH69MwuVddQI4ivqynuCEw8YDoRfS8g77tUykw8g5ePvOqYBbF3 5znrNovfupL1wDyTZvfupXemZFdDAnJHn246x/gx2lKs5H6qrfjuOBVxZ/hgEPT55O3V mOELe4D+giCA7sLYwKtrrR5I3UVywFjKfaXpY10i5k5GC3FEPN+fyzlw3ZumLw7wiUfK IXp+R3HaGiKZHrOTIi9Y4aR/9cRt3XH1PxsmYsOmpFHtaOtGjMIV8KincDHfw4fxDFP2 VwjvY5Jgn+WgDg1oXU3rQPJMM489x9n80IstCM9h7mtMpZ3GLRVJXHKEYhSl+6YgUGfI oDFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=xEytctUXGKbLrzXpZDmPpN4/PDmYKHpgOnV4oHRta0w=; b=iAy8b7JLuxraj3EI0cVYCjdoxGGlRVmHUSgRBKn06Owc4WrUZMsN0CmOC0fJbsIRlN +yP4n5V1LBMclArsFMLCUVLoomZdrdhEQudPcp+m6VjuH2TctS+w9DQwf2b57CnaYxPI MtFOw6uPF9TRK0+ACvenVuVzqYdwZEEOc6fJxYNd/kcA+lOzjZ6166yaY5k/+0fMHFQz ZH5DlpuC3HTQBjx1FoIPKluL7B+/cRM1OF6yb1QkgwtypBS8KuBgoP1mKrv2NnWJotf5 7OPn40sQEKn6nnadNo7sAY9iWe4XM6j2FL5VI6g/f438kBmNbuXK7CTWhgH3SQSZWMu2 u8Zg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hp6si11136213ejc.532.2021.02.08.10.16.35; Mon, 08 Feb 2021 10:16:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235495AbhBHSPw (ORCPT + 99 others); Mon, 8 Feb 2021 13:15:52 -0500 Received: from mga14.intel.com ([192.55.52.115]:62838 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232292AbhBHPlL (ORCPT ); Mon, 8 Feb 2021 10:41:11 -0500 IronPort-SDR: Mf0cKIsbHnDOvEdzh89j5VCuhPG1AuMng5Iw1OFAAL4+J3Rx+EaJWuvDPDgKisoSs0ZSISbE+w maZk651lBXZg== X-IronPort-AV: E=McAfee;i="6000,8403,9889"; a="180951979" X-IronPort-AV: E=Sophos;i="5.81,162,1610438400"; d="scan'208";a="180951979" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2021 07:30:22 -0800 IronPort-SDR: BlckNCgQhV4DeGBJcg3Bvz/m15JRa+JIeFYlJG0OnXuU4q27Y2wmBHqZv5CZMVIYOgSuHEUlYd 9EtRSXe7MPAQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,162,1610438400"; d="scan'208";a="358820724" Received: from otc-lr-04.jf.intel.com ([10.54.39.41]) by orsmga003.jf.intel.com with ESMTP; 08 Feb 2021 07:30:22 -0800 From: kan.liang@linux.intel.com To: peterz@infradead.org, acme@kernel.org, mingo@kernel.org, linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, bp@alien8.de, namhyung@kernel.org, jolsa@redhat.com, ak@linux.intel.com, yao.jin@linux.intel.com, alexander.shishkin@linux.intel.com, adrian.hunter@intel.com, Kan Liang Subject: [PATCH 19/49] perf/x86: Support filter_match callback Date: Mon, 8 Feb 2021 07:25:16 -0800 Message-Id: <1612797946-18784-20-git-send-email-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1612797946-18784-1-git-send-email-kan.liang@linux.intel.com> References: <1612797946-18784-1-git-send-email-kan.liang@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kan Liang Implement filter_match callback for X86, which check whether an event is schedulable on the current CPU. Reviewed-by: Andi Kleen Signed-off-by: Kan Liang --- arch/x86/events/core.c | 10 ++++++++++ arch/x86/events/perf_event.h | 1 + 2 files changed, 11 insertions(+) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 4d9dd83c..b68d38a 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -2613,6 +2613,14 @@ static int x86_pmu_aux_output_match(struct perf_event *event) return 0; } +static int x86_pmu_filter_match(struct perf_event *event) +{ + if (x86_pmu.filter_match) + return x86_pmu.filter_match(event); + + return 1; +} + static struct pmu pmu = { .pmu_enable = x86_pmu_enable, .pmu_disable = x86_pmu_disable, @@ -2640,6 +2648,8 @@ static struct pmu pmu = { .check_period = x86_pmu_check_period, .aux_output_match = x86_pmu_aux_output_match, + + .filter_match = x86_pmu_filter_match, }; void arch_perf_update_userpage(struct perf_event *event, diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index 84d629d..5759f96 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -900,6 +900,7 @@ struct x86_pmu { */ unsigned long hybrid_pmu_bitmap; struct x86_hybrid_pmu hybrid_pmu[X86_HYBRID_PMU_MAX_INDEX]; + int (*filter_match)(struct perf_event *event); }; struct x86_perf_task_context_opt { -- 2.7.4