Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp64421lqn; Thu, 11 Apr 2024 14:03:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVuFcTUhuKR4adJHLemC/SdG39JSKvKOeddhq/e7n1lIKzAmOgFTyic+Sr8wpmrNyqx3IgPjGKVtoE51KWgp5swBSw9bm17wtRg+0sRWw== X-Google-Smtp-Source: AGHT+IFl7wQyV2m43Mnw/dqzRWguO3AMTkRYVYSL4n6Y/83ycMfn697IvEUt5eK1DEdrXOomcLh6 X-Received: by 2002:a05:6122:221f:b0:4d3:45a2:ae4f with SMTP id bb31-20020a056122221f00b004d345a2ae4fmr1057424vkb.14.1712869393317; Thu, 11 Apr 2024 14:03:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712869393; cv=pass; d=google.com; s=arc-20160816; b=dTfBG1b2yLXMviPt40zPubgwaNg+D216NF6da/kd4G3RlEGgrAZnueUCl7lvrZ/w5q Is60ndToxm7nyDLhLcBH9N7b0mEYUN7yqRTyyOPED6HVUxgx9uqcAzkQ5uWLYFotrA0d fpuN2S4AjAQA4kgMcGprNPc+EyMxqiAU6AsdKd5haiVwO0GpDcoTgmVD6crXLSPlk94Z DLt5/AP9dEO3tbRh6kYjXu98OK3K3b3Rbl7dzi8tSqbbxQXTKhtmmKIHhT4DisK2EjTD h0Oq3F+dV7oiIt+lx+c1HvkfK+9Ut5G9gPrH8Ina4mZrjPYOVaSK5ONgBMA9iV2Ys8is Oepg== 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=LqNHTRbTBamf9CG0cXrMM0YOfuqafLOBk3xuoM8380s=; fh=KzF5AHBlil1BCUar1JnWbRmcg8l9pBZ42gTSnEQ0V0w=; b=MG1N5I32EHZ7jCEIG6CEd7ho2IDaP9MNRChiLaqrkF/t6PbeDg77Wuwa/S+txGMscB vV6ova95kNvdro9svJknqPZfW6EVknhIcXKsXNrbxkb72JNQ3QtOGoilU17SxXVz4OVS dNlqfjy/eal3xu6JMBmvkyAZY6EFtgdATxfe+rOwjQIHFomkUlQ3zSORKyG8B8kqjxxe E9I1nKcNds+1m4+kbABbJT3rRDL7Gc7SC1Yj27HNFKQJuDu8f4TaoLXD5Rq/e5Lqerbd Py1SAp5fBAnSUZ3HUHfgDHCNinYfKqDtp0pqKmkbyZeh/0GDJLeLVIpl1eALaIo4RH66 T4rA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=F13iYDMX; 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-141603-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141603-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id l134-20020a1ffe8c000000b004d41cc1af41si356683vki.264.2024.04.11.14.03.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 14:03:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141603-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=F13iYDMX; 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-141603-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141603-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E4F781C21362 for ; Thu, 11 Apr 2024 21:03:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 581602C68F; Thu, 11 Apr 2024 21:03:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="F13iYDMX" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (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 91B5128DCA for ; Thu, 11 Apr 2024 21:03:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712869384; cv=none; b=IXnl5XJRoQEmSTvwEcEirp79UXIBYzdc3DOydj4HN8EngBwKmMmpGp1viIJ6+SpsuRY1V9ASViF0oBnm/FKs+hTItpwerz2Y1DnvjkVr4m3KRep5MUnmb+FWn+Dh2Zub5+Mrx7uub8LFaC5fpSr1qLvDw4wkaMygZxBMRVGVOmU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712869384; c=relaxed/simple; bh=6ohnLm7z3PDG7MWeKCsPtN2uBOTfngdUGkrSE6HEqWQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=GK4W4y9ESJY2DgXo0U4mHPCw3DKN5OeDv1ihjeK6OKL3+HGFU4Sl1zmUMWysV7ew3KvDTvubtB27xrqZCsWnGiMfv68ufQ+MC4tT2hN/0188x3ohA89bh3In4KNFiAiPWhqgtXU4mCoq/0qs/GO3T6SDppigb0IMzNAeaFCTzPU= 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=F13iYDMX; arc=none smtp.client-ip=209.85.219.201 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-yb1-f201.google.com with SMTP id 3f1490d57ef6-dccc49ef73eso398295276.2 for ; Thu, 11 Apr 2024 14:03:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712869381; x=1713474181; 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=LqNHTRbTBamf9CG0cXrMM0YOfuqafLOBk3xuoM8380s=; b=F13iYDMX7yW18JTzN5qfC/hm/ZPvBRTo5yh/aO1ndLxy0G0tLlFAbH5L5rTjJ56BBx ZO++GqvBmmI6zqXsVInX8cRsKLg1w5i4ZN+HzePNsubtpi6GnaprrsAA4vmHWhv7MUYz n/uiJin7NXSG2TlZ9ud4FUM1pE0eT29LWDaYFYR+mNq/W3QL38gcX0P5jOUaZO73xX34 v4h6Wdgc/5HCNz4hdCblQcov/OfRN9Hik51ZyYhc/dJy8fYTIlYWilVrXy+1WpYO+O03 peEj9axx1TS3N4J5BakoxcMmQFpcgONFrXYWgZJq7u7bv98gquaIuBgRALSy6vgCvQ69 heyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712869381; x=1713474181; 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=LqNHTRbTBamf9CG0cXrMM0YOfuqafLOBk3xuoM8380s=; b=CFdn1NhFHTnxwwU84/oTIHNlsgOQevTogl0AQHcbOWlyrZwtKciBfqlEo1f+Q5FN4j mfKZ+pxFnS9cNQSVc2YoekGxWctlcEOMKbMsn8PUE/47gS96ZL0j8GVo+5V2HOqPF36t XRV4IcUb5/3SYt26P5DYGl+rNa+zLGq/c2i4/YSFwAoddGRK5Dwr3kzOOTg5gAhsKBYj R4Js1KLVZpo96U3tFtkZ7v4l+nYBuMHYP2XcmQ+Q+MQotyNymbphoSD+toSYft8td4c3 JXMDS2dWQS9DAlfnphIpU6FmcU7C+jRwfXPwyXJuAIWRf/njgMat3/U4dKFwgwUezJp5 ulrg== X-Forwarded-Encrypted: i=1; AJvYcCW2lwu8mmJCYFEWjoEHZBNC13fVsTBkEk2BOlY1ZgGEa+5PjpYPtTibRS+AEHd0nba0aHfEa0ll0/IgaUJe9oBBR71wQLmD2cSxNvDm X-Gm-Message-State: AOJu0Yyy1FhT8B+wv3IWO/pvkh5vSgC9KFcHLofeWHVdtzRJIL15FTVt dBBmm8EsbccZqj0xk40Q9HCrOYuQoSl0V+4dld4WCK80dPd9Pl7ZCQGqm2QMChVVlrKx6XmQgy+ 8zw== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:70c:b0:dc6:e823:9edb with SMTP id k12-20020a056902070c00b00dc6e8239edbmr104731ybt.12.1712869381654; Thu, 11 Apr 2024 14:03:01 -0700 (PDT) Date: Thu, 11 Apr 2024 14:03:00 -0700 In-Reply-To: <20240126085444.324918-12-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-12-xiong.y.zhang@linux.intel.com> Message-ID: Subject: Re: [RFC PATCH 11/41] KVM: x86/pmu: Introduce enable_passthrough_pmu module parameter and propage to KVM instance 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, Xiong Zhang Content-Type: text/plain; charset="us-ascii" On Fri, Jan 26, 2024, Xiong Zhang wrote: > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 4432e736129f..074452aa700d 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -193,6 +193,11 @@ bool __read_mostly enable_pmu = true; > EXPORT_SYMBOL_GPL(enable_pmu); > module_param(enable_pmu, bool, 0444); > > +/* Enable/disable PMU virtualization */ Heh, copy+paste fail. Just omit a comment, it's pretty self-explanatory. > +bool __read_mostly enable_passthrough_pmu = true; > +EXPORT_SYMBOL_GPL(enable_passthrough_pmu); > +module_param(enable_passthrough_pmu, bool, 0444); Almost forgot. Two things: 1. KVM should not enable the passthrough/mediate PMU by default until it has reached feature parity with the existing PMU, because otherwise we are essentially breaking userspace. And if for some reason the passthrough PMU *can't* reach feature parity, then (a) that's super interesting, and (b) we need a more explicit/deliberate transition plan. 2. The module param absolutely must not be exposed to userspace until all patches are in place. The easiest way to do that without creating dependency hell is to simply not create the module param. I.e. this patch should do _only_ bool __read_mostly enable_passthrough_pmu; EXPORT_SYMBOL_GPL(enable_passthrough_pmu);