Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp19472pxb; Wed, 24 Feb 2021 16:56:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvIYnSiKTEAovSwTcjI5W83frYJX0yLtK3nrgg2X24qoYimsOeD/m+Pkjjxb2zs2Yx4ry1 X-Received: by 2002:aa7:c988:: with SMTP id c8mr502720edt.218.1614214564525; Wed, 24 Feb 2021 16:56:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614214564; cv=none; d=google.com; s=arc-20160816; b=Cm7CiKbzzA6w0QeF9FltlyvWq9JgqPYXA7Ob/YTSMztIHHQ92qphQu9765gjEq2Wwj O+3mH1V0fXfHQWmylI4cfAUQqX3av8K7u3RfRhMpCxb/Gju4lPFW7JHrNdYqEvj2j5lt /HuEjgKqVQLkD1JA5MTVKI3NCJInEL8lx1eG130yqStrCRwmHcrhaEAC2A8nkJidK0/i 3DlQBGCaTRTJITUq9+bV5JiDn9AS6yFUWjAJBd/S1LM9+wBCFx+5DEcoHMRI/dBFP5X2 KuucDsyRb80KTAbcy5PmWQzhLlyFj330Jutbl5nwKWLoyTVnM2v5Ly2vnWtXTMgcd9b6 vDmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:from:references :in-reply-to:subject:cc:to:dkim-signature; bh=0wojTu++d3zG8QHPBKHQdj7qcA4E471xrkGjRsrDSb0=; b=LXcXgf1Bcvv8PbibfL2bnY0+vqZOqP/zffuk0uMI7FHyflV3fW0hkxavOJthZRfldp WhDrHCOHc6rOMo3VDdPIjab89PuAWuF7bvfbyY8jwhgnzlvEua3LcW+WkEtx0VeZ1a8I MavSkepJBMp9lqsuaqBFwVl5t037V1YMYyKYfO6+xebzQxiEpYXgiDlUwn8tUHk0p7A2 MnM0KVW31cvY7T1XWCpkoPvsEwv5DxyE32N5MuRh5nfdqR7SSTvW6QuYdOqQ03BtlmUv JGH+gonOFMNgiLaMQJYBdT7r9SpCKYd7mU4IQ5vV6yqMVin/lMIB3FyHnMPLokNcEJQH 4i8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dme-org.20150623.gappssmtp.com header.s=20150623 header.b=oZd1EcmH; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id re10si2376666ejb.493.2021.02.24.16.55.41; Wed, 24 Feb 2021 16:56:04 -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=@dme-org.20150623.gappssmtp.com header.s=20150623 header.b=oZd1EcmH; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237301AbhBXOtJ (ORCPT + 99 others); Wed, 24 Feb 2021 09:49:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237180AbhBXNew (ORCPT ); Wed, 24 Feb 2021 08:34:52 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4499C061221 for ; Wed, 24 Feb 2021 05:31:13 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id l12so1909433wry.2 for ; Wed, 24 Feb 2021 05:31:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dme-org.20150623.gappssmtp.com; s=20150623; h=to:cc:subject:in-reply-to:references:from:date:message-id :mime-version; bh=0wojTu++d3zG8QHPBKHQdj7qcA4E471xrkGjRsrDSb0=; b=oZd1EcmHmtQPmA9Pu8sMJZLsld9SX5t3gJrkLSULaOO9WgLtecjPiTY99HLEv2kSYy SizvE1GTXqP5veBcF5toHTKRgB8qF9OrBfwYf1pEa6j17wGznSMGSsna7cPXVk9UoIVt zffxefVmWqam2Pod7wrUyjsi9KH0y6mqvhOkQuKwXtCnJvT/DKddlu09ec2ED7F4TyDf /pPHQNXenaslou5LTLM8FAGQpKzoQeAFudiS2UlRS4VEyOBR4HUku5IoE9GljD5v8oo+ PF6SgvdkmpcBmV+urNG8Eyfce456yLyRKyqet24NiKjdcUST+PLM3V1H78B+vyl5regy V8Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:subject:in-reply-to:references:from:date :message-id:mime-version; bh=0wojTu++d3zG8QHPBKHQdj7qcA4E471xrkGjRsrDSb0=; b=LLP3n/+voh1U1XWfzolpn1S8QmZdF2wrj/mKCZonNPAwfjIHljfFzrbqkal0PUQRke KkfV8Tbknf2V5DC0JRARjOGmTIxIUZ79RpgVQyRlAqXjX80YwCfnPyjYvXd2hlPNzYV5 bBIRFUidgiSDXylVebldVbnWH+Vo8Ofe0VKmZGstTChOTwGezZHCZMFFLoVqUS4aLDA8 UW8lr+ib8SbJVlLzbE0inVnXt6QHEt9xeB1AzehHxcQVljMgGaYA4q8l/XD13s7TavUU 4gNTompAvf4a0L+KF1Bl/X0XNugBPMkmn+qPeyiNaji0m34nEoAOD8RatGy+AWko4BSb yAIQ== X-Gm-Message-State: AOAM533T4hLg6O90QnvsvU0h7Cfdyc94SIIFGFmp9vfZ10GGXJcTMirv OQ0ZJAue709uOboolwK/0EswUg== X-Received: by 2002:adf:f841:: with SMTP id d1mr2607478wrq.36.1614173472040; Wed, 24 Feb 2021 05:31:12 -0800 (PST) Received: from disaster-area.hh.sledj.net (disaster-area.hh.sledj.net. [2001:8b0:bb71:7140:64::1]) by smtp.gmail.com with ESMTPSA id h17sm2842251wrt.74.2021.02.24.05.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 05:31:11 -0800 (PST) Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 68da51e6; Wed, 24 Feb 2021 13:31:10 +0000 (UTC) To: Sean Christopherson 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 In-Reply-To: References: <20210219144632.2288189-1-david.edmondson@oracle.com> <20210219144632.2288189-3-david.edmondson@oracle.com> X-HGTTG: heart-of-gold From: David Edmondson Date: Wed, 24 Feb 2021 13:31:10 +0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, 2021-02-23 at 14:58:29 -08, Sean Christopherson wrote: > 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. Added to v3. >> + (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") Added something similar, that makes it clear where the value came from, in v3. >> + 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 >> dme. -- And the sign said: long haired freaky people need not apply.