Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3127019pxj; Mon, 10 May 2021 19:44:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx05zJYKduUFfo2M0U/9d3V4y0z9RuvV7VU3f3n8UTCZcLsZEYkd+0lCDrQFnwJUctqDL65 X-Received: by 2002:a17:907:7ba5:: with SMTP id ne37mr29191072ejc.113.1620701096815; Mon, 10 May 2021 19:44:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620701096; cv=none; d=google.com; s=arc-20160816; b=d6BGdVaraE95CdFhD+n5yjYVeHJrfecVnnXV7DgBtdYhFqnVpJ5zzy1MZt+uhhQBhO u6oZzXyvXFXLkI8pROMw2PP7CyyPRTr24cbWPzYRZ1bdXNhfxgMpq7oQ9+G2blvG1/64 8yXflUHINmtCY1WlOI7VRu4JnOWQT5uwg81YUTAZ719aHW2gR9vXZCJ6Rwns2/F5Pmim WuNQmkq9vSB1thgtjjYgqGjAPi3RI7m+xF0G+fipCZtNzy81R/LIXPdQGfpLIwq3UtLz bud0yBYbWh+uaC4sqzixdDiwoGIL23sxG6lFTXNs9yUuGTcWq7mH6vTExpyJ5K6tna23 nY4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=MTkQUs20Gzz7NbHRO1aKXlbzYvJkE2jaa3EbUqL0wkU=; b=c7RCq6xfhxPBVIC8hRul0rhn1caPo1EMTvfXXTDUpu5KTPx9IJeWJh2vQmVulisYLW aJSCfolPVFzvdchg/6/W3QSPy3Rr/IRdY/AbCDlrQ+dI/eASx1IpU1UIeTj9537m8Mcg Uvn3Ei7hPozEL76/+PCBnTExGchQrwcl8BQnbOMzlRlHQvc3Lap2TKeieeaoJcXYBE+s X5+c0+XjOmvkrP6Z3Hrm/2WW7z+9VujmDLEuzsYVhna7QcxYA1w5YKPCXYwz36V8oQ4e pxhgEivbByxfONnjDD1D1zl+rTLLOkOlUQ7Z9oERp3bqEdEyCfwHpM2/YjJAeHRBnn/2 LpsA== 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 s15si3305605eji.457.2021.05.10.19.44.22; Mon, 10 May 2021 19:44:56 -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 S230016AbhEKCoL (ORCPT + 99 others); Mon, 10 May 2021 22:44:11 -0400 Received: from mga03.intel.com ([134.134.136.65]:7532 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229736AbhEKCoI (ORCPT ); Mon, 10 May 2021 22:44:08 -0400 IronPort-SDR: 6qQcynzDX3TvTIyIX1vV4daM+qtL4XQl+DUaalGr3PEPVQyyFEGXrJJp484AdC/cqMEPMtcFJ+ hvevsuQZ71Jg== X-IronPort-AV: E=McAfee;i="6200,9189,9980"; a="199391169" X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="199391169" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2021 19:43:02 -0700 IronPort-SDR: cANaMB5eRdMayD4i2mA06SvvDqq8xbutLBgNJ8i2HhsOfrxMwbjYUa/7yG1PTIj8ad92zPfpUu Z9TQLANSXbkg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="468591571" Received: from clx-ap-likexu.sh.intel.com ([10.239.48.108]) by fmsmga002.fm.intel.com with ESMTP; 10 May 2021 19:42:59 -0700 From: Like Xu To: Peter Zijlstra , Paolo Bonzini Cc: Borislav Petkov , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , weijiang.yang@intel.com, Kan Liang , ak@linux.intel.com, wei.w.wang@intel.com, eranian@google.com, liuxiangdong5@huawei.com, linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org, Like Xu Subject: [PATCH v6 01/16] perf/x86/intel: Add EPT-Friendly PEBS for Ice Lake Server Date: Tue, 11 May 2021 10:41:59 +0800 Message-Id: <20210511024214.280733-2-like.xu@linux.intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210511024214.280733-1-like.xu@linux.intel.com> References: <20210511024214.280733-1-like.xu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The new hardware facility supporting guest PEBS is only available on Intel Ice Lake Server platforms for now. KVM will check this field through perf_get_x86_pmu_capability() instead of hard coding the cpu models in the KVM code. If it is supported, the guest PBES capability will be exposed to the guest. Signed-off-by: Like Xu --- arch/x86/events/core.c | 1 + arch/x86/events/intel/core.c | 1 + arch/x86/events/perf_event.h | 3 ++- arch/x86/include/asm/perf_event.h | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 8e509325c2c3..ccbe5b239c22 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -2958,5 +2958,6 @@ void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap) cap->bit_width_fixed = x86_pmu.cntval_bits; cap->events_mask = (unsigned int)x86_pmu.events_maskl; cap->events_mask_len = x86_pmu.events_mask_len; + cap->pebs_vmx = x86_pmu.pebs_vmx; } EXPORT_SYMBOL_GPL(perf_get_x86_pmu_capability); diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 2521d03de5e0..b6e45ee10e16 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -6028,6 +6028,7 @@ __init int intel_pmu_init(void) case INTEL_FAM6_ICELAKE_X: case INTEL_FAM6_ICELAKE_D: + x86_pmu.pebs_vmx = 1; pmem = true; fallthrough; case INTEL_FAM6_ICELAKE_L: diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index 27fa85e7d4fd..6a0f768c5330 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -796,7 +796,8 @@ struct x86_pmu { pebs_prec_dist :1, pebs_no_tlb :1, pebs_no_isolation :1, - pebs_block :1; + pebs_block :1, + pebs_vmx :1; int pebs_record_size; int pebs_buffer_size; int max_pebs_events; diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h index 544f41a179fb..6a6e707905be 100644 --- a/arch/x86/include/asm/perf_event.h +++ b/arch/x86/include/asm/perf_event.h @@ -192,6 +192,7 @@ struct x86_pmu_capability { int bit_width_fixed; unsigned int events_mask; int events_mask_len; + unsigned int pebs_vmx :1; }; /* -- 2.31.1