Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp83578lqn; Thu, 11 Apr 2024 14:50:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWEkSUNc3VUVB1BGKGvNpIWqTR3wsCUke/A+RnQ7e3at2wgi0WqU2ojeo18BETcnODj+46flIPDDAXhxIoSwkDGUeh/JPX5ud9A1WxONA== X-Google-Smtp-Source: AGHT+IFQzl9HYTgNYC8pmj+R/0P+qGq0vsvj7tkul2jEhk+L0XGLVLmB571M+IouleqE1so44mzs X-Received: by 2002:a17:903:22c2:b0:1e3:c186:8db3 with SMTP id y2-20020a17090322c200b001e3c1868db3mr4952475plg.15.1712872239274; Thu, 11 Apr 2024 14:50:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712872239; cv=pass; d=google.com; s=arc-20160816; b=p3ZZo+qGapXV0rTdBqPmsGJ6IuVRrP04Fpk8Tj74nS0wTCeMPnKyWUeja6VMly+844 i0jDz2Hb43mWiQFh6roH7DKwl3zP38zUmQPkpAUjes5/CExFsBY1cWGPIz4qZAER/LoM 7zDUOub6XPSiRCvfOt7FZh/gu5ujmhmHudtDA5XKezcLJyeASRgQHeRvcqb11GyYHawG 1wUqhnbdE1HZgvxLG1u8dxpA1r8/xnH3yGg6P/HgmfIiJvJBRGLe+ecICJm2TwXeSiD8 u/x0+7ewYD0GW8DQyHMStMPR9TxpJCdv5kDyWmuRTUZzIXdudNo8DcDQkFnW9Fcgvtjf h3fg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=iaCjUmmDdIOzJKGmZpSSyoXs6qkh/GpGaJ06mDLpr1M=; fh=3iOoNYxcH9br7salVhgyJjwpHWAiHkIIP2vOJNj4V3o=; b=BXO9vT4yS6izLrtFrgetu5Gria0vcxJZEujirYF71F6syrtXBXIkuxk4I27wsFpTck oMhlxT7+i+iytvmhyeoEHNshfmc/NtkssDQqQLo/KZdqKSQf+czkSwTQ5wVg77te5AXr X67NtQuzsluYCKUdbEHUUMD+OdsOhNTLk9TwaCKxgU5UhtrVZpONOTZ65aJE/s2qzVYg RR+p9qF9WVOkyjP5Fgv/VJ5bPiysGli4B5wCwjmi8FGaHRVPuk7MdzrWzWzZlh6H/N7B U3fFlYa8UjnPpY5EF4EDJ+UUvfcoM2vlsWQzv/jhPs9UXOJpQ6YmfSV/yG9y68l2liFk 1yJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=GKEzWTFn; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-141642-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141642-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t6-20020a170902e84600b001e2bdef3978si1965331plg.317.2024.04.11.14.50.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 14:50:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141642-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=GKEzWTFn; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-141642-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141642-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C74D6284F07 for ; Thu, 11 Apr 2024 21:50:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C23D3B295; Thu, 11 Apr 2024 21:50:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GKEzWTFn" Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 352A139AC3 for ; Thu, 11 Apr 2024 21:50:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712872232; cv=none; b=ecLGgAhkUHeAnLMx2ss6vGc3GxpBggg8ADYWHdWYK+lYDYKAGVtO/7X0lztBtJZXTAG9YjW3PEK1z1kIWVMmxgR5BU8Yj1hnIVSy2n7EKrOvY6Kv2OqhIPD6X2ZFTukdXX0M2BVxmMbhside3P/M95lAVzgmTRkhhRPx+VRAJ0g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712872232; c=relaxed/simple; bh=PQIRuDalA81RPfew+1oM3M1PbSo25ZD+Ob2cgUdhwRI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=PMBR+m39AS0yvycu2+A2CvJXtAmpTf7xfbyWg9jszwzjIkuyH0K7GzDl/E7cEJ9CteBlT3RuDqyBgWc6m7vCiGE8fdBYA1Gr80wpazo0ELrzrl6tGfEX3YzzPdePOMpX0sajaBRYDzMHJ3eVVZH3n4/Pidr5gk3qtOBaSlfcfxQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=GKEzWTFn; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-1e45e04bb40so3338195ad.2 for ; Thu, 11 Apr 2024 14:50:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712872230; x=1713477030; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=iaCjUmmDdIOzJKGmZpSSyoXs6qkh/GpGaJ06mDLpr1M=; b=GKEzWTFnf5sVuP0IUxt9A8GWbiHHX2Mhwox/3lpnLdb2vU1bICHLAOfcG/J2ZFYjil s09kZ5UdRAIiktwxg/vbbtLbEAA0GH9FaK+yKfZGXP15hQUlr1gooptkXJpAy7PDawaq 45e3lpgP8bPE13sKW+G5oM1K2wLyppneMZO2cxpDJFX6VYuDZlnjKhDf6GqdSeSs5IOc XUKLlc5abihqtOUywwM88GIirK9qiqmC/ST3fINtcCIrCd3FOLxlU6R4MnYoTKX/a2L+ xD9w0LUQWLUL/v3zL9GudEMtKl3nRZYD6P8jUtLFieblMj8EeVhg69CsHxKxzwfYdme5 x6dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712872230; x=1713477030; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iaCjUmmDdIOzJKGmZpSSyoXs6qkh/GpGaJ06mDLpr1M=; b=aK/naXOGcX4Slnp5WBDy79zZp98jEUbGzWxWilYiqCKWtzL/TxWUklc7FJ9yL6ru6E WPvJWLU64wp9OPilbl0F+JjL4ir0L+NX8PqUfFunWddCbd9YX3ngGmEfdscwMr6ae+wC /fjrCfRVKZLX5lccMbs4yqk6YSb4F83JHu4O+2fxZSC/lNYBPaAOrw7CQDhoYsZwaiiK T59I2+B8f/oXJbK2i7e2OYVbJs3h0Qk1D171RqUmpq5l9+NfCihveU6j4o1Nm9va5rvO jWYiiWhbkRzYzGHM/fYy06L5+TVnVHEb0+yFnXsrBaZp4uJ6ru/yhbhcwCIZvbYpfM67 2VdQ== X-Forwarded-Encrypted: i=1; AJvYcCXPUVTxyGcir9eSAtQ+3d3rnicbfyCQnW7LOosauu8QhxzCkGftHYPnpfpI32EER5fB/4qqNgXWJnV2I7G5U6pqVX8tuF4ubtO6AYfU X-Gm-Message-State: AOJu0YzG7Sx+OJvnVKES3EKaG+HUzdpyvmuTNYK7ILWB/krpsVXhrcoX RCKXTlnAmZkk4omd3iDFlYhHvEgULd/7Bagc+Ip/OtMW3zwhrsQeTnaaiQTnJAuqgIxUGFHe26p rVg== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90b:128f:b0:2a4:8940:41c7 with SMTP id fw15-20020a17090b128f00b002a4894041c7mr2248pjb.4.1712872230439; Thu, 11 Apr 2024 14:50:30 -0700 (PDT) Date: Thu, 11 Apr 2024 14:50:28 -0700 In-Reply-To: <20240126085444.324918-28-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 References: <20240126085444.324918-1-xiong.y.zhang@linux.intel.com> <20240126085444.324918-28-xiong.y.zhang@linux.intel.com> Message-ID: Subject: Re: [RFC PATCH 27/41] KVM: x86/pmu: Clear PERF_METRICS MSR for guest From: Sean Christopherson To: Xiong Zhang Cc: 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, 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 Content-Type: text/plain; charset="us-ascii" On Fri, Jan 26, 2024, Xiong Zhang wrote: > From: Dapeng Mi > > Since perf topdown metrics feature is not supported yet, clear > PERF_METRICS MSR for guest. Please rewrite with --verbose, I have no idea what MSR_PERF_METRICS, and thus no clue why it needs to be zeroed when loading guest context, e.g. it's not passed through, so why does it matter? > Signed-off-by: Dapeng Mi > --- > arch/x86/kvm/vmx/pmu_intel.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c > index 4b4da7f17895..ad0434646a29 100644 > --- a/arch/x86/kvm/vmx/pmu_intel.c > +++ b/arch/x86/kvm/vmx/pmu_intel.c > @@ -916,6 +916,10 @@ static void intel_restore_pmu_context(struct kvm_vcpu *vcpu) > */ > for (i = pmu->nr_arch_fixed_counters; i < kvm_pmu_cap.num_counters_fixed; i++) > wrmsrl(MSR_CORE_PERF_FIXED_CTR0 + i, 0); > + > + /* Clear PERF_METRICS MSR since guest topdown metrics is not supported yet. */ > + if (kvm_caps.host_perf_cap & PMU_CAP_PERF_METRICS) > + wrmsrl(MSR_PERF_METRICS, 0); > } > > struct kvm_pmu_ops intel_pmu_ops __initdata = { > -- > 2.34.1 >