Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1133336pxk; Mon, 31 Aug 2020 10:39:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUav/I2MlQXsmVm+9+pVc9GmQm9JrDg3VFe5MoYaFhiRNv7yYhlNCdFWtyvRPu7CCzWpcg X-Received: by 2002:a50:8f45:: with SMTP id 63mr2265785edy.52.1598895545198; Mon, 31 Aug 2020 10:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598895545; cv=none; d=google.com; s=arc-20160816; b=NGVmyOup9SD/noAJY/IuXJkbMP86j3dCte6/UTWaNh+c0pd77npZdX1RK+Hqk9pM6v IPsV7P1MleLmcEec26uAQdEHK0+T9ndXrIyuCOKGpyGFU0BIrfVK6To8weTKUy+LxLi3 02qX0xT5iPPLv3HltMzr/1iwoCzQnCHUmxbHj69KGsy3IBFNuykR/Q8qiCMXB5BcEf5W t0ri7/xqZXMjYxjhxMoCsRtR7cdBUXssbLZhDjo/55xK9UknBbfprx+7YCnUoBgf7IId JxAqOycoHN7D2pQR79YloXZGW9TefQnRBvogJ7G+rEFg0JVAb3zghsBpgNQO9wRuRQjS SIcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=E3KvScyvHzVRYf0RMPiy6x1jOQmJWglaF+6I1c23uFY=; b=gdlMLjYRAvPdRa6ccnSCAfFc21Xzl6sSaaDihmqJwDV/ATbcD6GK5SipHmOVH7faR+ wGVENXor1N96Q8Oe6hbR96LUem0mZQqMq8ZGBhwkSVxH/TeUqQ0B0GrRX+APhsP5Ldb0 c8Idz1vw2xyi1+IMdeEET1vnFdAbV6Vbgu63qsQ2xuhouSv/00MmuTOFqYyDjaE9JG2w +gYCDywqN1PYJ5XpLwYKMJcO7ymUv/otqqb9ZMmpFSYnglGI6Tz/FcIf3iPc/xJW/bSL BY21TXgDlyXnEYVgb4hUc9lhv4+1FHR1mQ6Au3EtKrsWPhn4dchxwaMU64gUhU31gPAw tN5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Hr2aMXSV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f9si6498867ejl.476.2020.08.31.10.38.42; Mon, 31 Aug 2020 10:39:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Hr2aMXSV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727807AbgHaRgy (ORCPT + 99 others); Mon, 31 Aug 2020 13:36:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726023AbgHaRgy (ORCPT ); Mon, 31 Aug 2020 13:36:54 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8042CC061575 for ; Mon, 31 Aug 2020 10:36:53 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id v16so6018832otp.10 for ; Mon, 31 Aug 2020 10:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=E3KvScyvHzVRYf0RMPiy6x1jOQmJWglaF+6I1c23uFY=; b=Hr2aMXSVXg1s1+r7dM0EKKRt59ublxHBQ0MrlCeTvrZ1iHjR4G0NlFh6YCU90q61uB shwvxPAWNUpPsx9gdwQ/5nP8Yu2FuvY1VBYqt1c9IrLq8MPPM1TIJs1Qrrr06Z/GDGZe ALcfp2lIoLLY3UQgYRJ+PQIlw0FRj7cwpLFqx8B6FVvPaDZRQsRO5OZtR4KGxa9hw7vO 5BMahIj5Nzw7E7HZ4RxdgnHeo3zkLqt+mn6y2Br5U/4RvqmASrcJ1ZC7sinIBIegwsS5 l8J0ibf4qloHBue5G5U0Iz1mA0tz0hToEAU6cER7ERSA1klITxRU54g2syrZtCnAmtjd a/FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=E3KvScyvHzVRYf0RMPiy6x1jOQmJWglaF+6I1c23uFY=; b=kfn8EtbaZxBxYrb0XfP0lcMfket83MhMRVYO0Npd2Su1ui/zE2D/qQvKvGIBmHvcd1 SCOOG85VixMU3hfxcE3fMtlH5XLWovnMmXble0DXz1Lg+WqQkOqPmib84QqwiS3JCM4F fDEgD9NOiA6vkBYEcf6vptlHkg4rcVr/CdV2rFXwvHbD70erKucCdmqTAmkkPB6YaFQT IoqdRGDvZWIBUj2TUTTKc0ar0Co8MdNTw+ShXEZyZVBKygZODgpMUzm+iNGHeC3dJ9fz E0LawtOZ8h72kvzila/P3SZI4DGPIfBeOnE6D/uEdbt7Stw09IMDt8c7osXSeNNdntjj aMZQ== X-Gm-Message-State: AOAM531OkouLLP+7c8k3NivynFdhVEdf/c0T9kWuF0KHrK/MWDa4vmF+ EJXteEPVPtOv6Owye4+EO43yRnP02YKs3BFR3rIP9Q== X-Received: by 2002:a05:6830:18ca:: with SMTP id v10mr1726338ote.295.1598895412501; Mon, 31 Aug 2020 10:36:52 -0700 (PDT) MIME-Version: 1.0 References: <20200828085622.8365-1-chenyi.qiang@intel.com> <20200828085622.8365-2-chenyi.qiang@intel.com> <534a4ad5-b083-1278-a6ac-4a7e2b6b1600@intel.com> <1fbfb77d-4f28-bcb6-a95c-f4ac7a313d2d@intel.com> In-Reply-To: <1fbfb77d-4f28-bcb6-a95c-f4ac7a313d2d@intel.com> From: Jim Mattson Date: Mon, 31 Aug 2020 10:36:41 -0700 Message-ID: Subject: Re: [PATCH 1/5] KVM: nVMX: Fix VMX controls MSRs setup when nested VMX enabled To: Xiaoyao Li Cc: Chenyi Qiang , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Joerg Roedel , kvm list , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 28, 2020 at 7:51 PM Xiaoyao Li wrote: > > On 8/29/2020 9:49 AM, Chenyi Qiang wrote: > > > > > > On 8/29/2020 1:43 AM, Jim Mattson wrote: > >> On Fri, Aug 28, 2020 at 1:54 AM Chenyi Qiang > >> wrote: > >>> > >>> KVM supports the nested VM_{EXIT, ENTRY}_LOAD_IA32_PERF_GLOBAL_CTRL and > >>> VM_{ENTRY_LOAD, EXIT_CLEAR}_BNDCFGS, but they doesn't expose during > >>> the setup of nested VMX controls MSR. > >>> > >> > >> Aren't these features added conditionally in > >> nested_vmx_entry_exit_ctls_update() and > >> nested_vmx_pmu_entry_exit_ctls_update()? > >> > > > > Yes, but I assume vmcs_config.nested should reflect the global > > capability of VMX MSR. KVM supports these two controls, so should be > > exposed here. > > No. I prefer to say they are removed conditionally in > nested_vmx_entry_exit_ctls_update() and > nested_vmx_pmu_entry_exit_ctls_update(). > > Userspace calls vmx_get_msr_feature() to query what KVM supports for > these VMX MSR. In vmx_get_msr_feature(), it returns the value of > vmcs_config.nested. As KVM supports these two bits, we should advertise > them in vmcs_config.nested and report to userspace. It would be nice if there was an API to query what MSR values KVM supports for a specific VCPU configuration, but given that this is a system ioctl, I agree with you.