Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp103789rdb; Tue, 31 Oct 2023 01:59:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHBrF1u4xS4cLLHmGyXIu+sZCUoYcBqyu/C8FPUfWt7+unQcVmNU6gg4NKVRkR67lXpLRoT X-Received: by 2002:a17:902:e848:b0:1cc:4559:ff with SMTP id t8-20020a170902e84800b001cc455900ffmr6830852plg.13.1698742741638; Tue, 31 Oct 2023 01:59:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698742741; cv=none; d=google.com; s=arc-20160816; b=QV2BetzBYoxx2by7wQNDhyvgb2NCnIAH7ReJYiRtgKSVzZ+je89WGOqY21ujR2HXPF ZHYKDhQgCSiF9r2c6GHQNB7bq7Ji6EAsl35WL/S7leCbxSvMbGttWsR+aicpKh+sMBfp S3vXsdEAMfgTxMdIlCeiZXfrFkVEvBisA8krSlepzdbG1uYILwAtpJ/WnrY7zv4G9uMB jp2d+lJKBlGf+xCyKPO7sgaV3URLMm61R6+uAv70b68pdwskP8LGHFSilYgYRWdL7xqL ikmDH+E5OIJXAOkaHSIahF/tQ9/sG/Ry9VWXrDqTVZgOx8n1t3otriKDtvbRK4a5AN7W WfFA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=s9/aMTyy5Ig+Y7VFupd4B1d/Ym3rBj14b+yt/23+QFE=; fh=E3ilibYCxplRFz20OpOkjMj1lMKBPGRzcx1abGX98y8=; b=G31XDprUUhpHPndLfuK6HtA+9yMK8mVUhagv3VrraGONak0v9ZHxAi1fChRMQ1DMa+ VxbB4oKUtDkbguk6CgDztMdKm+Tj7SnuDbOTxiHjbplayzMTJM03WNAaeNlp556TntIt TaytdP4GwZkD5k4icEDDAF9QTMHckP/Kh1DXHscHh8iLGqMoxpIA5S3FRvmO9GGRmHOy 5rO20Q7ianMgt9Fic9OaajC7YkReNjnq4tfjJwL2Ei98u9kk+M9id0F/xJ0FFvf+/cZq YuI6lm2l6zGVOGZBhsiZ65h3O/J24yIuFn/VLl0XA5qzkh1KZIq2nOUqQ14qAOHR5jgR Ir6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bjnUZzXa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id m9-20020a170902db0900b001cc665df825si739451plx.436.2023.10.31.01.59.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 01:59:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bjnUZzXa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 7ACCC803795B; Tue, 31 Oct 2023 01:58:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229834AbjJaI6h (ORCPT + 99 others); Tue, 31 Oct 2023 04:58:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235470AbjJaI6g (ORCPT ); Tue, 31 Oct 2023 04:58:36 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68310C2; Tue, 31 Oct 2023 01:58:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698742714; x=1730278714; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=pEpzXE0NNcmHwTemudkQ6k8syJET3+LhUaz0WTQrc5c=; b=bjnUZzXaxHp13Dm5qW+AhHMGIwIb5OtyIWb3MHsirDMlpwLuwzkJhfOo wtOMxmHRORjVRRkoBkGPDpT0s6tEe8pNsaCrQ5Rzdw5TGKfHV76kQtxQU dEpkljHmWF1drTzh7BqPijP3utU3xDqp2ixO6ped54MevKvPm/4tCmnb8 TH8TjtMuXsrHZ2sGhsDcHnbs3g8ssf/x6EavnYCaEKtnPwkbGk7p/Voc8 qIvjVWH5y0wRKziOxuqI4HrwBb2vKzWN7O06445FYLYZAU8zjQ02qLnMi fR1sO3qbsr1ZIHZ/plj4W0hpZ+2FoeF005GZ6Y/+1BNdWwb70Q/YHGfG+ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10879"; a="378627547" X-IronPort-AV: E=Sophos;i="6.03,265,1694761200"; d="scan'208";a="378627547" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2023 01:58:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,265,1694761200"; d="scan'208";a="8257894" Received: from dmi-pnp-i7.sh.intel.com ([10.239.159.155]) by orviesa001.jf.intel.com with ESMTP; 31 Oct 2023 01:58:31 -0700 From: Dapeng Mi To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Zhenyu Wang , Zhang Xiong , Jim Mattson , Mingwei Zhang , Like Xu , Dapeng Mi , Dapeng Mi Subject: [Patch 0/2] Enable topdown slots event in vPMU Date: Tue, 31 Oct 2023 17:06:11 +0800 Message-Id: <20231031090613.2872700-1-dapeng1.mi@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 31 Oct 2023 01:58:43 -0700 (PDT) The topdown slots event counts the total number of available slots for an unhalted logical processor. Software can use this event to calculate the topdown metrics by collaborating with IA32_PERF_METRICS MSR. Since Intel Icelake CPU starts, the topdown slots event can be programmed both on GP counters or the exclusive fixed counter 3 but with different event & umask code. The event with code (event=0xa4,umask=0x01) is an architectural event which is represented in CPUID.0AH.EBX and can be programed on any GP counter. Besides, Intel PMU from Icelake introduces a new fixed counter (fixed counter 3) to count/sample todpown slots event so the precious GP counters can be saved. The fixed counter 3 uses an exclusive code (event=0x00,umask=0x04) to count/sample the slots event. Actually this patchset is a portion of the patchset "Enable fixed counter 3 and topdown perf metrics for vPMU"[1]. As this original patchset needs to make some fundamental changes on perf code and cause big arguments, it leads to the vPMU topdown metrics patchset is hard to be merged in current vPMU emulation framework. The patches of enabling topdown slots event is simple and doesn't touch any perf code. Moreover topdown slots event as an independent feature is still valuable even though in no topdown metrics cases, some perf metrics depend on slots event and need to be derived from slots event. Thus the patches of enabling slots event is extracted as an independent patchset and resend. Ref: 1. https://lore.kernel.org/all/20230927033124.1226509-1-dapeng1.mi@linux.intel.com/T/ Dapeng Mi (2): KVM: x86/pmu: Add Intel CPUID-hinted TopDown slots event KVM: x86/pmu: Support PMU fixed counter 3 arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/vmx/pmu_intel.c | 12 ++++++++++++ arch/x86/kvm/x86.c | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) base-commit: 35dcbd9e47035f98f3910ae420bf10892c9bdc99 -- 2.34.1