From patchwork Fri Feb 19 14:46:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Edmondson X-Patchwork-Id: 12095527 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3885C433E0 for ; Fri, 19 Feb 2021 14:49:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A9CA264EB2 for ; Fri, 19 Feb 2021 14:49:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbhBSOst (ORCPT ); Fri, 19 Feb 2021 09:48:49 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:52406 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbhBSOsh (ORCPT ); Fri, 19 Feb 2021 09:48:37 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11JEiHRq111906; Fri, 19 Feb 2021 14:46:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=qSdaWzW5cW8G5XAjhyJLFR1zacYsNYVnJkFu9y6tB2I=; b=nlVoSlsWhwtDHZdpxgKxONsmwNRgkIbSi7BMwbuURH6Fxf1c82xvgjRJsNRtf+egJnNT 2sZZ2ZG17dMski+LvfXb6Ulk2mhPk4nx8y5GyOALR9rOT644FfuHDekeIkkcPePWCJNg uG8HTb0v99X8p6InRpuhjs9KByiBVl1aNTy/qXfweZdURJHjLdBzJFg76uVzLc8kHtym hZsqtG+Opq1haKEQAwXdJV1EUQ6lgBhHydBPXkagQslKS9jMG3ED5+jG/LyfzX11b/Xk Z64AljQ3YZ+yOerAOIX4X+mi+G2ajqUWC3ECw2dpmsfH+fWMweohbh12i2ljM3nVCAbr Dw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36pd9ah87f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Feb 2021 14:46:44 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11JEkKfT112347; Fri, 19 Feb 2021 14:46:44 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by aserp3020.oracle.com with ESMTP id 36prp2yfsj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Feb 2021 14:46:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JFONimb+hmI3GxtrM57orRREZZfySd3s2ill1hRZ3+lplFGNgGfjE/cgyiZKhr/M8w9Qqo4eLqw8s6eJ3yDqKsZ/8EG4xTkacPOTha2YPckVsbyM8fTeA8yGxmBvpvoeqzWMa5Zt5gz7aUtDoYOJ4ofMGrP8tCxDo/bigWJiYlF2ltoDN0j/5lnn7etYH/6SgecDYJXutvrSMezB+fuEe24Imco5WF+7ekW0oNMPGexXdE/2mA4brGSt9AsX3hY9/0fUGpE6GXD84v2hSUb2fC+Deq8q8E+Uiqd201FmN5CVLVWgC7qk0zKoz7lGO29K+1SI6Qqif5nmJAcLR5VeLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qSdaWzW5cW8G5XAjhyJLFR1zacYsNYVnJkFu9y6tB2I=; b=FNUZzcJxvV3xZSgEfpTxXT9NRElOOdEXaTlfBgX4YUIHppJwQ4xtmMYpU45Jk+++KI6aXUUhey/UFrNmf2B4MaDaKRp9OOWgaj9NKMDb9H3r3iDKlw79V3hOjK9OfVi9p+9xIqAWc0I/1BLAIyw22t8qR3rtdUvVYnnSegR+wvESn+6wy7XVjI5iwDsP7+YwW4+FN3UbhRxIXXR3fL2EQCu8LVdsGMAkkK2eCdWstXJnEF7qrzxM7/0oLov3yXzv7IuvbWAWy5sBMYhVJ4yO0t072T6JgDhPi7RTYR4LR0JkdsgG31q5iDWMIy3/4UVm6iSGXblC2kj3UCSz1jeXvg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qSdaWzW5cW8G5XAjhyJLFR1zacYsNYVnJkFu9y6tB2I=; b=vEQB7x98m57fW4peUP8SYQMxNxnAihq4UfINySnCdW2wxBcCklL0kd9Nnv3s3mOylfIK8MQsRuZaO9+Ufw3srxYBR3zqf7ADFIhkUVoWV6Fj1GqFJTF/1R43Ki7VvLZhKQs5J7T6Xhni9rjYf71YuoB7bKjpM23WzfWTPgHH6Ts= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3148.namprd10.prod.outlook.com (2603:10b6:5:1a4::21) by DS7PR10MB5280.namprd10.prod.outlook.com (2603:10b6:5:3a7::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Fri, 19 Feb 2021 14:46:42 +0000 Received: from DM6PR10MB3148.namprd10.prod.outlook.com ([fe80::f871:5965:2081:3934]) by DM6PR10MB3148.namprd10.prod.outlook.com ([fe80::f871:5965:2081:3934%5]) with mapi id 15.20.3846.027; Fri, 19 Feb 2021 14:46:42 +0000 From: David Edmondson To: linux-kernel@vger.kernel.org Cc: "H. Peter Anvin" , Joerg Roedel , x86@kernel.org, Thomas Gleixner , kvm@vger.kernel.org, Paolo Bonzini , Wanpeng Li , Ingo Molnar , Sean Christopherson , Jim Mattson , Borislav Petkov , Vitaly Kuznetsov , David Edmondson Subject: [PATCH v2 1/3] KVM: x86: dump_vmcs should not assume GUEST_IA32_EFER is valid Date: Fri, 19 Feb 2021 14:46:30 +0000 Message-Id: <20210219144632.2288189-2-david.edmondson@oracle.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210219144632.2288189-1-david.edmondson@oracle.com> References: <20210219144632.2288189-1-david.edmondson@oracle.com> X-Originating-IP: [2001:8b0:bb71:7140:64::1] X-ClientProxiedBy: LO4P123CA0428.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18b::19) To DM6PR10MB3148.namprd10.prod.outlook.com (2603:10b6:5:1a4::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from disaster-area.hh.sledj.net (2001:8b0:bb71:7140:64::1) by LO4P123CA0428.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.38 via Frontend Transport; Fri, 19 Feb 2021 14:46:38 +0000 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id e8c9f414; Fri, 19 Feb 2021 14:46:32 +0000 (UTC) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 96188673-0a66-41be-454a-08d8d4e52a82 X-MS-TrafficTypeDiagnostic: DS7PR10MB5280: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: De37E6NRFGkJ+jqCMb8+uULTi7B5FOoinV9MU0y0C+iQw0kWYjDVHWs6DqfB/jtqMVrKmjkBGvbOiEJGeser48I9aOjow3l+J/88q1LX22lAZUKQok2DyPr1BMyAIvoaKxH6xtGGWlIa1aIpUqRIRrj+5b7lRCr22PiugXFT9wucl+22pgcwvnHyPAHz8tNdMl/d4MRv8m843myEFQZNiD+tSGzXRHtKT/9CKdyJ564x3cyAfirnqmqJ+E7njosjOmKCMuocUq/ss1w5+k+zMMgi1/ySOzLq1DC298IlPirn5buhNAgZOQv6rqT+xrD/Kxv5Xn3FO5J9qFovJuwgaMWjBKSlZ0AtHvizarjBX6NoWh13dkvx491RaKiu01Mn+2ttKqy8cr3DdyFmVKqCzGXDr25WZZ2+nLdifXFcWkrW7hmoxSM6BV+6EFvAGWIJL6psJwryFalAJu0K2OQDiwP0YZZhJcGrArwSN+JwpKpA08Lk6f6kgu/uqA2igEf62gIkagNGmrmnKvel5xgsuA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB3148.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(39860400002)(396003)(366004)(136003)(376002)(346002)(86362001)(44832011)(54906003)(316002)(6916009)(2906002)(66556008)(7416002)(8676002)(186003)(8936002)(36756003)(2616005)(52116002)(66946007)(107886003)(1076003)(478600001)(66476007)(5660300002)(4326008)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: IWdMuuZkXJO2bvA9CZzaNc55ajy8vY91uDz9rjCuH3nyYLb7zI2H9HkveHFdnSPk/cTzc91rhwRR53R+3dfq3EZPoV3ErIl3myv5MSEe+3ybceLYEmuXAR9JuB0vRHtHOGqweSESRPifOe1DViY2rfNdYmxT16Ueix74RLDMzLjICRiEtZVzpORzeY3t3nBLNZuH2bwCMRrwDcavjt6XqPE8+HVE/tjQNpybDDwTXLfxl1mNbjJGKgCMkiAwtSH4D0J+BAiUgIuUPfM9OEkW3qxDWEAvK8YT8unSKa3L5p3dSbFALQZ/YjdxYL7lLf+LNJO58Kq9amWO0zccPFDCL3pndbONYZTYVMxQC24z8VINZB+iOE7Pu40zMQRDGUZnyuDIFfinAwjeVji1qxdXgLMJCRFkZgpIdq0NCBCceouWeIEgzW8482e0IwMU985NhLpR1AqLbduytzC9AeEqTRjHqralpncUv/F8Afnyigc4VaK55MQ13IOYem2rs5OwF49r6kOoNLcNKHYONpgFhD2AxUtu/duFTQEZzOTcESdsAOjqcsNNsRwTqkjHX1ZIFsWIdhldhMCWc2EtS+/Znc9XzB3SdKDcQFk6BeaeadPs+cpRZmdudF3uMI46jIkBM/3K1Pkfy6SKP7XPj3CVvKcnyVJnC1KrQQY0mN+CsKEVcWXfdckqSnqCj8x+wUykNNYMDVp0F2cqkBdGhpPtroykz/0A4HXsqCT/7f7/vifKDxTXYOjvrY2QJ82+KUrPqRlUHRS7oDD6Jd8v+uBTUcHaedKTiZ9FKX/UBZOINnNkgJm4BNd/QC9CkaKhAz3kaNY2IXKUSME/hM/y9vVmpvQE/yf6fPrcPbvjWL2nylq5tMpBkLzlA6CRZgbdh32PyXpdJ6FzMt98aC5rXUaB8+Pq/vOrPVLARG81dOazfSTWVRIsLHljOy6uK9m78y0QQioZb9I1WUk3gv9muBAgnVvtTw2VwpwzCRleGAWz+/IjoEpmuc+P+OyYFRFjr9Un8GMx/hzdVjLAonQLQxn2LVSsACpqWBjCEhyR0Cn4+yA3GISGStfuQ0IwX8479m82PSmaJIIOOpquMBWRq8yxuhj1Mc1L+YshGg2yQvgwPagvW3K4944Zz6Nb6L69tFLNlbKTXVBjkDYiDubyxUC+8liOR3GoptnNl81CUMLXczyc1ML3xenlvw6nwqHlZzhVZ0I+XWnWczFg61816GKgdazjXVJiX4Op1niQkNJPH/hgD/TVsqlUyQrvVn3/Yu8YBdDAfvofzY2wZ7/9BxCdF6PH45wOjvhmozZCmRo5EpTU7Je5wn2mN9saSdxiY+Ib5ewHAEn4MPmibS4MqwJNUw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96188673-0a66-41be-454a-08d8d4e52a82 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3148.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2021 14:46:42.0562 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Q3JCiOl+SZicH5ahM7SxzI5C8+XFSJguP/vS/0EwFMo7PB61CI1o8PAztJPMTtV9XjpTIrE0D+BKu6ByssKkI2lp0unEq/0HtgEi9SK7on0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5280 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9899 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102190119 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9899 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102190119 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org If the VM entry/exit controls for loading/saving MSR_EFER are either not available (an older processor or explicitly disabled) or not used (host and guest values are the same), reading GUEST_IA32_EFER from the VMCS returns an inaccurate value. Because of this, in dump_vmcs() don't use GUEST_IA32_EFER to decide whether to print the PDPTRs - do so if the EPT is in use and CR4.PAE is set. Fixes: 4eb64dce8d0a ("KVM: x86: dump VMCS on invalid entry") Signed-off-by: David Edmondson --- arch/x86/kvm/vmx/vmx.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index eb69fef57485..818051c9fa10 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -5759,7 +5759,6 @@ void dump_vmcs(void) u32 vmentry_ctl, vmexit_ctl; u32 cpu_based_exec_ctrl, pin_based_exec_ctrl, secondary_exec_control; unsigned long cr4; - u64 efer; if (!dump_invalid_vmcs) { pr_warn_ratelimited("set kvm_intel.dump_invalid_vmcs=1 to dump internal KVM state.\n"); @@ -5771,7 +5770,6 @@ void dump_vmcs(void) cpu_based_exec_ctrl = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); pin_based_exec_ctrl = vmcs_read32(PIN_BASED_VM_EXEC_CONTROL); cr4 = vmcs_readl(GUEST_CR4); - efer = vmcs_read64(GUEST_IA32_EFER); secondary_exec_control = 0; if (cpu_has_secondary_exec_ctrls()) secondary_exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL); @@ -5784,8 +5782,7 @@ void dump_vmcs(void) cr4, vmcs_readl(CR4_READ_SHADOW), vmcs_readl(CR4_GUEST_HOST_MASK)); pr_err("CR3 = 0x%016lx\n", vmcs_readl(GUEST_CR3)); if ((secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT) && - (cr4 & X86_CR4_PAE) && !(efer & EFER_LMA)) - { + (cr4 & X86_CR4_PAE)) { pr_err("PDPTR0 = 0x%016llx PDPTR1 = 0x%016llx\n", vmcs_read64(GUEST_PDPTR0), vmcs_read64(GUEST_PDPTR1)); pr_err("PDPTR2 = 0x%016llx PDPTR3 = 0x%016llx\n", @@ -5811,7 +5808,8 @@ void dump_vmcs(void) 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", - efer, vmcs_read64(GUEST_IA32_PAT)); + vmcs_read64(GUEST_IA32_EFER), + 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)); From patchwork Fri Feb 19 14:46:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Edmondson X-Patchwork-Id: 12095529 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 170F6C433E6 for ; Fri, 19 Feb 2021 14:49:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E4DBD64DA8 for ; Fri, 19 Feb 2021 14:49:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229879AbhBSOsy (ORCPT ); Fri, 19 Feb 2021 09:48:54 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:38412 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229623AbhBSOsh (ORCPT ); Fri, 19 Feb 2021 09:48:37 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11JEiRhf128083; Fri, 19 Feb 2021 14:46:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=dxyjeu3JKw9yt7fZClQY/ky5GyInLZU30fclDLgUwlc=; b=DYsAnvsA9eSuKO8kF7xWgGA3ngr4sVuUOZK7Enoc5wblou4tlFmmZveMbGcOfdGc/WZL 9yQ2Zxp4d044XRj9DJXqKl8BWoIx0+nh6B9kPDsEcGhpksnacl2WbjVi4oGtdjSthVJ/ +S2T2+pbRhSGJR5eCrUBksirDrjtec/eaYYgTMhIRhjQ5m33sGSNemVoxo3KR1Q0t5Ie Ga85r4oQaAgqKyNmI+MP8YwYW0gv8y3yV7qkU+079ubYKxVyxW8/SwVlSC2ZiU7jQtAO WtBv+1KrNPAq1VesMUOz9Jz2ZzkohgBoX955gJKoxprV3dLyOK7955rS1pu7jmaGXCyF QA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 36p49bhvqp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Feb 2021 14:46:48 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11JEkL59112548; Fri, 19 Feb 2021 14:46:48 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2103.outbound.protection.outlook.com [104.47.55.103]) by aserp3020.oracle.com with ESMTP id 36prp2yfu5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Feb 2021 14:46:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D1tgNyNW9QsGj5hvgv0KCsn7kja8rRGqU83hMN5Luj5ZpwbXToCXvZlflxT6DxgTfjEnUwMYT9XxrszmgjFJwKCK2dTeYHIZjg85hFi/MoI2i5tXjpkl4S1e7hsgWnR2FOrVWzAhITyiJH4ldWHjNct2NQtDhNZ62qXr+EVWO9TPGkkEzjr/aK6PF7/T2l2VMcdv8nQv8DweCNokQzirLEZ9rJuG4PDYgTjjuLSWlu5QAFJ3GZDcYAO5sHXicduTHPmV3A46srJMmSkw8HGEu4Yxl4/R49OrQoy9mCipUloHnXOk/E+Dn1H9fu3t8e8sPa3kd8wkCQqvf6Vl5OaVzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dxyjeu3JKw9yt7fZClQY/ky5GyInLZU30fclDLgUwlc=; b=ZwsVN6Ok35Cki+69BGLadHg+kx3vd77eFCKIoaoigw2WYns2ECWXDGtQytU+EFGop/tugvDRzBT6vxqgaEXXfpjhrBj1JR6mmUe0y5areUmAAJaF6mrPz44cJ3f1Edseoa8kI2oy4Wd/Da6WM8ba05muBPYhY0YrEJVpHPowl5RmrnOy8IYJn6WmwzKdBPg263E9SkMef/k8TIF59QMkiB6A2mvuPRg5TXee+wUWoP75cAfPsEZgfvNB44I47wgyzMWWc0kwP6cT7li7m85381e0U/sdgEOJ1BHrD9KTFEkNUW5sygFXubj83LYdqVQgZ4FtJPb9vSGz++hd3f5zcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dxyjeu3JKw9yt7fZClQY/ky5GyInLZU30fclDLgUwlc=; b=iMZOv5hTk73DGsPXXttLYkzqNyiOF2i6lDHJW9y0cXokc6cQtFgmNB4eHdUWPN+Yj3t0wiSvpGOnS+Qd4Lm0ybAd3oKVHljH46m4AUPmSCX3CRTqJLnTmG4gBmQcKf7wY7OzADf4Z/TWxjdpXsaHiQQG5THKwiLTtM9FW6sIlyw= Authentication-Results: google.com; dkim=none (message not signed) header.d=none;google.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3148.namprd10.prod.outlook.com (2603:10b6:5:1a4::21) by DM6PR10MB3466.namprd10.prod.outlook.com (2603:10b6:5:17e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Fri, 19 Feb 2021 14:46:46 +0000 Received: from DM6PR10MB3148.namprd10.prod.outlook.com ([fe80::f871:5965:2081:3934]) by DM6PR10MB3148.namprd10.prod.outlook.com ([fe80::f871:5965:2081:3934%5]) with mapi id 15.20.3846.027; Fri, 19 Feb 2021 14:46:43 +0000 From: David Edmondson To: linux-kernel@vger.kernel.org Cc: "H. Peter Anvin" , Joerg Roedel , x86@kernel.org, Thomas Gleixner , kvm@vger.kernel.org, Paolo Bonzini , Wanpeng Li , Ingo Molnar , Sean Christopherson , Jim Mattson , Borislav Petkov , Vitaly Kuznetsov , David Edmondson Subject: [PATCH v2 2/3] KVM: x86: dump_vmcs should not conflate EFER and PAT presence in VMCS Date: Fri, 19 Feb 2021 14:46:31 +0000 Message-Id: <20210219144632.2288189-3-david.edmondson@oracle.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210219144632.2288189-1-david.edmondson@oracle.com> References: <20210219144632.2288189-1-david.edmondson@oracle.com> X-Originating-IP: [2001:8b0:bb71:7140:64::1] X-ClientProxiedBy: LO4P123CA0496.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1ab::15) To DM6PR10MB3148.namprd10.prod.outlook.com (2603:10b6:5:1a4::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from disaster-area.hh.sledj.net (2001:8b0:bb71:7140:64::1) by LO4P123CA0496.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1ab::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.38 via Frontend Transport; Fri, 19 Feb 2021 14:46:39 +0000 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id e21329c6; Fri, 19 Feb 2021 14:46:32 +0000 (UTC) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3409b1ef-03f6-482b-735a-08d8d4e52b8d X-MS-TrafficTypeDiagnostic: DM6PR10MB3466: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:389; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aXIV4J5AJkRQPz8LHXeeJxN1nffPmK5qmdnuMmgunDKzK7OBd+ha8F8iLE8DDldqhRfk4NK/zFTAfF7JG196q8B1hu95z86FE0NIswcSC2pJI5wUqViwWdKDR4Da/EpgtIQzq+m0mdAhAdinxuodqI2Bqxxs/gFwlo8V45LGvYYuKq3jFg0xk3VVuPcuE8VNIxY5sPGN3PEDJi2+hMPRkLNsx1oa642FLykkw/2Z2PZniTxJQdoVdQ4surmPwk0xAhHhVw5+hd9QLYaNfkOQDqpTOA/QbEl6Vb83AuUwKXakSnjZTsgdvzKSh0xkb18lG7AnkvRf0AelOYcSEXHcKZAhSWaYjqpDh2eoO2vDrmPO88lBCLn1VDsdhaHp0mNr6wSJpniYZqE3U/i9/K/xlnx7UbUQnOqBxTidedSxwohVI+A6ybNc3FefHDXtCA0xGG/Cs4yKoinK1T0F7D2x24RPQReAO6clGOP6egt147942GxtVZQAnEckutGOIfPSRQHkaFl5fRyYp3Bd68DJuQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB3148.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(396003)(366004)(39860400002)(136003)(346002)(36756003)(316002)(478600001)(8936002)(4326008)(52116002)(7416002)(186003)(54906003)(44832011)(107886003)(8676002)(83380400001)(66946007)(2616005)(5660300002)(2906002)(66476007)(6916009)(1076003)(86362001)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 58zySEZsnk9bQRsU6N36ABma2lyMTfbPtSgJk1/AjDwFqOvLzWzqaDSQqRuTdBkOB8PogmhkVYf2UeThVIb0WsKUeCoxeNwWPQ3UChqQ4a6NgGfaB9t0U3Bs2/4jXJvS4QvLo06/TCbHOjvGmKbn8oSIkHLQdqGunRvyuszfDpzC7QV183BGRGiyzs88NZEtewycEEaLejghfFy0V+hSBBsWhvfLYCz6jTB48fWTd9+g/TpfbndFJmVj24/ikOUcQSJtIiuTK7KypdbtRqxpQAO1k/S8yApVpr7ymw/nUrp4aWunAMuXGXYdmpQ5bx4i3XcHkYSUFkQot60hvTmpFSjIOlLs6KEGp0GcGtNMz+IBvIVkF8tangWqiypu+WKzbJHJbGEbnj6hPONZTI6teyStqNxP1g58v33ry76hXpgpaxd4RxH6PLI5tbop8mIgJkF+T3KN3dy+O7gMUQVff4b52B4K8mWGPh8zN8pi1XVsDM4yQuuC0tdmTP3fYatqM+W1HIPlfiOKzJNSGuSGIpLiXcYbX3mtvygynLPw5NXQnkxDSe+bPUyQkpLm4LEwIOXt5E/z45XP4R8jV4v80UHp+dA1HnFYony+/3AvAVlK6zUsGPqATT6lKM90HvrJPBExLQCrvUaacl39qOk0pu3AN3rn/JjdsnP8N1CPLmVlLfFBRDDz/N1USl9LOnkQmH1PRO2keaPyhzzvBXK0DQ+3Kr7aj5QVxe3UKFWBET0Mb4NAHD84aKsNcbDBO06SImSBZSFi6BxZ8SvoobnQY3tZ8JS2DsxNofNPqFUf38g+kz7rjXY9ew4PEE17NwXI/qFMHvCzI0F4VXnh6SJ437FTUdJ9so1/R/rEd1SCwOooIz0f5ZcObHxRkaUFNW/zkgK25I0vfTJd7xi8vGmb9V4As+thlTGrH8lL3FozCCZAfCSOaakUKujeUifjkfHxZXTmuO8nUbYNfzXsHm67DaT40dQpa3iYd0ULpAD0+W1E1vJWp/cO08OmP1GVMZzTz2jqHa2JSm+9AF9QxbgQ3pqjpIDLd2gXxotkBGlz5ARqOp4RrucZ8Hedb2l4AjsQffG61qTWsiHJiuwoJ27ybKc+tpau/TZ5lSgjlRbktkiaHnxWXJSnv2g7mmuJ47mn0N/bgVkIDqRgf6COJ0EfspjVtGaBzqmwlXdfK1s/sXxBx1dSIu36CsdfOxY4/8N98ygZairVBpFgRXfeQj+5FmdVZV71YtZHlCDzOSFQ8kRSuXf+TwuCGrIiopAS+d4xLbZOC9DMeN14Ei066Yjbz9XllBtHVGYA3mNsjQZg6p9IjQypEoCaXb2RS2dZ/D5EDWaBbxXWn+I7TQXpoJEmTg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3409b1ef-03f6-482b-735a-08d8d4e52b8d X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3148.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2021 14:46:43.6663 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gvMs12NMRauluwpSjDGAJZdaH/x2yyrET0q7OsF7UHHpGyAE2Q4lHdAxdCm5Alt9YltiukCPBKs2OEwXV0L6zvYNQz8kardhKj+M9pqV8U8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3466 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9899 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102190119 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9899 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102190119 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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) || + (vmentry_ctl & VM_ENTRY_LOAD_IA32_EFER)) + pr_err("EFER= 0x%016llx\n", vmcs_read64(GUEST_IA32_EFER)); + 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", From patchwork Fri Feb 19 14:46:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Edmondson X-Patchwork-Id: 12095531 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85839C43381 for ; Fri, 19 Feb 2021 14:49:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5FD1A64EB4 for ; Fri, 19 Feb 2021 14:49:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229725AbhBSOtB (ORCPT ); Fri, 19 Feb 2021 09:49:01 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:38414 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229802AbhBSOsi (ORCPT ); Fri, 19 Feb 2021 09:48:38 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11JEiRlH128023; Fri, 19 Feb 2021 14:46:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=QXIBBWVhpomgz5zwYC4F4Lw1Dcc0kxfwnpvDg2axzxw=; b=x99wNTpVV/I2gTizy1wNdZFqrI8fZ+XXCWrTxStKnqP3IoyiRGRu0v42uGgbNGfWMYq1 noG+UunejcEfs6wtTSBaeDIP9Bo1q2Lror16yP/kHG50OboPd3t3HhL9dKJ0dXMI4NhT D/pqx4X1R7lMoIUO7420Hi/uPThfBVrWvY9n7MQrphN5ia7DBkabeUVlMbGK1aO5ZDzp 9k7ejs1qtCYZNCpJkIeG11BtQfuiLcak6qVVF77OpM1z4vUH52QJdXdX2IY+kHgziRTf OrXKwogaC1UICRyBZ+7KaBHxDbY/OZBxT5MwUjqzdk98DdqXPbY7z07ovlistvm4imG9 VA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 36p49bhvqw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Feb 2021 14:46:51 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11JEkDpW144884; Fri, 19 Feb 2021 14:46:51 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2106.outbound.protection.outlook.com [104.47.55.106]) by userp3030.oracle.com with ESMTP id 36prq1ycm5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Feb 2021 14:46:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mrPyusMrnrUmqPl6UVdH6fiyG9DMWZ1h4gwQ1ehRxQB3yKG3YvToLngPepAmizbnYurm4Js9jXJhc8i3DhcZ+EK4uapecf14AlwTuFfHggYNIQLEp2UYLa7bzIsLx5o2MZwVYahEVsjBeTRKdhzgHF6ReLtKcjxRy4DhmqGnpLQPhMM3+5bQxUeApZQL9hBrYK41rKrwdd9sDw9WJ7mDpidGu3oX/GeRUUqrMMuZ4utTwR3L/OmiEZc2aqmKCjSZ22aivj2x/YMCrZFZF9oKi3KgNk9l965IXRsxk4EqDvXmIW0D/cCC7MDqPZvmht9jyc2fzzPMNsWN+3qPc2d1VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QXIBBWVhpomgz5zwYC4F4Lw1Dcc0kxfwnpvDg2axzxw=; b=IyrdvM6ogisW34Q5D8QtJY3Qgye7Y2VzD4PTbb4+Mr0V5cdLqdCsWlfWirZMwY5vR32LIRxdhemj9wvoucHddqbWoUamlenjXoO/mgCJ8Z4l9cQGty19lROpfI8fCGHkfyamj9lVOHQWUadnmy/bLrgtb0b3EwqYUSdjeP4+zUFxx5g4uJeCMgVynQWM2NgUc7pEBhrC+wJ8E0nku2oBnYPs+9+7Sl7UppKrQehJHOnU5FEjVScnNYNNqsDliduTEppNQSro4cskm0DMdsOcrf9qyf9X2b8mPzjZ2s6Vhzb44xzE4ZGM0Kk54XhOtUqj0SencizCAKU6lBteemTXtw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QXIBBWVhpomgz5zwYC4F4Lw1Dcc0kxfwnpvDg2axzxw=; b=aynB/Wnvdqzx9beGl+mcvseuuKpDtVSLt31rt9lcraoQgtKBdyWoVL0c7Rzh3wbJEfFEeYoDzqOiMjYORzq/VDSRVJB/XOj1exhbqZ/pV7OBBZ2QAiGb2woPFubmtdGGqjZ2nFNRYqsY6F3ByPUx9X+FOi9WlWTjBvUvm8mXWO0= Authentication-Results: alien8.de; dkim=none (message not signed) header.d=none;alien8.de; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3148.namprd10.prod.outlook.com (2603:10b6:5:1a4::21) by DM6PR10MB3466.namprd10.prod.outlook.com (2603:10b6:5:17e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Fri, 19 Feb 2021 14:46:49 +0000 Received: from DM6PR10MB3148.namprd10.prod.outlook.com ([fe80::f871:5965:2081:3934]) by DM6PR10MB3148.namprd10.prod.outlook.com ([fe80::f871:5965:2081:3934%5]) with mapi id 15.20.3846.027; Fri, 19 Feb 2021 14:46:49 +0000 From: David Edmondson To: linux-kernel@vger.kernel.org Cc: "H. Peter Anvin" , Joerg Roedel , x86@kernel.org, Thomas Gleixner , kvm@vger.kernel.org, Paolo Bonzini , Wanpeng Li , Ingo Molnar , Sean Christopherson , Jim Mattson , Borislav Petkov , Vitaly Kuznetsov , David Edmondson Subject: [PATCH v2 3/3] KVM: x86: dump_vmcs should include the autoload/autostore MSR lists Date: Fri, 19 Feb 2021 14:46:32 +0000 Message-Id: <20210219144632.2288189-4-david.edmondson@oracle.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210219144632.2288189-1-david.edmondson@oracle.com> References: <20210219144632.2288189-1-david.edmondson@oracle.com> X-Originating-IP: [2001:8b0:bb71:7140:64::1] X-ClientProxiedBy: LO4P123CA0291.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:196::8) To DM6PR10MB3148.namprd10.prod.outlook.com (2603:10b6:5:1a4::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from disaster-area.hh.sledj.net (2001:8b0:bb71:7140:64::1) by LO4P123CA0291.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:196::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.35 via Frontend Transport; Fri, 19 Feb 2021 14:46:40 +0000 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 0c6e3e79; Fri, 19 Feb 2021 14:46:32 +0000 (UTC) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b2e4ac86-7f58-490c-ba69-08d8d4e52c2d X-MS-TrafficTypeDiagnostic: DM6PR10MB3466: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XBcIb/hWE0mLSKq3vm+8ZFtEDFkrtHE2Blqvk8Bz+N/GiyEw5NWxCsovla+iT7ITEWm5NJmELD8FqM26LJKIZVFFNCtiPQ2xlqJnOwsSiT7JRwpDbGIiR53OBA06vcc9K/qf17qVNl9sEsjigg6HeobvFPBwxJqrDEISkkvT54CxmzR090BMC6erKZnkX+kiE0yDihzQcU0unGiG873N1NG8O6z8LlqQoc4BD2eJ5L4EMLd/mCZZTkmnjfSGvvd5G23KBCwB7I5AhxikKp5Q5+a9ggabiJFjMSspwaetazq7xGTa5drsnXZn/CDNOpYQW+SWJ9X//leKE29BgqztT62uSWJGXHPCqMCxexaLqqHaMmwiiapS++MLOHw0MUdU83mPYhV96FmTD/xkdSMp3eZt/vw4j0+v3j0fH7ElCviTUoQ7sY402Gkf8b1aw/knHXr4lgPpD4LqG5pBR/JMJtLIO9dcB4mSGqT4/QbQIkQyJtZBlESBT2cTROcKTP4JHHYjjGuxhpCwRFGXfsxMFg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB3148.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(396003)(366004)(39860400002)(136003)(346002)(36756003)(316002)(478600001)(8936002)(4326008)(52116002)(7416002)(186003)(54906003)(44832011)(107886003)(8676002)(83380400001)(66946007)(2616005)(5660300002)(2906002)(66476007)(6916009)(1076003)(86362001)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: TLgH29Vlfm70jjhgNDtPpY1fgcUjvRw4pATTLKe6/AXnEXgdAyoqKX1jNZDcKjMpZuToQRo1k5Ila5i4TtEZEyZJ1ncG20b4ZQU2iSCqHLXZO0SN5mPqUUwRv8p3bfXvFbP9xhnxb63gqPOlpQR+zoM0kmueVHncvNvZp+3Vhf4SLS6Q0wgzY6g1noUoBYnMmNDqr0ncBdI73gb7B70aQcAbK/Y7sRsOc7dLaBoCaOx48uoMXaPffeLURREu3nzY0V3VG9EfrM8xUc4yVtImtvNITq5P3zrPAaoPW/80NUidCpsRv35JGlH3j1IpgOFDU5qevbPxnc1IdnzCwBKjLLj65wEGMkSFd1j2+OEmxWOAiSkLBqxGiis2jdIokHMKHcq1pwld2ueE4bLjC1XF78NmUeZsAZtgE7fc7HSWv45XuhcumF7M3vl5tBs+qW8/vjngbuFeogeApWuYviJxktSVsroOPlmtNPR1n4aix5J/OdVUnvGgiKSHMOt0ngxI6JSWv5Gx/4YgK5J6BEa6xHv72OlHjJsNyiW/YZOeYNIDuCM9fWnos+TWnleI+UjslNQgcXzewIdZekc0zv+SV29P9tXjGVQkxk+IyIXRN0WH09pPtQsb2qFG9l1lKA3X5+tFAJC8bnJZhajIRfoYdCZ2dCnhRdwUu/6t2jhPJ146fe0B3V3ByNAMhCRcBQCoVHiWwe0LwglM39MpjWkX4Ot4NQg0xqxDtUBGZCJF0u/NpYiIw7STpLM06ZLIuQtwZh+FQ8lofVCL9HX+33pzFX7I15HBwTJX7R3w6i0DM+/qvZpqxVVkKEZ3AxLf50lxmDPvEVsvGm8I1KW+XdKg21FRp6S0S8zfyMPDdDFn4kPZURmARQdOUHAUYcpvEphpN+qAItREULuaNdYw+K7VHQOvbyBd3UaChf+FuoRV99WpmBYTmxqohtb5LfgEZ5w+MNLPoJGs1igPpmOO3gBoDTDrqDvScyMlwi86Nuy3NvPjZmeo6MgubO1q2z+QqiqJ9rrorgp3kDM5J+KqHB1NjUD9ktTImifSbG0stQejqnTiGA64GnfkBXgNKICyqx3z9JdWq0YP7pzBWqyJNY/LDZBshqePpRyj9lPkZlq1K5EXn/JtK8N3eC2gVX5OFZWBsVho68J9MsTqjlnhN3mGcl95fX5MdgyOXdSuKOQxIY8lxgbfqPuQggCfWZinhAzD+oaFCFw1XSzaR5ZdQgSp+psRvkfhzoncwNO5MJOVRR1JB6fr0MEiBD/wHVcScDO2CPHcIHvkYmYB7mpqbEfzsgdZuAeetVTYth/PGokhEwpCSPhRwE940X1u9mWmIk2ATeFmBXL3no67OHnS6FLvXg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b2e4ac86-7f58-490c-ba69-08d8d4e52c2d X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3148.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2021 14:46:45.0095 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: c3XgJmh/ebwjG3VOkrJk4k4f3dAZLmDel5vYY5UG1DsNKpfdyCZq2SOVW0FGjJccamupniFEc4GYN6p1Hu3BRXrscN+00x/TNNVEUtE8TNg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3466 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9899 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102190119 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9899 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102190119 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org When dumping the current VMCS state, include the MSRs that are being automatically loaded/stored during VM entry/exit. Signed-off-by: David Edmondson --- arch/x86/kvm/vmx/vmx.c | 25 +++++++++++++++++++++---- arch/x86/kvm/vmx/vmx.h | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 25090e3683ca..5dbaab73e576 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -5754,8 +5754,19 @@ static void vmx_dump_dtsel(char *name, uint32_t limit) vmcs_readl(limit + GUEST_GDTR_BASE - GUEST_GDTR_LIMIT)); } -void dump_vmcs(void) +static void vmx_dump_msrs(char *name, struct vmx_msrs *m) { + unsigned int i; + struct vmx_msr_entry *e; + + pr_err("MSR %s:\n", name); + for (i = 0, e = m->val; i < m->nr; ++i, ++e) + pr_err(" %2d: msr=0x%08x value=0x%016llx\n", i, e->index, e->value); +} + +void dump_vmcs(struct kvm_vcpu *vcpu) +{ + struct vcpu_vmx *vmx = to_vmx(vcpu); u32 vmentry_ctl, vmexit_ctl; u32 cpu_based_exec_ctrl, pin_based_exec_ctrl, secondary_exec_control; unsigned long cr4; @@ -5826,6 +5837,10 @@ void dump_vmcs(void) if (secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY) pr_err("InterruptStatus = %04x\n", vmcs_read16(GUEST_INTR_STATUS)); + if (vmcs_read32(VM_ENTRY_MSR_LOAD_COUNT) > 0) + vmx_dump_msrs("guest autoload", &vmx->msr_autoload.guest); + if (vmcs_read32(VM_EXIT_MSR_STORE_COUNT) > 0) + vmx_dump_msrs("guest autostore", &vmx->msr_autostore.guest); pr_err("*** Host State ***\n"); pr_err("RIP = 0x%016lx RSP = 0x%016lx\n", @@ -5855,6 +5870,8 @@ void dump_vmcs(void) vmexit_ctl & VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL) pr_err("PerfGlobCtl = 0x%016llx\n", vmcs_read64(HOST_IA32_PERF_GLOBAL_CTRL)); + if (vmcs_read32(VM_EXIT_MSR_LOAD_COUNT) > 0) + vmx_dump_msrs("host autoload", &vmx->msr_autoload.host); pr_err("*** Control State ***\n"); pr_err("PinBased=%08x CPUBased=%08x SecondaryExec=%08x\n", @@ -5954,7 +5971,7 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) } if (exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) { - dump_vmcs(); + dump_vmcs(vcpu); vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY; vcpu->run->fail_entry.hardware_entry_failure_reason = exit_reason; @@ -5963,7 +5980,7 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) } if (unlikely(vmx->fail)) { - dump_vmcs(); + dump_vmcs(vcpu); vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY; vcpu->run->fail_entry.hardware_entry_failure_reason = vmcs_read32(VM_INSTRUCTION_ERROR); @@ -6048,7 +6065,7 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) unexpected_vmexit: vcpu_unimpl(vcpu, "vmx: unexpected exit reason 0x%x\n", exit_reason); - dump_vmcs(); + dump_vmcs(vcpu); vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_UNEXPECTED_EXIT_REASON; diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h index 9d3a557949ac..f8a0ce74798e 100644 --- a/arch/x86/kvm/vmx/vmx.h +++ b/arch/x86/kvm/vmx/vmx.h @@ -489,6 +489,6 @@ static inline bool vmx_guest_state_valid(struct kvm_vcpu *vcpu) return is_unrestricted_guest(vcpu) || __vmx_guest_state_valid(vcpu); } -void dump_vmcs(void); +void dump_vmcs(struct kvm_vcpu *vcpu); #endif /* __KVM_X86_VMX_H */