Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1155935lqd; Thu, 25 Apr 2024 07:31:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV/3iX8xbRM6tYPuWnSmXZECy0YQzLgrY6v1wTowFsb/cDqsn5JrWz71MtxQpyeO+KSyx59I+n5jumwFGrIb642Lyo97RspRbtQRgBUEA== X-Google-Smtp-Source: AGHT+IFyGAr2444bdFN2z4HO2CIurQ8YXlF8WzwR/er2Q+y7juxVEi+hlE7nvgxAdTT7212HsM03 X-Received: by 2002:a17:90a:ba06:b0:2a5:63d8:cf35 with SMTP id s6-20020a17090aba0600b002a563d8cf35mr5382179pjr.24.1714055461163; Thu, 25 Apr 2024 07:31:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714055461; cv=pass; d=google.com; s=arc-20160816; b=ZJUzgI3DgVWnnf5wP2mzAsCvuwYVpW1aDwr5Oee7ByDlKMRA4TAC5ZoLBZLD7d68qT tgRjzEtbI2WCziSPOPbTLKPw2yyawZnsLjmdpgm0EGtWhYHXn7UWsbaGGzduyTvLUnO3 D2578BGldgefC7cyKzqh5Pwpw/iMTvSjBr/TJ/FyWXNUVk+9zGeWx6h4k9FPwyJj2bxJ N0CRRv7HNJh+nJ1LpGw5Ev2PEiP+tavfqXMm2yROhCtfrD7DqA3N8G6q34jzo/+P4LXM zkhMpF0W3F/u2IhQfLWwcZm4PyyJiamDAH8eMu/ombtNBRk9VCR9bSlUnDppaPDGfpz0 Hrhg== 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=OidfOhKfgKTQSCP/Z51uFSAKtD0oyBSVMoiDS/URY9A=; fh=9v94VE+JyELADbgT37JsNWiZ2BTL8jGJ3o9fRn4lI1k=; b=hFbMz8aEFWflfn3pxEeGsC/NjO11Kx8lWBnt27JuC2MjgIaPmCsuGJo/ZOiz7ZL9S8 W7dq9Gg+1o6nJMzG1RvUwrgKf/3x3ywcL7DYihX4OTEILRGpzm+OB6FDJba7Z2IgshCg YbpBQmRjzpYEz14XOWQK/oc6dw1eRmpTlmOm6/1XGhYERsFsvmUNZYgRVzQQ4xtz1k8h 12J80LJPDJ8dL/1JHIKfiAeLU+7Smdvywa5SOD3/iv8asxhUXPD8YeIKCPRylSbU1sf8 sPjz1pGeS1b3j/Uw5YIhMAXO5vPwa76xVqfT/Z9RixH9/oqntRRcRAbfHH3D34QjiXjb 5O5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=1REExwm0; 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-158716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158716-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 i8-20020a17090ad34800b002afc56922e9si1510975pjx.0.2024.04.25.07.31.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 07:31:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-158716-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=1REExwm0; 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-158716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158716-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 8577528835A for ; Thu, 25 Apr 2024 14:30:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1CA4314A4D7; Thu, 25 Apr 2024 14:30:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="1REExwm0" Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.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 17F9F149C41 for ; Thu, 25 Apr 2024 14:30:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714055446; cv=none; b=St/OjU1UEV9NaIgN0VtN1IIqt0JWKEaA3XPNCfAWquwhIzy7AsY/nN5meEUox1TeyKnxf+yN6Fjb5mKfMQTithJpGnwFio11tjkMT94og+6VMEzysInUTEp0h5eAih7rIPfwlpay0xx0PIt8mOLI2Rqhj584lX0IZdl1r0gpEUw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714055446; c=relaxed/simple; bh=DLzP+3Hp24Q60ySS9izVdIdMXy4Y3mqooLkZvnVRdM4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=UTetoDKnktZs1j5EiV7cOhpdM08VhwYyQuhE03jSikguKlqYqIk+KnJa0BBt9KO5P27a2bULIbC9CK7u1vx2gQ882XkPzs4A9c4M15VSJWV/swzDmxL+Jrx+CiA+6aA1aUXBEDAAbiwtU+rTpOFsQqAwCDqsL54kNfFsp4FEUkw= 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=1REExwm0; arc=none smtp.client-ip=209.85.215.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-pg1-f201.google.com with SMTP id 41be03b00d2f7-5e4df21f22dso1050560a12.0 for ; Thu, 25 Apr 2024 07:30:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714055444; x=1714660244; 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=OidfOhKfgKTQSCP/Z51uFSAKtD0oyBSVMoiDS/URY9A=; b=1REExwm06q7TMragHwHUgwYcPztEyYkITRJuzNKmmN01XcFNtpV24Tmew719/yIwUP 5c5UlY4yURxdEwemi1ioVm6v8eqGQ3O49eUBU66htH0ZlGlZC282FcAZ5+6oBenZF7J4 ihxnuSH6PKHrDOADTmrxuRi9GoZwvfR80yBu4cn9A6SUtB0vjdSzx3tDXmigGgTDi/o7 D+bfxFyCvB/Qu4fZ9/fHswo+wuNZzFQfCU+axestTXgj05NWlKEgNi4VYtpf1k73YL/0 IY2I9JU9u/yrE0ubYGrcT7WlyadQkCTQsNRu4kMDzKxxunsWUNOtFxO0nj8mUA4lnSeH dp4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714055444; x=1714660244; 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=OidfOhKfgKTQSCP/Z51uFSAKtD0oyBSVMoiDS/URY9A=; b=j9mIJDlCQzrWMtSPnV9a5OyURKh4L1afhVyIg9FAI/P+NbtsohALcDWZf/rLdazpMZ 2vhImDzn7Ew4a35uYdvmd/RuyuGpwgMSbd6ZlGSa+PjHpPqs2HMk4WnGWRzGeHvitPYc F9ZpbDpq070ydonzxzttoMGr047H9zu3H0xz6MnZgAlskn2fWwFA4nF+qg0QHXwIEX7K v88q4UzSxTx08PLakv/tpQgnF4BJppLmwkgvt3kSU5gSPuNU2eC0gfnnJPT79ne4xMk1 v0MjchPbOP/CaPoIrAuPnGj7Z29p96/QadI091upXYOPQTcmzpAqUlHIULQfY1d0coJp y0jA== X-Forwarded-Encrypted: i=1; AJvYcCU2XDaF0p3F/RmwE9Rh047Vr8ssmMpTRYIMUYnVZY+Kk18xFh9Ho7JY6JX97+eGV4tBNa9VGttDbK+jWgbp0GtSf1HVfwZeyazbZbix X-Gm-Message-State: AOJu0YykU4NMnSkMEUrlt5imVFG6V5Zz5F2dO8vw4HqNgI0kfCBNp2w+ SQedKTaOWX8Y2xWevBRvkZ9MlqhpLd1sQHa784h+CIdkme+fdW3jD/n7pM8L3ppvRUWZelSXyQN tYw== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a02:621:b0:5f4:36ab:acad with SMTP id bz33-20020a056a02062100b005f436abacadmr13452pgb.5.1714055444144; Thu, 25 Apr 2024 07:30:44 -0700 (PDT) Date: Thu, 25 Apr 2024 07:30:42 -0700 In-Reply-To: <4a66f882-12bf-4a07-a80a-a1600e89a103@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240423165328.2853870-1-seanjc@google.com> <4a66f882-12bf-4a07-a80a-a1600e89a103@intel.com> Message-ID: Subject: Re: [PATCH 0/3] KVM: x86: Fix supported VM_TYPES caps From: Sean Christopherson To: Xiaoyao Li Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" On Thu, Apr 25, 2024, Xiaoyao Li wrote: > On 4/24/2024 12:53 AM, Sean Christopherson wrote: > > Fix a goof where KVM fails to re-initialize the set of supported VM types, > > resulting in KVM overreporting the set of supported types when a vendor > > module is reloaded with incompatible settings. E.g. unload kvm-intel.ko, > > reload with ept=0, and KVM will incorrectly treat SW_PROTECTED_VM as > > supported. > > Hah, this reminds me of the bug of msrs_to_save[] and etc. > > 7a5ee6edb42e ("KVM: X86: Fix initialization of MSR lists") Yeah, and we had the same bug with allow_smaller_maxphyaddr 88213da23514 ("kvm: x86: disable the narrow guest module parameter on unload") If the side effects of linking kvm.ko into kvm-{amd,intel}.ko weren't so painful for userspace, I would more seriously consider pursuing that in advance of multi-KVM[*]. Because having KVM be fully self-contained has some *really* nice properties, e.g. eliminates this entire class of bugs, eliminates a huge pile of exports, etc. : > Since the symbols in the new module are invisible outside, I recommend: : > new kvm_intel.ko = kvm_intel.ko + kvm.ko : > new kvm_amd.ko = kvm_amd.ko + kvm.ko : : Yeah, Paolo also suggested this at LPC. [*] https://lore.kernel.org/all/ZWYtDGH5p4RpGYBw@google.com