Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp25455pxb; Tue, 23 Feb 2021 16:56:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJz0m+/YE6WCKgxw94v3qTmlRfoLs/qBnV0Yfnt/L9G2Gr+Vygf31Eg/9AcXX/oZOUSmYKoa X-Received: by 2002:a05:6402:c7:: with SMTP id i7mr31379985edu.328.1614128183437; Tue, 23 Feb 2021 16:56:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614128183; cv=none; d=google.com; s=arc-20160816; b=y619tMA9ZbeaNDdj0Gwt5kxUQ6KRP9UxBzoS8t+49rKfBFdlvf7PJf0EMgOcJ/ldxE geUjqFlejisiyxnDtTFCTX8cfGrLXSF6fWEkIUr+JBbnPtWIrpkWRRgWq+NOwguY+HOy h48sZpoU0im5N5W95T60wfAsex81+jPyckXXbXVY7+HOYXCWuc5PqTqS8PhLZbc3qJ38 OIFpniRzwrNN1D7uIDLOFfQ6vxjCtNGieMsPW1Clk9jDvXainNdNV+jV+gLajQ8FVqet RhmRX4wkSpkmQJWq9dVtlBBwlv9fjnqAYZy+GmPTfpmjsrunEPdMfAHGRfdL/OBD7miY u+Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nKO+dRLATRVmZPlvZjV64HXRuWuPyFxt3gyKTmbS/9c=; b=AUncNd0FvlkgHCGAzHll9NVBpwSVrn7DDdB4Iuat+f466FOnMQCWci5zcNOMpgr96k jR3fSeohSnvePIBCN6UqAETWuiSeO049sN7siTsPAAlO9WbCWhyZaDDX9FeUjEeVYnDS /N3PMzFxsPqRauE+eeDBv3aDvfn97PJxuhH05PRkV4haympq5VtFIr0enO7VKh6O1TsP B7y66ikaQ/EMd0tCLA14+54Eu9Ce/ireoFs6wk9w6qmTpAAAmZVrqB2NnkeYWpol5Zhy fm15uGlgI1v63TRfec51LvzjAdsBsmSBcxeTYGYYZBVb7a6kNOTohzoFnQJ3IwQOac3E V0jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=IG3vsiD6; 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 qo25si282727ejb.288.2021.02.23.16.55.36; Tue, 23 Feb 2021 16:56:23 -0800 (PST) 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=IG3vsiD6; 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 S233629AbhBWXKo (ORCPT + 99 others); Tue, 23 Feb 2021 18:10:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233674AbhBWW73 (ORCPT ); Tue, 23 Feb 2021 17:59:29 -0500 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D5A5C06178B for ; Tue, 23 Feb 2021 14:58:37 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id s23so3022734pji.1 for ; Tue, 23 Feb 2021 14:58:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=nKO+dRLATRVmZPlvZjV64HXRuWuPyFxt3gyKTmbS/9c=; b=IG3vsiD67MFToXB74AUsAQK01d5BoNsk9Ngn7a976Zqnvvhjq4JdhuKPd4wTBme59G vgarm/gtwPsUlSUnJV3voLecAG9x7V1jTItn1u9+65t3hhZpCFfuGLZgGQhLJAEgpoMn 6zjxzwHD32nUxNfyCc3IXBECyIDfdvDKEHs4CPmghbJK246OoXwxEsAQIh33uDqHu9H+ GTdzElwsxPx3B5COt7euCWI+PiIkbE98TN5VjWkbzTk+Qbpc4fQ9laNbBBroMTjxypVp jDEsuIhD+pd1Q6NUAxPrtozhuiRvgKMqW9G+RbLy+h1nHT3/fUfy70d0Xcd4N1lTrdcM /z+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=nKO+dRLATRVmZPlvZjV64HXRuWuPyFxt3gyKTmbS/9c=; b=Rka39Cv3wMUhEIobHb62r31DYuFxahDbB0/4lxtAabieTAzKkSB6GHot6KWTh6/g0u ISTYixT4/dDQDpHEuw7GI41csRr580N+kksugEhaDvAi8fBK8hMyuUteabDqk5ToMsDV yq0T10nRTB25FGeyTT6b9SIxgwHUKUh62Ie5Z9egAXaZGK3wu6Bx2UuOUGd7bNY1hTJa oa1uySZPDFprJgNmBlu/3hpsUqzbYbAVjBeXUGPesytSFUsy7c0k2vTOBoiEtEOHND2f jcjnQM/wOlEoXXu3JV4oyEaTllwd/BQP3vB5ebdRz5L7NYZfLJPZZHyFA+5qszNcEPeB x39g== X-Gm-Message-State: AOAM531e3NcdF7pE1tSKV5+2Ojm4ssrMHvy+otdYKhdj285Za7VYz80s zLllkTV+66FF5bm40QDKmQWqeg== X-Received: by 2002:a17:90a:8b02:: with SMTP id y2mr1027275pjn.111.1614121116679; Tue, 23 Feb 2021 14:58:36 -0800 (PST) Received: from google.com ([2620:15c:f:10:c939:813f:76bc:d651]) by smtp.gmail.com with ESMTPSA id w1sm159092pjq.38.2021.02.23.14.58.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Feb 2021 14:58:36 -0800 (PST) Date: Tue, 23 Feb 2021 14:58:29 -0800 From: Sean Christopherson To: David Edmondson Cc: linux-kernel@vger.kernel.org, "H. Peter Anvin" , Joerg Roedel , x86@kernel.org, Thomas Gleixner , kvm@vger.kernel.org, Paolo Bonzini , Wanpeng Li , Ingo Molnar , Jim Mattson , Borislav Petkov , Vitaly Kuznetsov Subject: Re: [PATCH v2 2/3] KVM: x86: dump_vmcs should not conflate EFER and PAT presence in VMCS Message-ID: References: <20210219144632.2288189-1-david.edmondson@oracle.com> <20210219144632.2288189-3-david.edmondson@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210219144632.2288189-3-david.edmondson@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 19, 2021, David Edmondson wrote: > Show EFER and PAT based on their individual entry/exit controls. > > Signed-off-by: David Edmondson > --- > arch/x86/kvm/vmx/vmx.c | 19 ++++++++++--------- > 1 file changed, 10 insertions(+), 9 deletions(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 818051c9fa10..25090e3683ca 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -5805,11 +5805,12 @@ void dump_vmcs(void) > vmx_dump_sel("LDTR:", GUEST_LDTR_SELECTOR); > vmx_dump_dtsel("IDTR:", GUEST_IDTR_LIMIT); > vmx_dump_sel("TR: ", GUEST_TR_SELECTOR); > - if ((vmexit_ctl & (VM_EXIT_SAVE_IA32_PAT | VM_EXIT_SAVE_IA32_EFER)) || > - (vmentry_ctl & (VM_ENTRY_LOAD_IA32_PAT | VM_ENTRY_LOAD_IA32_EFER))) > - pr_err("EFER = 0x%016llx PAT = 0x%016llx\n", > - vmcs_read64(GUEST_IA32_EFER), > - vmcs_read64(GUEST_IA32_PAT)); > + if ((vmexit_ctl & VM_EXIT_SAVE_IA32_EFER) || Not your code, and completely benign since VM_EXIT_SAVE is never set, but I don't like checking the VM_EXIT_SAVE_* flag as saving a field on VM-Exit has zero impact on whether VM-Entry succeeds or fails. Same complaint on the PAT field. > + (vmentry_ctl & VM_ENTRY_LOAD_IA32_EFER)) > + pr_err("EFER= 0x%016llx\n", vmcs_read64(GUEST_IA32_EFER)); Tying into the previous patch, I think we should print both the effective EFER and vmcs.EFER. The effective EFER is relevant for several consistency checks. Maybe something like this? pr_err("EFER= 0x%016llx ", effective_efer); if (vmentry_ctl & VM_ENTRY_LOAD_IA32_EFER) pr_cont("vmcs.EFER= 0x%016llx\n", vmcs_read64(GUEST_IA32_EFER)); else pr_cont("vmcs.EFER not loaded\n") > + if ((vmexit_ctl & VM_EXIT_SAVE_IA32_PAT) || > + (vmentry_ctl & VM_ENTRY_LOAD_IA32_PAT)) > + pr_err("PAT = 0x%016llx\n", vmcs_read64(GUEST_IA32_PAT)); > pr_err("DebugCtl = 0x%016llx DebugExceptions = 0x%016lx\n", > vmcs_read64(GUEST_IA32_DEBUGCTL), > vmcs_readl(GUEST_PENDING_DBG_EXCEPTIONS)); > @@ -5846,10 +5847,10 @@ void dump_vmcs(void) > vmcs_readl(HOST_IA32_SYSENTER_ESP), > vmcs_read32(HOST_IA32_SYSENTER_CS), > vmcs_readl(HOST_IA32_SYSENTER_EIP)); > - if (vmexit_ctl & (VM_EXIT_LOAD_IA32_PAT | VM_EXIT_LOAD_IA32_EFER)) > - pr_err("EFER = 0x%016llx PAT = 0x%016llx\n", > - vmcs_read64(HOST_IA32_EFER), > - vmcs_read64(HOST_IA32_PAT)); > + if (vmexit_ctl & VM_EXIT_LOAD_IA32_EFER) > + pr_err("EFER= 0x%016llx\n", vmcs_read64(HOST_IA32_EFER)); > + if (vmexit_ctl & VM_EXIT_LOAD_IA32_PAT) > + pr_err("PAT = 0x%016llx\n", vmcs_read64(HOST_IA32_PAT)); > if (cpu_has_load_perf_global_ctrl() && > vmexit_ctl & VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL) > pr_err("PerfGlobCtl = 0x%016llx\n", > -- > 2.30.0 >