Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp327178iog; Thu, 30 Jun 2022 01:21:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tTRxoJAr1RqpZYJ99SZM9gfdeTzvYYCA0kPlFiYsCAsbguhKC/U/Bg9xk33hcjQvz4fvfz X-Received: by 2002:a17:907:7ba1:b0:726:4522:d368 with SMTP id ne33-20020a1709077ba100b007264522d368mr7732229ejc.662.1656577281208; Thu, 30 Jun 2022 01:21:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656577281; cv=none; d=google.com; s=arc-20160816; b=d/mxIaS79w3r0E1JD4ifC8Hy3dAwbol8kx1RSiPr8Q86zI4zQiFK6yiiBfxjG2Z4o8 3gjcKggZ3S/o6sll4nHcmA8ub1m5hQ96QukKQWjt+RrIEOBwOT+ho7kY23E9cIn16Uka 6EbY7R5E5p5XVu9Se2jwkmx+3VwVgds4vPV/e1WCd3aw/hUbXf7Wlq7BvdV3RQuqnzpq GFaBcMGKOm+93TzuJSlyvRKGquUo3dId4fpUx9gxoS300nnJ1ZQ21u3jx3QWugTqBsLi BTihfaoGzPjMmgM9Ow3jUWKI5PdPeapv2ely98NkAJiiFcPXxwfYaYsdfBLRgtSu5YXp aD/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=zlMiGdcIrFpDBLHk8xJFJfVXR7N2zgyrgxr08eYwybI=; b=J4qhMtNojdtj9DV1SdZs5RDgSPEFCiBbLRYEJ6GhAp31BLd+4RC6xgcskyVDd7kGcq i535mr8aPNaMJojND0KBzu70cHH6aV/ZBdif7WhQoMJ+NnSNsOT7tRKM5pXTQ2wtVkST PwZ7HwByfc9uAvjWKYVYAOJXLhXzcIGBpeAUyCPBbESq0ef02vrYqE53gv/CLoVnPKyl v4IPnD2ABSdG97WHwkLseIBNK+wCtVKrQYQgDy14lbueXWrokEqrW9DvwadeUebIfNYq eoT9vgJixvBaIaopB+1kf6axFQGfWFTTKmgpQ2eQ59MgL+vhhlI0qgcuKoX8LpRQHzAn bTGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bKufcNdZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g17-20020a056402425100b00435d7a499ecsi3269832edb.612.2022.06.30.01.20.55; Thu, 30 Jun 2022 01:21:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bKufcNdZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232147AbiF3IR4 (ORCPT + 99 others); Thu, 30 Jun 2022 04:17:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233087AbiF3IQz (ORCPT ); Thu, 30 Jun 2022 04:16:55 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9B4F2BAC for ; Thu, 30 Jun 2022 01:14:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656576868; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zlMiGdcIrFpDBLHk8xJFJfVXR7N2zgyrgxr08eYwybI=; b=bKufcNdZkDoUjHJUOctPDKSRSBv34EtRstMtgBDBTeKcwrdh3TzHD5si7n5er1jSE2NiyP CGbS/4RSSxXfDv0Kd9zP/gFneiqpJCz669VZB0/fWgo1pTpeWGq+KkwqoWr9xXrzMGiFkC rYZTcseF+YfhgiptDfywPyV8CHZ1sIA= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-567-jcoNo206O7qfAjuiYvtjgw-1; Thu, 30 Jun 2022 04:14:27 -0400 X-MC-Unique: jcoNo206O7qfAjuiYvtjgw-1 Received: by mail-ed1-f69.google.com with SMTP id h4-20020a056402280400b00435abcf8f2dso13770468ede.3 for ; Thu, 30 Jun 2022 01:14:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=zlMiGdcIrFpDBLHk8xJFJfVXR7N2zgyrgxr08eYwybI=; b=CWFGDbukfD+Og5PqCCXHz2zYb0qyPcSi2W+D8j5iDOFgA2jaS8V+MQCSRUS5gdBySa bpvdSf/SQoctb8Wv9/EVHP5b7G3NaTe7vVWYytGk3267FVc5wLupc5hmoToEv19gpAgV wWPY0I7j6WeOFas93ZEDAoi60nYKTigg0KXzVgYtExqF8cbg6SxQgrwIQidcd9y04cWz l2TTaWh6g0oGEpl3vRkyyL1taK/uX5r+6mLUjdMoBqOekSs1FA9esEa7rSXPChbsP4xu Z1iPyY7DMkJfo/rEaFy9mg2ecQr6YdIGGDOBMVYES1/t4vTbT6/ZAXKCRwnR7AEqW+35 SR7A== X-Gm-Message-State: AJIora86YNindPPDnXrOiRE31E1I2GVKE91eEBUDrV+DiwCXpwZO+Dh1 hp1Yq/jo6TEx5CqBBa4PvGqHejKvm1P3p94naoB9n3GLdz8oe2HBNy5yhS/wVjPLqwbR1IF6RJR /FfWBkbDQ7mNdoBydgmU3GrKI X-Received: by 2002:a17:906:2bda:b0:726:3b59:3ea9 with SMTP id n26-20020a1709062bda00b007263b593ea9mr7435887ejg.43.1656576866183; Thu, 30 Jun 2022 01:14:26 -0700 (PDT) X-Received: by 2002:a17:906:2bda:b0:726:3b59:3ea9 with SMTP id n26-20020a1709062bda00b007263b593ea9mr7435876ejg.43.1656576865965; Thu, 30 Jun 2022 01:14:25 -0700 (PDT) Received: from fedora (nat-2.ign.cz. [91.219.240.2]) by smtp.gmail.com with ESMTPSA id r1-20020aa7cb81000000b004357b717a96sm12695498edt.85.2022.06.30.01.14.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 01:14:25 -0700 (PDT) From: Vitaly Kuznetsov To: "Dong, Eddie" Cc: "kvm@vger.kernel.org" , Paolo Bonzini , Anirudh Rayabharam , Wanpeng Li , Jim Mattson , Maxim Levitsky , "linux-hyperv@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Christopherson,, Sean" Subject: RE: [PATCH 04/14] KVM: VMX: Extend VMX controls macro shenanigans In-Reply-To: References: <20220627160440.31857-1-vkuznets@redhat.com> <20220627160440.31857-5-vkuznets@redhat.com> Date: Thu, 30 Jun 2022 10:14:24 +0200 Message-ID: <87o7yash3z.fsf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "Dong, Eddie" writes: >> -----Original Message----- >> From: Sean Christopherson >> Sent: Monday, June 27, 2022 6:38 PM >> To: Dong, Eddie >> Cc: Vitaly Kuznetsov ; kvm@vger.kernel.org; Paolo >> Bonzini ; Anirudh Rayabharam >> ; Wanpeng Li ; >> Jim Mattson ; Maxim Levitsky >> ; linux-hyperv@vger.kernel.org; linux- >> kernel@vger.kernel.org >> Subject: Re: [PATCH 04/14] KVM: VMX: Extend VMX controls macro >> shenanigans >>=20 >> On Mon, Jun 27, 2022, Dong, Eddie wrote: >> > > static inline void lname##_controls_clearbit(struct vcpu_vmx *vmx, = u##bits >> > > val) \ >> > > { >> > > \ >> > > + BUILD_BUG_ON(!(val & (KVM_REQ_VMX_##uname | >> > > KVM_OPT_VMX_##uname))); \ >> > > lname##_controls_set(vmx, lname##_controls_get(vmx) & ~val); >> > > \ >> > > } >> > >> > With this, will it be safer if we present L1 CTRL MSRs with the bits >> > KVM really uses? Do I miss something? >>=20 >> KVM will still allow L1 to use features/controls that KVM itself doesn't= use, but >> exposing features/controls that KVM doesn't use will require a more expl= icit >> "override" of sorts, e.g. to prevent advertising features that are suppo= rted in >> hardware, known to KVM, but disabled for whatever reason, e.g. a CPU bug, >> eVMCS incompatibility, module param, etc... > Mmm, that is fine too. > But, do we consider the potential need of migration for a L1 VMM ? > Normally the VM can be configured to be as hardware neutral for better > compatibility, or exposing as close to hardware feature as possible > for performance. > For nested features, I thought we didn't support migration if L1 VMM > yet, so exposing hardware capability by default is fine at moment. We > may revisit one day in future if we need to support migration. Not sure I got your point, nested state migration is fully supported in KVM. When migrating a guest, KVM makes sure the list of features exposed in VMX control MSRs remain the same. This may not be the case if you use something like "-cpu host" in QEMU but the problems are not specific to nesting. > This MACRO do help anyway =F0=9F=98=8A > >>=20 >> The intent of this BUILD_BUG_ON() is to detect KVM usage of bits that ar= en't >> enabled by default, i.e. to lower the probability that a control gets us= ed by KVM >> but isn't exposed to L1 because it's a dynamically enabled control. --=20 Vitaly