Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp561947rdb; Fri, 26 Jan 2024 04:17:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IGuDiZy3SN1OdSj+rf+tgPQmwsrm/5aYPxMXxNp1c3u2mtn4neB0xOc6JBC0QEOVwK8SyDf X-Received: by 2002:a17:902:b7c9:b0:1d7:3061:e8fc with SMTP id v9-20020a170902b7c900b001d73061e8fcmr983377plz.111.1706271457008; Fri, 26 Jan 2024 04:17:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706271456; cv=pass; d=google.com; s=arc-20160816; b=xNlceTDF6P8AgNv3/7bAUemlLxkovSUNvQ44VbVzwMgMBtZfrPUBmK3vr4UFtNV98/ /O1rT7eipPxDmOQVMfgN3YC7qHafUo2PZmfilX0cnzSRzUQjUCJeGF6Ul1ZYeTOXLu56 lm52pPDFtgV4seFEmeJ2HpgcZ5BbBtlQdDfAIxqkOxZyQlQrGJkIUwGRP8WExBaCoMT5 4JkrekiJIqllXKi5twnmi8KhIdILAR52nznKfDYBV1GE933AwreH9HO6GkA2Nt2NttAc uTo/KmdhBnCWnBR63tDKoXIsenJNJ0YXCzFVgb5BBtX7sLMEJf21hx3f84gp8xQ/68oA XQrQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=2GD9Qr1q/iodKvEeWmQvMyRWJE9Rr/zr7a8jPxnn0Xo=; fh=ILHfJ0uLc1EruXziwgJ5p79BI7cXVVRZxn5LqOC7zKA=; b=pQLnYkoXXt0TdP/AxUJjyzVC2enAmzICOOnDxFAkqTeqejCiOFoeBjtQE8PPorfX7Y B/pyAKHR3YKS4RZZU6XuakmU/OO5oAFgLlJbbHQtfeYfnpvgmHmyqPWKp3ohYGK7o+jk 7GDjJCcUTdcklKHKLdePe+zMi5u8GGPFSWiLNb5wJ9kM5fivHwgjoe572RUEV5qEQJBS wu+Ho7e4LuI6DEv4XwW3X+9j0FcHHCGvupIHhhqXsVg4aQ1fzE51V4TZ+yNmPcZ574Ay ukFqvm5Scc3e6i6sIG+rWPnjfGLQeWHUY5mpVFFGE3OAZwehdmjESlS3msKAtqKFiFjw Sg6w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MB4t7FLL; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-39857-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id u10-20020a17090341ca00b001d71b7c1685si1077631ple.230.2024.01.26.04.17.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 04:17:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39857-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MB4t7FLL; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-39857-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 375E8B2D002 for ; Fri, 26 Jan 2024 09:47:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F1CF1509AC; Fri, 26 Jan 2024 08:58:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MB4t7FLL" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25E7F4595F; Fri, 26 Jan 2024 08:58:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706259521; cv=none; b=eTn39erM06Kpqb1L6emEydsrXayYypbmUuBLZyWqOOOYj2UpmSLPT+k0o/6VFl2uc9orC2nhHa2SDzZD/9ArYVMiKWq780atB6YB5uOK7k3+Tl5LrCtxhj+9MhNwMEtj9GDtMXDPEZgVqpnEHY1IfzX2WJfBHuKSl7LREMKO3tw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706259521; c=relaxed/simple; bh=7KYMJKQiAOpNay9R+R0ZbMZPZmltntgZuyawstQhKcA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JZ1WBP7gL5OO8otrc38G+/Lt0HpEpfGqxYnuKOqQgz9cMvn4U69BPqoPTClfnm+MalKEeioEmILZW+nD+DLGHJP+L/uBgfjW3LCGErzVZ4q0shCzI8L1EZXRu/tPpuDzyb3BZBUTuAuTdrquDYCNuqy+4kTyVSoBjhWGkNqBVuw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=MB4t7FLL; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706259520; x=1737795520; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7KYMJKQiAOpNay9R+R0ZbMZPZmltntgZuyawstQhKcA=; b=MB4t7FLLqSyy4UmhXj/H4mjO23Jebos8bz65RlQnmUAL4fgfmdHjVMhR tgXRQ6P2ye2IAwuHapo0Rf4Kf4F9kZuB2onDGZxpHW5PD5kAhURuE+9Wm GA06W+opKYzZ+WHdESi/z5HIZr2PY+W/lKbB5EGMz6+Mkj/xwje0JyI1p XLCDqn5wGUo6ROTkkl2zb8AVhjjuptzAD03VmXc/aMgaQypqfIg78P5TD iGuaB6drbI7KZgE892OPmBAZwGBm/Cteo816znK5rWuMN2Gn6nq8iCvZs aCHLWJRj6RBODWxytPknUKKpRhc9DSGwR4AVbUVu2S1BsYvinkWS0SGq4 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10964"; a="9793019" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="9793019" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2024 00:58:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10964"; a="930310463" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="930310463" Received: from yanli3-mobl.ccr.corp.intel.com (HELO xiongzha-desk1.ccr.corp.intel.com) ([10.254.213.178]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2024 00:58:34 -0800 From: Xiong Zhang To: seanjc@google.com, pbonzini@redhat.com, peterz@infradead.org, mizhang@google.com, kan.liang@intel.com, zhenyuw@linux.intel.com, dapeng1.mi@linux.intel.com, jmattson@google.com Cc: kvm@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, zhiyuan.lv@intel.com, eranian@google.com, irogers@google.com, samantha.alt@intel.com, like.xu.linux@gmail.com, chao.gao@intel.com, xiong.y.zhang@linux.intel.com, Xiong Zhang Subject: [RFC PATCH 36/41] KVM: x86/pmu: Intercept FIXED_CTR_CTRL MSR Date: Fri, 26 Jan 2024 16:54:39 +0800 Message-Id: <20240126085444.324918-37-xiong.y.zhang@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240126085444.324918-1-xiong.y.zhang@linux.intel.com> References: <20240126085444.324918-1-xiong.y.zhang@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Xiong Zhang Fixed counters control MSR are still intercepted for the purpose of security, i.e., preventing guest from using unallowed Fixed Counter to steal information or take advantages of any CPU errata. Signed-off-by: Xiong Zhang Signed-off-by: Mingwei Zhang --- arch/x86/kvm/vmx/pmu_intel.c | 1 - arch/x86/kvm/vmx/vmx.c | 1 - 2 files changed, 2 deletions(-) diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c index 92c5baed8d36..713c2a7c7f07 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -825,7 +825,6 @@ void intel_passthrough_pmu_msrs(struct kvm_vcpu *vcpu) vmx_set_intercept_for_msr(vcpu, MSR_IA32_PMC0 + i, MSR_TYPE_RW, false); } - vmx_set_intercept_for_msr(vcpu, MSR_CORE_PERF_FIXED_CTR_CTRL, MSR_TYPE_RW, false); for (i = 0; i < vcpu_to_pmu(vcpu)->nr_arch_fixed_counters; i++) vmx_set_intercept_for_msr(vcpu, MSR_CORE_PERF_FIXED_CTR0 + i, MSR_TYPE_RW, false); diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 1a518800d154..7c4e1feb589b 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -700,7 +700,6 @@ static bool is_valid_passthrough_msr(u32 msr) /* LBR MSRs. These are handled in vmx_update_intercept_for_lbr_msrs() */ case MSR_IA32_PMC0 ... MSR_IA32_PMC0 + 7: case MSR_IA32_PERFCTR0 ... MSR_IA32_PERFCTR0 + 7: - case MSR_CORE_PERF_FIXED_CTR_CTRL: case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR0 + 2: case MSR_CORE_PERF_GLOBAL_STATUS: case MSR_CORE_PERF_GLOBAL_CTRL: -- 2.34.1