Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4165594iog; Tue, 28 Jun 2022 10:16:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sU+DALem9uI+4bc+IN7jVEQyBfTyoPM1WmxfqGYMZrEk0N+t/3Ay+ojGNv3iTD5xgvXzQp X-Received: by 2002:a05:6402:528f:b0:42a:c778:469e with SMTP id en15-20020a056402528f00b0042ac778469emr24186559edb.404.1656436592226; Tue, 28 Jun 2022 10:16:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656436592; cv=none; d=google.com; s=arc-20160816; b=AwPdjqFHEzVPWY/ybDT6CLmlRDOV+H9RQvta9tey70+J9qtq0Kx2lamOn3gpB+LxMN T3GSdNIu7MTxOXWb3mj4DQbzz9DBOS/TbNeLlh0HonLQylT07WHCjMrwnwYU9oK5WtBL TiZaMtSYri+EzYyoiImeRpkwlP0vIemuMx1fHRTEO2NBjzswxiTuobC4Hv20FCv/uZLG nFrdhRHSGVHZBx26VY/A+N0TDgjPf5FT9ZH2EppsGLz2R5Dmrez2X675sVo/kDYxtvjJ l/PfrdPOSXPgHLjBW/6oQEN06O+bKTvja8yOZKWsQfVpl0w2NOLT/vbiZCgcSmZ2W+8K +Jmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=B9iQSlpW/Sg98O8w3kQrkvkAcMFnb09BQssJyDNeW5o=; b=HtcnCNkvFBjvIgTFO6hk3/X1UPXhKrsaHm0zD6qKioHFnpg4TJsAyX4tjNodouePTY w6aiokD8wsnIbMEkkVILyv0wVEfFRLJD896mKQJ26nE2+Vib9dxFPdARfUNrrnkZlCC0 sIqsUKmCIRRlYnf/Qy3aj79dRALtJIXrqnw+wHQ2tilIWokWA2LTx19BQ+AF1TOBpG8u wfdbg06NGSGAugu0kqjnd50mrIKQUqIMezXoSnBRMpXEFYY4tQZjtRxZd10aOD2Cs0e2 9Gje+UCWQJrLNkUhkgUhQ7XTLMuZtnfS9Sk2/v9Pk0xTFs9KVT5tZJX+gaHG5T4P9o4B JIiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=RgTwDThn; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a056402440a00b00437b04e3a9esi2640253eda.105.2022.06.28.10.16.06; Tue, 28 Jun 2022 10:16:32 -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=@google.com header.s=20210112 header.b=RgTwDThn; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232348AbiF1RLV (ORCPT + 99 others); Tue, 28 Jun 2022 13:11:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229835AbiF1RLS (ORCPT ); Tue, 28 Jun 2022 13:11:18 -0400 Received: from mail-oa1-x29.google.com (mail-oa1-x29.google.com [IPv6:2001:4860:4864:20::29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1A3C2C13B for ; Tue, 28 Jun 2022 10:11:17 -0700 (PDT) Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-101d96fe0a5so17927865fac.2 for ; Tue, 28 Jun 2022 10:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B9iQSlpW/Sg98O8w3kQrkvkAcMFnb09BQssJyDNeW5o=; b=RgTwDThn6/Nl98GpEo6dfFMm4xqIZT7SgaRaNSYHH2qpRxST1hbQCcxFtBIrgmgsdB KeWqHT6gpzsh04hezaHxC3GesbwdfbNWcAhlTKVekIOdZdMzT44oooHw1y6wDJvkrpnk fNgxFWeHxYUIWW4gUhFc1VTbb+JXvoyDk4bhaxjCJ+r9q0yZVOOezChnp9zTdALdJVqx bW7su34tRzk2WsIyzgmi9eqt+91g92tQmzDBI7H7qB70kKMymmSQzeWPd1526SFUvKWN OsTTcAuiJDqVbEErmzlRq7E1m08COd0HYD5FhZDs5z5AmO1mZRChmoy+ACqtR9GyJphu DtnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=B9iQSlpW/Sg98O8w3kQrkvkAcMFnb09BQssJyDNeW5o=; b=hv3IZWl6EKzJJeW/IjLLhO001RHKNqpOOzuUuu/8UWvN3MymobVWlC2om1F60DfyZg etpErG9bK5YBpXkSOuPkrLwBslIRoRn5RkeSEVvBtfEJOmy+lZtDalXF/Z33qKDpa0MR j4yhw8LE+1GYT0XHo0qW8JV9tGwU4UZRUFYh4P1BCzyHexCUYpMzdgybrVLYBsxT24gs g2apHp5GIbNsGx7Ak5yT9rWbHfwGu6AfvOx4d0Z1FM3FRkbikeTaHyO3Y3f0s8EYycr0 DRuM1Q2KbcDlNTedl/zoSYRHLi5jP4apFf2yMVYTGRVJB0cCoND7gYx9FJfvnlDJEkyc ayTg== X-Gm-Message-State: AJIora/ysSpVhDlm1vBsWmp6HcbAxLePbaCqfTziPhkIhHx6K173GEpm pvjFmKV5LTh/wECFrmQN06mo8jjxsdv3I/W5hCAflg== X-Received: by 2002:a05:6870:d3c7:b0:104:9120:8555 with SMTP id l7-20020a056870d3c700b0010491208555mr360162oag.181.1656436275331; Tue, 28 Jun 2022 10:11:15 -0700 (PDT) MIME-Version: 1.0 References: <20220627160440.31857-1-vkuznets@redhat.com> <87y1xgubot.fsf@redhat.com> <87letgu68x.fsf@redhat.com> In-Reply-To: <87letgu68x.fsf@redhat.com> From: Jim Mattson Date: Tue, 28 Jun 2022 10:11:04 -0700 Message-ID: Subject: Re: [PATCH 00/14] KVM: nVMX: Use vmcs_config for setting up nested VMX MSRs To: Vitaly Kuznetsov Cc: Sean Christopherson , Paolo Bonzini , Anirudh Rayabharam , kvm@vger.kernel.org, Wanpeng Li , Maxim Levitsky , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On Tue, Jun 28, 2022 at 9:01 AM Vitaly Kuznetsov wrote: > > Jim Mattson writes: > > > On Tue, Jun 28, 2022 at 7:04 AM Vitaly Kuznetsov wrote: > >> > > ... > > >> Jim Mattson writes: > >> > >> > Just checking that this doesn't introduce any backwards-compatibility > >> > issues. That is, all features that were reported as being available in > >> > the past should still be available moving forward. > >> > > >> > >> All the controls nested_vmx_setup_ctls_msrs() set are in the newly > >> introduced KVM_REQ_VMX_*/KVM_OPT_VMX_* sets so we should be good here > >> (unless I screwed up, of course). > >> > >> There's going to be some changes though. E.g this series was started by > >> Anirudh's report when KVM was exposing SECONDARY_EXEC_TSC_SCALING while > >> running on KVM and using eVMCS which doesn't support the control. This > >> is a bug and I don't think we need and 'bug compatibility' here. > > > > You cannot force VM termination on a kernel upgrade. On live migration > > from an older kernel, the new kernel must be willing to accept the > > suspended state of a VM that was running under the older kernel. In > > particular, the new KVM_SET_MSRS must accept the values of the VMX > > capability MSRS that userspace obtains from the older KVM_GET_MSRS. I > > don't know if this is what you are referring to as "bug > > compatibility," but if it is, then we absolutely do need it. > > > > Oh, right you are, we do seem to have a problem. Even for eVMCS case, > the fact that we expose a feature which can't be used in VMX control > MSRs doesn't mean that the VM is broken. In particular, the VM may not > be using VMX features at all. Same goes to PERF_GLOBAL_CTRL errata. > > vmx_restore_control_msr() currenly does strict checking of the supplied > data against what was initially set by nested_vmx_setup_ctls_msrs(), > this basically means we cannot drop feature bits, just add them. Out of > top of my head I don't see a solution other than relaxing the check by > introducing a "revoke list"... Another questions is whether we want > guest visible MSR value to remain like it was before migration or we can > be brave and clear 'broken' feature bits there (the features are > 'broken' so they couldn't be in use, right?). I'm not sure. Read-only MSRs cannot be changed after their values may have been observed by the guest. > Anirudh, the same concern applies to your 'intermediate' patch too. > > Smart ideas on what can be done are more than welcome) You could define a bunch of "quirks," and userspace could use KVM_CAP_DISABLE_QUIRKS2 to ask that the broken bits be cleared.