Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1829186pxb; Mon, 12 Apr 2021 07:40:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8v9X5V0/nW9uVMLk1dRSXlJZsdg7C9E7Bpv1+COY/QiuYEPGkiWn/ZXUX/7U6aMf1y5bI X-Received: by 2002:a05:6402:1a2b:: with SMTP id be11mr21356059edb.304.1618238416414; Mon, 12 Apr 2021 07:40:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618238416; cv=none; d=google.com; s=arc-20160816; b=QYN9iGA2KYidqtQBTAcR0tPpSZlj6kmgMr0uGa2WPUI0Umy7Tqj+OtkwyBJtKvWQAp j6CS8e+eQ0MVWJ2LQX4Z6xjolKIgsuVSbe3apl+itMsEhz0aIkhx/w5ECL/Jwdx3tW3U lQ0WlE7OYPd7Cq3zXsPsupwxjQuXNMVbxq5UGfmjT7MgV2iUJwkrWVgBt7YUfVI1oEEN lXNpaURy6KbYRdjyCBsr7Um/MBB9EKuHAXjkA87ypoTmOjN5PZLCLXNTTkzTlvwIH1zS 9qjvSPtLokNP0igbpUN/oh3RPZ855ikJgYSeoKwVWbn1iVeFaWx/svcPqsezzYOOR4MQ oNPg== 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=TNeMxlYn8b2AHp/lKdOMdfbqHR+TiDF9s81Y1A64P4c=; b=k7oz0KSvlIG1T21pxj6KhT/yczMIErfVd7frKISSmv5aChDXjaXXUkpXCyMladTbOH J/PyCeE3ERCguv7QUS780bncRCnLzBgVUibKFnU1wSbzw6DRKnMBTOCX9U9SdUR3tvzh UqjZ3/vqxnPhyztVJpKEyzL9XSXQzrVCdMle6vIASru7djxsyMDXfcJ/B6Oqx4+pVExl CKDSbuhfj4wZyBWVIZJkExvU8yHKg3rC5mE6Tf1PmUPBXSIQQV22fJmeIVQg2yEk17Kt w3tPOhpCz36f/DtoUWMh+JgkNcwAdG5zik9XEUV3W4LV/dzJflBV/k0qDJzPw5RDQjis x3wA== 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 k16si8027827ejb.318.2021.04.12.07.39.52; Mon, 12 Apr 2021 07:40:16 -0700 (PDT) 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 S242394AbhDLOix (ORCPT + 99 others); Mon, 12 Apr 2021 10:38:53 -0400 Received: from mga09.intel.com ([134.134.136.24]:29177 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242365AbhDLOik (ORCPT ); Mon, 12 Apr 2021 10:38:40 -0400 IronPort-SDR: uoV7CycI3xoTKPGr6qwP5JhleGTvzYAmlmWnJE5UoC8iNdvl0sI26mCdn/oddcQEnm52rkrThh I7qFxlRhM/Og== X-IronPort-AV: E=McAfee;i="6200,9189,9952"; a="194317947" X-IronPort-AV: E=Sophos;i="5.82,216,1613462400"; d="scan'208";a="194317947" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2021 07:38:22 -0700 IronPort-SDR: bXNubRSIWSFH7FXMrYhOcyVXv7IClMYjxGLIIiflqxMhA91NHH4P0Wsyz6AObqxt6Oni70eeJO a7ydwC9kQdCA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,216,1613462400"; d="scan'208";a="398392764" Received: from otc-lr-04.jf.intel.com ([10.54.39.41]) by orsmga002.jf.intel.com with ESMTP; 12 Apr 2021 07:38:22 -0700 From: kan.liang@linux.intel.com To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org Cc: acme@kernel.org, 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, ricardo.neri-calderon@linux.intel.com, Kan Liang Subject: [PATCH V6 07/25] perf/x86: Hybrid PMU support for unconstrained Date: Mon, 12 Apr 2021 07:30:47 -0700 Message-Id: <1618237865-33448-8-git-send-email-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1618237865-33448-1-git-send-email-kan.liang@linux.intel.com> References: <1618237865-33448-1-git-send-email-kan.liang@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kan Liang The unconstrained value depends on the number of GP and fixed counters. Each hybrid PMU should use its own unconstrained. Suggested-by: Peter Zijlstra (Intel) Signed-off-by: Kan Liang --- arch/x86/events/intel/core.c | 2 +- arch/x86/events/perf_event.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 3ea0126e..4cfc382f 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -3147,7 +3147,7 @@ x86_get_event_constraints(struct cpu_hw_events *cpuc, int idx, } } - return &unconstrained; + return &hybrid_var(cpuc->pmu, unconstrained); } static struct event_constraint * diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index df3689b..93d6479 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -639,6 +639,7 @@ struct x86_hybrid_pmu { int max_pebs_events; int num_counters; int num_counters_fixed; + struct event_constraint unconstrained; }; static __always_inline struct x86_hybrid_pmu *hybrid_pmu(struct pmu *pmu) @@ -659,6 +660,16 @@ extern struct static_key_false perf_is_hybrid; __Fp; \ })) +#define hybrid_var(_pmu, _var) \ +(*({ \ + typeof(&_var) __Fp = &_var; \ + \ + if (is_hybrid() && (_pmu)) \ + __Fp = &hybrid_pmu(_pmu)->_var; \ + \ + __Fp; \ +})) + /* * struct x86_pmu - generic x86 pmu */ -- 2.7.4