Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp948320lqb; Wed, 29 May 2024 16:08:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXAUhm9oSTXSOf7FoZZPsaFNe809SwY0XWaKGEjYmm5wu18ST+oeGNY743Ced7nmkLqO+OGEt6EAd3g4WIqLD+6UE0h+Rs3DlzPwrb55w== X-Google-Smtp-Source: AGHT+IGqbuPELul0XZETUDNyu0unMyZWK8RSdAQQeG2qNpCnkp5qAQwNG+tfs4uczzm/BH/wkPvZ X-Received: by 2002:a17:903:2d1:b0:1f4:6252:dbb3 with SMTP id d9443c01a7336-1f619610dd6mr5018655ad.26.1717024091219; Wed, 29 May 2024 16:08:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717024091; cv=pass; d=google.com; s=arc-20160816; b=uZpnT8zo3VcSPX7MREQFVPD8snsdIIFk5w0DSp4yOH5yDm5+Ocp+Bc2owAUkAH5qa8 o0mNanPEehGJ001BOaT0YR/ZHXqloMAool0WSJAvhueLl6SB2o22K7SSPIyy6GS/4ijV bVdWAPerJUZfQSA3URBCi33MNdkVop+z7rqn+2/viR9Vxo6bE6Ay6z0drvVDYVYxuuMA ioCGIO/sJflx4Ky9cIzj6aY1gNLhFOPd+ja3ZV7TNZVsyopKwGJYIBeV2i+aY+qFyVxL I4qVD+DoPKDOf4mJ01rvOEg8E1dlvfnaMKuGDhAFoUqceH/lUIazhOjH4+T0Z1wvNtTV 3zVg== 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=6gWPVta/qCJJyLq/hJc6KaVJRsxcvZE7MgWw+KyNFoc=; fh=kOCXThNrUc6epkfVZv5gzj3lxwAfamFgpaCiTY00QbA=; b=oL9He+JUl3+ah/gyoCjDCburCmjltTXUBUWm+GPE6ftZZyh6CGfnlNcHWRU8tQ26cP HG7oUih6jedBTTa5nCMRZgjONL1U293qczNqvKl1epdWYBMCXaRwjH6Bu63SphC+suEY Z2UJCmBAnZyPkQfEZNIcxoYQcLMc27Q5PCzfedWB6qTi6KnpBOMKK70a42Jy3aKRugbb 1t3FbYrEOvixNdS6jvlAaN3c5fzVKhymUNWE8iUzf1VAzqmmyI4FRhZuCHBxvCiS9E2D N9FehCRi9SbGx6DLpJTeg6jb4EmvmkKvfQC57D7Zp8SF3scFvCXQY6idJZGocCsjLhmW v7mQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="xPacc/f/"; 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-194764-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194764-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. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f48e9a4fc6si69022565ad.581.2024.05.29.16.08.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 16:08:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194764-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="xPacc/f/"; 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-194764-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194764-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 7EBE728475A for ; Wed, 29 May 2024 23:08:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A3931CB333; Wed, 29 May 2024 23:08:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="xPacc/f/" Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 EE8C7178360 for ; Wed, 29 May 2024 23:08:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717024082; cv=none; b=Y1xXCvsNXy2LBcWUhYzaajHnbNNeGOytQ28mVnv4+FnxCqPyu4C6aw6JohS1gyBp9v3sq8mXEVaosZ3Tr7eZFqYZOjRZh7AgdrXX4D1qqHk3RFfgbTZ4FH0Of92soJLm0RPPBoYHtafsNL019KjINZmPQYHh/YInwKTKgj93idc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717024082; c=relaxed/simple; bh=OpPHbam7unYZXqqkfE/FktxoqKH6VNOldq0Y2i/6B78=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=uSrm540JrhYNVUmY/WYzDjdQ1IFB/AxUSgMLyX8g1CD8Dk5+/1gMKCIbmSZotQ2grb/ReLw1vYc4wRqQjx+OiDZiCTyfrgNFmThwR14O2VUPdcGBM3V461GmypyZXTfHaZ6DxlYC9z66oo3IPTYHc6Qa2mio/x1oYl3flPWcXK8= 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=xPacc/f/; arc=none smtp.client-ip=209.85.216.74 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-pj1-f74.google.com with SMTP id 98e67ed59e1d1-2bde806870aso222789a91.0 for ; Wed, 29 May 2024 16:08:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717024080; x=1717628880; 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=6gWPVta/qCJJyLq/hJc6KaVJRsxcvZE7MgWw+KyNFoc=; b=xPacc/f//f9tkpdyrHqfVR7xJVl7wbXGJFXSOJnwG1XpYDCwtgNTMgL6/f2696LdW5 t5hmGhdCImuLtnkz4clIiR9JjrWZoL3PDGv9E+CRS4SaubFQj3A9UvQPggv4mn0nEfAQ +vqVmTZM+hyG5XCxb6CiKqLAd8g+9zwDdWjY0GeZjaaiRiZzv9SHSCW+RBMzECP3F8K3 VHGZ0iKWyaah7PpwZP2xwGU+ZBe+PAAyVzdYIfZwf/PLjelXUlIVI6sJjxFpw2dZW0zg yJJGh1gy2atrdAoAjbVjodm6frOpzY67wGFv+Q0dBJOowYbDOcwjIw+veFH+ap+f3Gkc v6QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717024080; x=1717628880; 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=6gWPVta/qCJJyLq/hJc6KaVJRsxcvZE7MgWw+KyNFoc=; b=n8rjvcm0dAIu3EiCw5LC+srD4HkI2CISyjyPzzJHEm9nQtZRtpMoDz72NmWzFIyDqJ 9MBNMpboVewEf/dLp9L+50WHnUXO8nJddlLNXrNB7fWEO5lTB2oPOE7A17yWxOK29wdF dRMjZM5d7TD1akIz2mZ3aPcBwK9xpfbYvm9tm0vWBdzNVLvNk5N26pUpLTNWpWpEYjQC b+4YLibdxVs9Oc41qxJhynOvtanyPmg3UT5o6E/2vKeeLTrdW3TUGJcYVHoTp+RuPsNw 0g0sypI3OeTetytnmmPlqKsmTD1eJSFAzd5vC6zuyfSVcdSQc+nxoRNu7oDu6zJg2y59 qotw== X-Forwarded-Encrypted: i=1; AJvYcCWliQVHCA1vynVgb7uQBUgF1f/3rQA9hvQ3D/0uARhGDrxeKIcgweVxSdFCt/B0vZSFRHZem38HT7s6fcilwEljQfTpCDmVnQ0/ruaE X-Gm-Message-State: AOJu0YzfJqroVGoOrM0FeDRa4kaxsbHY3fZV4SB8g5ArJT7M9SchXFlo BuFJ1+Y1nwGo1grEHIIJEhzmojsMdQP1y3Z3AcQqxWvfmAcns36H4/goAUJI1Q3BVBf3nbxKyHE yZQ== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90b:4b0e:b0:2bf:bcde:d204 with SMTP id 98e67ed59e1d1-2c1ab9e2544mr1547a91.1.1717024079994; Wed, 29 May 2024 16:07:59 -0700 (PDT) Date: Wed, 29 May 2024 16:07:58 -0700 In-Reply-To: <291ecb3e791606c3437fc415343eb4a25e531cc3.camel@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240522022827.1690416-1-seanjc@google.com> <20240522022827.1690416-4-seanjc@google.com> <8b344a16-b28a-4f75-9c1a-a4edf2aa4a11@intel.com> <291ecb3e791606c3437fc415343eb4a25e531cc3.camel@intel.com> Message-ID: Subject: Re: [PATCH v2 3/6] KVM: Add a module param to allow enabling virtualization when KVM is loaded From: Sean Christopherson To: Kai Huang Cc: "kvm@vger.kernel.org" , "pbonzini@redhat.com" , "linux-kernel@vger.kernel.org" , Chao Gao Content-Type: text/plain; charset="us-ascii" On Wed, May 29, 2024, Kai Huang wrote: > On Wed, 2024-05-29 at 08:01 -0700, Sean Christopherson wrote: > > Enabling virtualization should be entirely transparent to userspace, > > at least from a functional perspective; if changing how KVM enables virtualization > > breaks userspace then we likely have bigger problems. > > I am not sure how should I interpret this? > > "having a module param" doesn't necessarily mean "entirely transparent to > userspace", right? :-) Ah, sorry, that was unclear. By "transparent to userspace" I meant the functionality of userspace VMMs wouldn't be affected if we add (or delete) a module param. E.g. QEMU should work exactly the same regardless of when KVM enables virtualization. > > Performance is secondary for me, the primary motivation is simplifying the overall > > KVM code base. Yes, we _could_ use on_each_cpu() and enable virtualization > > on-demand for TDX, but as above, it's extra complexity without any meaningful > > benefit, at least AFAICT. > > Either way works for me. > > I just think using a module param to resolve some problem while there can > be solution completely in the kernel seems overkill :-) The module param doesn't solve the problem, e.g. we could solve this entirely in-kernel simply by having KVM unconditionally enable virtualization during initialization. The module param is mostly there to continue playing nice with out-of-tree hypervisors, and to a lesser extent to give us a "break in case of fire" knob.