From patchwork Wed Feb 24 13:29:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Edmondson X-Patchwork-Id: 12101905 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=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 09ED7C433E0 for ; Wed, 24 Feb 2021 14:17:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ACA8F64E6B for ; Wed, 24 Feb 2021 14:17:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235213AbhBXOMS (ORCPT ); Wed, 24 Feb 2021 09:12:18 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:37708 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234883AbhBXNcH (ORCPT ); Wed, 24 Feb 2021 08:32:07 -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 11ODTLcW160530; Wed, 24 Feb 2021 13:29:30 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=Xpw/yhtG2V6Muoah1BF32QpLvcA/5dBWSpMW/TK0kEI=; b=sklgfuWNUDN7lOpUiWYoCJ//Kk4khmFhb78EEKdSEHgZhH95xItW6uTg7cV+9adJcuF9 EoVACEj+EkKGEiYWIATM1ZpB03XY9aXyD4ER1LJK1KPdgETknexmt6DFrvwTJkqJM8u/ gf8aaTlppY/70H+uRLRrRBjgx9QsWPK1CfjzFgxc+LMUykij2JtIG2L1C8CVFAet7Jw1 6aAmg37YwNOE5sh/I1EHZSvSy33b+CohPNePGNOFuAvPvA1Jm5PQWzrXDz+IQj08JpA8 bPKu71tgEZLcUgjthmDw5FFEMQEenI5N9qISW0IKJ5V2AFpbfMmdIaNKzLi6asRL8qg5 dg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 36vr6258dt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Feb 2021 13:29:30 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11ODQBqj184325; Wed, 24 Feb 2021 13:29:29 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by userp3020.oracle.com with ESMTP id 36uc6t4rmp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Feb 2021 13:29:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jnF+fLi51TBoEKapOlVesNwbk6nCyEdjxOUfkD+bWw02N+0ylHmOXrnNCQ4vq62naULIlMrmjDY/5k3Qjyeyt5JrqKat2FMUBYHc5We5vSI31jypB/dLL3ZDLwFJbEqLXL3eLpjhVXr88n9yr2NVgzf7l+/fUKokqdVnZ5SWrC0aPhGHi/Mq9xDdohoQQfSSR8vlK7oV6RAe10TjPfHEqY/VAkaLDLZCo/CV434vi8Cnxv8UZJHFXt9KRRbEZz6yxblF5hb0wr4ybC9GuCaYHjrbfhq5yXEe1ccgLOHmr6I9lFxQt/zyrC//sgt1G1SMTr1Mn9C175I+ev4KtBlfTg== 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=Xpw/yhtG2V6Muoah1BF32QpLvcA/5dBWSpMW/TK0kEI=; b=lFcTWx2IhyfUJqHiNKKo4IiMidJCJOwliLQhBxx4EMbrXnxTjHqMoApVbYSmWLFOFJK9MdL76/lTWjSN3Q38MvBjBLvcYRGwH1uRxXJeYbLFkbVhP9nIsMa9F2zs9qBRJisH72PDCSMTt4DU0dbDaLJ+UKZQ4FAGLH8ivgaCxE476SqLBL6cc7OfOY7iMs12gCtN0EH/NUwJXeeptcJpfj5xrb8tN4Oosh7ilLo5cssCscTIJ2giLnRhcm6iY8/beLmkKzfkUP+bCdz3pMSklwvOXV4GbVO1lbh7O7h4zSAMW2kIN86lplkzNpPYogpihn19KBTvmLIcqqWWhYiU9g== 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=Xpw/yhtG2V6Muoah1BF32QpLvcA/5dBWSpMW/TK0kEI=; b=XpGuBh4sMehdncqAyXB9Wjdr2DqnRgacKPVW9dN3EYpvmM6JqgwvKMmpRKZyBBTFbCkk/YM1/wNmEDsTnE4oVAni04scz1t1pb0JaUuRnf9QuC7ySYCQ5v2vVe0dCE/ZCDTX66+YyIK+Pd/zQAwL7SWGcA0QDrdSu22ZQyHQh/E= 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 DM6PR10MB3146.namprd10.prod.outlook.com (2603:10b6:5:1a6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.32; Wed, 24 Feb 2021 13:29:27 +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.3868.033; Wed, 24 Feb 2021 13:29:27 +0000 From: David Edmondson To: linux-kernel@vger.kernel.org Cc: Borislav Petkov , x86@kernel.org, Jim Mattson , Vitaly Kuznetsov , Wanpeng Li , Sean Christopherson , Joerg Roedel , "H. Peter Anvin" , kvm@vger.kernel.org, Paolo Bonzini , Thomas Gleixner , Ingo Molnar , David Edmondson Subject: [PATCH v3 1/5] KVM: x86: dump_vmcs should not assume GUEST_IA32_EFER is valid Date: Wed, 24 Feb 2021 13:29:15 +0000 Message-Id: <20210224132919.2467444-2-david.edmondson@oracle.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210224132919.2467444-1-david.edmondson@oracle.com> References: <20210224132919.2467444-1-david.edmondson@oracle.com> X-Originating-IP: [2001:8b0:bb71:7140:64::1] X-ClientProxiedBy: LO2P265CA0484.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:13a::9) 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 LO2P265CA0484.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:13a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Wed, 24 Feb 2021 13:29:24 +0000 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 9bdc4505; Wed, 24 Feb 2021 13:29:19 +0000 (UTC) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fcfa492c-10b7-4952-db36-08d8d8c8349a X-MS-TrafficTypeDiagnostic: DM6PR10MB3146: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 021S6outwtCODseOjVexkfWdLsM/0JosKN/oVAsaqyshcGzlE95i2+e6oqxI2G8TKzsMod/dV+kHG9f3xIoKawWji99Tl5oI/ad8toVcrlrtPU4yvKyYOaNPYce1IDWsr0OFv7WZYI/BQTeWdSOEAZegTC/hBH8JDW4y/6fyU4JvuBb0DaZ48wPRYhYLph1k4ATDlDPYrf3lBt0GoUuBwVSuPtUZHRWU+BkSpAL6k+vqAO52+xkFudUxtQQlC+AcmhmhINk3Wndd4Oy227158eUU8Dw6vvNPg++K+Jsi7MJUIoEjFz0/cb9pnD1J4dNDfEc9eZ4fcOypG78tD9xz62uBCTk6U6YoomeMMuI2t7ytba53QN5g2mN0khBYUq70sJvWv3/pmccKHkCx5jPHWKwi4LcSgLD7N6xVQlo/ViSruFi9zQ097M4i8zCVplCSTNwZWc5wvrBfsUyTW4dvAS9uEjyyHIX3kpXD32VKbmSGUTkyjyapnmaaFo9DFb3ve34YiVlRFGJwX03coySvdA== 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:(136003)(346002)(376002)(39860400002)(396003)(366004)(107886003)(2906002)(44832011)(6916009)(4326008)(6666004)(86362001)(478600001)(8936002)(2616005)(316002)(7416002)(54906003)(36756003)(83380400001)(186003)(66476007)(66946007)(52116002)(1076003)(8676002)(66556008)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: sAZETCU/ZXAAmdPX2XXh1FbES28HjFlqt/fkb7Dx4Sty+54zaLCflGStr+0YJKDWUAZls3OgGdz7HflqPFckdi+af+zWJwbfaVxUWoyXI3Chrkz8XpGraBIuZnKkgVIMDcUFrFBzAxrCgkEamJbLhtk9kTErqCsTTy2fa6InSZio/zX6jMVIX57apQbPX1+t8m+MQBY2yxuyRbm1ueU8a4nHLCjN2rMbDmcT27Q5p/g73uz0WYyeXMGqoVt1H5nt6/ptqwpX8CDOrI9v3qEMhTFJEOEw+lA1SbP5IWSC8gjMeZNje2js4wsxP1RLcIZc6W0JVwZ4rHDZ0kjrBrNwMgKMaXQTHktVYBx0iLk7r9vNY9XzWnHqwB4brGBFhuYdPOqjP/x97hNWm8PJuj/oJmVXHolQdS8ejbeYAnbaCc39DiM3HCpQtrcMT+Nq9ydg/BIZMB258EoB4hJU0eMUsAfq0ucsZbtNjiiVx7xcDKb4ibOxjpIxrQlA4IQD04iq0I0BeW0LizJy6V8MkbXxVHKfG4cDAvtS9CCLI/jZm24tfu9IDDzYIzcmWj3c7+yqZI/EUIp2FeoGcaycaO8iF9rz5od8eL8XE4BOacUkK1Dc3K9DDZd0mJ887gOr8KfIEq3j9roAaCHdFejKliI8EH9DKdqW+MktNFqDXhw68NliXodt4gQE87sh0pBdOW/oY06KFnzWE5/F8tlRYnUvBEMa18o8F22qOcBsT8fF03S5a+TRvg7DKRUPrpvFVz8poFfljlE3A0qD8AJWuFHYSsIDj6OP5WFrVYKGNtasuS8JP/saQm02Cfgb2YbU8Xxg/HsHNKaB8ADmqUNt6DYmtMQuf8bituumt+h792Y2QlJLCbvwDbb9mdlITAv27watrjvuWD9O+ekprcSbI9aN6zhkX/g6PHQsBEL2Ym5+4g6ADExf2EnYKUsrC10GQIoKzDfRyHHN203xNFLf9PSp5G6j5YBRxrneXDWQMo3jw8AyfeHbKXYa1YDq2tujhOrybuSSye5tadtLPPojwzhv4b/9bkacdGGO1kyjO/bvVWNE7Hv2i1Jk3rzLT18TOlrCaGVc9JajD1LFQAP0doh1le5DZsKVHi4AIY8zOz7e+gB6rr9LnfP4uA8TbyU/a3XnwNPYdqGxlugl7RLUnisrv3YguQRdKjjtadLEmSYxfvgDn0RdY8lU/7P1S++KAiWXXmHrmaYuFrjnABJ/iDIlyuAAWxgxWcpT8aR4iuBcR6KVWtR/Yddeeaf2baXoMpXktCrgNbD5+saOPsyzwIMhnESVWTECu+OYayLos6MiVR8WoPKnlyF67C6Hv4QVbOuOWvHlXnLYQkn787oNZ9RqHQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fcfa492c-10b7-4952-db36-08d8d8c8349a X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3148.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2021 13:29:26.7064 (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: sNnmQJjGR8G5IQlOYBWQq86q5J4+Uzmhnw0LBOZ4POtaEfD7JRZiPVhddkbNPkv/YcAmgeXQmTAj60pXjGxjry/IOUtxz5wO7fd2nxLORs8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3146 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9904 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 spamscore=0 mlxlogscore=966 adultscore=0 bulkscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102240104 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9904 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 clxscore=1015 mlxlogscore=999 lowpriorityscore=0 phishscore=0 impostorscore=0 adultscore=0 mlxscore=0 priorityscore=1501 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102240105 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 - always do so if the fields exist. Fixes: 4eb64dce8d0a ("KVM: x86: dump VMCS on invalid entry") Signed-off-by: David Edmondson if valid --- arch/x86/kvm/vmx/vmx.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index e0a3a9be654b..ea1b3a671d51 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -5815,7 +5815,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"); @@ -5827,7 +5826,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); @@ -5839,9 +5837,7 @@ void dump_vmcs(void) pr_err("CR4: actual=0x%016lx, shadow=0x%016lx, gh_mask=%016lx\n", 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)) - { + if (cpu_has_vmx_ept()) { 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", @@ -5867,7 +5863,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 Wed Feb 24 13:29:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Edmondson X-Patchwork-Id: 12101907 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=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 72266C433E0 for ; Wed, 24 Feb 2021 14:17:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E40964EF1 for ; Wed, 24 Feb 2021 14:17:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235411AbhBXONQ (ORCPT ); Wed, 24 Feb 2021 09:13:16 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:37080 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232672AbhBXNcH (ORCPT ); Wed, 24 Feb 2021 08:32:07 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11ODTH84051807; Wed, 24 Feb 2021 13:29:30 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=uQYrDyg9OEqr6VqV3M/PSelONwF7ebIT2Lj+DkG0NYY=; b=U+RFkjuv4EyqeJ40qNEXXM7qCbdOBhv+E7cO3sWOmqDYjK3cIoZmkO1XkxpvQ9zHlhE9 4JVEDnbzL1LsxiIUeXmCuPkhCKJm8+0TjphW2cSljTlW/p86vJBxr63fCZ8sfYFmqHcF vt0wY0bxayRelYnbw6KPIKD3xODsg+1n8JQceNXqNOodeNadOe25K9aY+yCoBeQvMDyt ziqcFNmKCiczjjJKtAJ6s2iodYmE7JartZ+NcCxJFQJ8n8YAFwg+5135GHSbcdPXUZM+ W4ge4OdLe+/ee311oG28Ny8bxxYA2R0qnS+nSoX+CIt3kwyxy+P79n6uwuojw9pIQjev kA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 36tsur2xad-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Feb 2021 13:29:30 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11ODQBqk184325; Wed, 24 Feb 2021 13:29:30 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by userp3020.oracle.com with ESMTP id 36uc6t4rmp-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Feb 2021 13:29:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dfo880b+NwJkEycxE4zMLgNbcS5eAUiCBjz0eqhnI3fs3JYA6onUgs//BtZIojLrYhEMVAeh0luoBSj89Mli7q6VIcp7xYW0BOAYtwDMU2x0cleCCyv/RJObiU/TIWZ32qLo3OOGQfeUbTKojMQgCMwXHL11CdllcfZHspgh4gbSaBkRlPjjkUL1Ssa++wIcwwNaehCML+hWiaYn/PpLmNUHVm3VU2BF4t/Z0Z1M6nNyrJ12YoKdGDOZfEUaaqAd5MRCE0f450+PhZMWGP/RU9LVzMcc1erDYLHFtylM6iTiZkBKgs9p8igxvtYn+27yk95Kd2n2He/xM58D/gX2LQ== 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=uQYrDyg9OEqr6VqV3M/PSelONwF7ebIT2Lj+DkG0NYY=; b=NJP5Zw3feN6Qa+bz1T3fqnYsJQN8QOib39nR27aDHh1esvuEk9F7lW3SKVQZJn7hh9cYVHLK45qGSB+96z0LXwPSKZg+ckze+Koe8CAxV4jOe5j6ZbZxmX1TJZOGdVr8GPPRgVgCRsWr96DOhmkye2mbxa5FhedWHyuQd1p3pK9wfGFAVNGh6jgSXg0E/0ift/2L5Yr3fKe7ENelwVxvpA06OCpNT/Xos3MMco0M5OSFZkgEEBthySy7mko3GexB0/wX61QuOkp/jP+snmP3PjUyCabVL54X/uJCDTM3+v52thlVrfr/tx8uPw2tjRoCqQpiAQuAtgPL26mc++DQ9g== 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=uQYrDyg9OEqr6VqV3M/PSelONwF7ebIT2Lj+DkG0NYY=; b=ZzjrGOLyBU2DM3jrSHh+12C4f0rICWiL3M5VmZYpY0QvivyMLA8yxoldjZPo8grwwkOd1ZQRkD39M9EfUlVFlzl0BPKCLUPR3XKX1eTtOaW3v5ssxN9vSkaDOXyIje5XTPngPCW2pbDlqZqJgkpc6CXPYrXk7mWzpXdGoIfb03M= 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 DM6PR10MB3146.namprd10.prod.outlook.com (2603:10b6:5:1a6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.32; Wed, 24 Feb 2021 13:29:28 +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.3868.033; Wed, 24 Feb 2021 13:29:28 +0000 From: David Edmondson To: linux-kernel@vger.kernel.org Cc: Borislav Petkov , x86@kernel.org, Jim Mattson , Vitaly Kuznetsov , Wanpeng Li , Sean Christopherson , Joerg Roedel , "H. Peter Anvin" , kvm@vger.kernel.org, Paolo Bonzini , Thomas Gleixner , Ingo Molnar , David Edmondson Subject: [PATCH v3 2/5] KVM: x86: dump_vmcs should not conflate EFER and PAT presence in VMCS Date: Wed, 24 Feb 2021 13:29:16 +0000 Message-Id: <20210224132919.2467444-3-david.edmondson@oracle.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210224132919.2467444-1-david.edmondson@oracle.com> References: <20210224132919.2467444-1-david.edmondson@oracle.com> X-Originating-IP: [2001:8b0:bb71:7140:64::1] X-ClientProxiedBy: LO2P265CA0155.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::23) 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 LO2P265CA0155.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Wed, 24 Feb 2021 13:29:26 +0000 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 8e0038a5; Wed, 24 Feb 2021 13:29:19 +0000 (UTC) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bf7945ae-3ef3-4646-5e70-08d8d8c835fa X-MS-TrafficTypeDiagnostic: DM6PR10MB3146: 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: htsLsOxjp3QWVU9k2unGxq1Kf5W0cC/sDscQUlUfA+MRK85llgfkp+05P87vRXKQ1a+6vJJcR7vGZy72haUkf9XpYKc2MpI1SMo9u7Y3s+29QLa79KjitFHuaJKKHGMxHzW0WklzsNf0NPEn7tmWKYCxFP+qRPauCGrzW2X3akmpPpUgtmvh1a5KinemtN6dhvhJqtAYC5z7I6yEDh+nQWAOQQrMPdRXlpvqcTm5TLI2CvioeinQV4sR+wdC6+3ZEm3/US+WIio5JB/+jMeyUzEds6sfZP3YHA8x8X3qmDAZRszHBHDE6gtJCj5dkNYEuQQMFUzUXdnxXgeqz9opAcHYlKBgjgaacOFMzNOHojUdoXtyJ4JuuZNUbiaIfS4JkEWGmfB0zUSAP0W7ysvMCUSFvBaXSjx0RiNfm8B8XQZ7JB+GJ3zZ3CMzvElBZ7W/TR4ErM9TaJnbVHMYtw94+b7oCF/n1zREotpo0lE1PMW1ScYSPVYsfR1nNHqo5yOd1d+rxAq54vfYtx1Cb7jk7g== 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:(136003)(346002)(376002)(39860400002)(396003)(366004)(107886003)(2906002)(44832011)(6916009)(4326008)(6666004)(86362001)(478600001)(8936002)(2616005)(316002)(7416002)(54906003)(36756003)(83380400001)(186003)(66476007)(66946007)(52116002)(1076003)(8676002)(66556008)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: xiuDF/6yQNG6VHp9DpOAoiQW6+2GQ+vCRETtXkvKZJOwKsZiP1sL/yLLMZ3htJ3vsNx+vUcrUiKkEeDOH6VxyFm7JRPTHTO38dpIh4KV/hnhmGmsd4Qyb34ua1QhIoMVlKaWmDtVpXnXn25cspfhoyFZ4o8ERjNx+pDA64t7wlMJylR/Ha2A6q2JUiSEgeUOO7HiUhcyJ+xRwEEaVGWtag1mCmKLIPGIqtxgWQZPCq4WaDkmA8rOzV3QQ8/Ir3I420ug84K7EAzPZUcFbqHaOrE8juCiJe00oLlwDdgZ/lmkAmf5vEB9rgXrWQ1w5nLtjFgoIWnynsUSwnqlKp2zXLP3Pp8iJ1tpnkbe6fO7fRb0Z4J2TAV4JnS5cTwE02dgKfOXkQtIw2N1vRZ7XHPYOnkb6TLzE+ApA9oYqm3Ag6PDkitdYou4rMzfW2q9lyMppveh9ieKhp0s2qW5TQitkQUeyEnQbkRynOvpqLfAqPhQQjlK2xMI0AQo+BkLKdcNYgdGkJAsOk7v1lPylwETXSqpqtdf+8G6oTxy7JrFpkCKRKUVLrRZNnhbX1anWDDbsDdY3VL6HLChX3Gr8t091vpLWhJRSoIlrtn9cAiv1qpBVLiRPS9OeZ+1tiQCKxSLOCf9bfYnJEb57/MlKCCaR5riUDGSXG9Al+Zr3xIyNLBSdu1I0ZJvcYlX2tTMOjnTCqyrhPLneekDhOXsm0di2YYVriqlYXnY9vhjxQyzcs7hmSglyUhlV/yp++YvkHCRdVjlZZVacPUqMM1D0grxp3hTx1daUrcCH6FgmJ4I4Vsn0KpFJjVPgS3VRpqAr3efyHKkDhce5GwCzuzN/L4iILH2BhXQl8ZV6kNyL0U/QRsPdn6A+f/wLarPqFPr9Xf8yS/vsGx37oQvf2CH28x0IHMYm2m51QXaH54LTGGbwzDP6As4M7vjGuUppj1hPkciJR+kLgQieN+DuZS26dlu+eM50XlH7tSy2bjSwrdRqJykOejoowdeReq7G+6WDjLXnnWCfTJo/GoZOHjTC6qecvJuV+mItYLGdZhReKSrbAOLDZ0VL7IDBD12ls0hZ1vCIVF6qiybJtMO3cAAxFJPOOet7LlKEcJSaq4sGr7qn/63eS+71dmpPcNKh861lckT9YIKUJ0Cu91oDDZ5BdXRPMTZ2RKDK97ffzKj3YXHmfWPRptCa108VuyvNFwIRc3GFpPUkslaFr16w0UrZ4BOc2aaafycDNcj0/4flp5LqDeQjO49xY69TJrimar5lJQyC/nIpk5FDvs0FFgP8+tJHuryTUhtkpAvKj+ORnL7KDIYX1s/IW10YqpljPzyqacwsFX8aC1z5eXMLLeeYRNe7Q== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf7945ae-3ef3-4646-5e70-08d8d8c835fa X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3148.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2021 13:29:28.5053 (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: brb3UzAABoZwYTi1WdghjiEmGsmH1Se0IA4PKi3pinQfGPY2kUmBuMVRdp5IwWL8LsuSAmyMYoOEBPlyDnNd3GgNr3Oax0vQS2PNAwW+OAQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3146 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9904 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102240104 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9904 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 mlxscore=0 malwarescore=0 clxscore=1015 phishscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102240105 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 ea1b3a671d51..90d677d72502 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -5860,11 +5860,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)); @@ -5901,10 +5902,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 Wed Feb 24 13:29:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Edmondson X-Patchwork-Id: 12101909 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=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 54442C433DB for ; Wed, 24 Feb 2021 14:17:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0BF5264EFA for ; Wed, 24 Feb 2021 14:17:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235511AbhBXONf (ORCPT ); Wed, 24 Feb 2021 09:13:35 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:45958 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234910AbhBXNcH (ORCPT ); Wed, 24 Feb 2021 08:32:07 -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 11ODOCej099751; Wed, 24 Feb 2021 13:29:31 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=x7jHoxULYNkvYJ3IUGDkH0gVV6qT/WpX1EUS0pOtzr0=; b=QsOl/ZWq+C0rYDx6LT5TVbQuH5juUzIx8UVAJVBw1pXpsKLs5cFltln4w8yO6irvnVLP L7gEu+e7V3Yt5Xnhr950uNNL/vBzVJxOjIBiqKr89V464sv9kIQTXp1BQqAmUt9XvWVW XiRnW43Gbq/qBie+iuZ9j4rPKUCSQF7n8FiwJkyknz/pySxWAVlyBVRpexMvfxEiwTSW lIQYh0eHJQho46o1OqFkXadlQ6n/SkFxfzGv0kr7CVjsYuYLxdzV1U0ftUF3AnAGU1Km vz88PO4qaZ2Fk4FA0yQ5arKPE5t2URCjWERZujFtvK79c2WozsoI/VwgtQdLcO+GYzpQ Rg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36ttcmaw3h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Feb 2021 13:29:31 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11ODQBql184325; Wed, 24 Feb 2021 13:29:30 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by userp3020.oracle.com with ESMTP id 36uc6t4rmp-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Feb 2021 13:29:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z3b8bDgffb+T+E0MxYPqTbZiuh3dhGrEmWu38PBa6CicI7Hd0+UI56+24TEF1EzbiakeYTa7woariH4hB0v+7CEtjZXiS56tducLh0+xKtYrCRqQSUnJ8cTYl6lZZZh4deWuJdJTctYzlbzIZVSCGVSrRrrleIS7EdLRyO3uvzNlPF4Fa7Id+KGLy2jita4FziiGMSo5fSK5PgRpSwwZnya26bfKUU7nVHGi8UTO5LyQRJxsDg3I7xqEUZZp0pAloAk2w5R9U83sNIPLykwNdvIRYfKvxPPWQVjrZXlZDC0kNiWvDZJEqY98/oPIQfA9xPAlqtVgH7Nm3bBPuRQGXw== 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=x7jHoxULYNkvYJ3IUGDkH0gVV6qT/WpX1EUS0pOtzr0=; b=chGMivhCfs0z9ruSCGAP3pHbMXuvX2pgLohRJnjYMLcJRihz+n6WCZNnCOzg/B4ZRww6A137SdCx8g2e8iQKa1ni1B24E28rdUwXin5Eu1ZDTEX7D2lSGEZgp8ZXavyQzlsSuNJ4z1FOU89k3etUUKgnL1SZAJvBcZ1zay08svT2y8qsuQ/5qRG8y11+OTYWLPeJBGTZKnH2m2zizNg9mI50+xv3URu2CAonHYvb7QMW6TvjXgFvrkA/fsWf6lgy5j+Rtxln+TACFUP6tAz6Zwp5RbRrRjJr/Lb0Cx+uBcK5rwLK8B4YbMusH2rHMAOphijJ5k3CoqZxJT1ehnfKvg== 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=x7jHoxULYNkvYJ3IUGDkH0gVV6qT/WpX1EUS0pOtzr0=; b=LA9H87mj7JidCqBmy3wZCZlZ7Pm/DEsxqIKjWtWwLFnxOIYm2hY6a+2/6UI6TJ+f+SF7FSHUIpJapnJFDUzwXMWHmURP16xawnVXr3eQSOvql2A2LY72+Eg3diDwH1A9n4RsnI2+neqoojRb4PLlzKkH+aGQ1D4ddsiHGcJWqMA= 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 DM6PR10MB3146.namprd10.prod.outlook.com (2603:10b6:5:1a6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.32; Wed, 24 Feb 2021 13:29:29 +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.3868.033; Wed, 24 Feb 2021 13:29:29 +0000 From: David Edmondson To: linux-kernel@vger.kernel.org Cc: Borislav Petkov , x86@kernel.org, Jim Mattson , Vitaly Kuznetsov , Wanpeng Li , Sean Christopherson , Joerg Roedel , "H. Peter Anvin" , kvm@vger.kernel.org, Paolo Bonzini , Thomas Gleixner , Ingo Molnar , David Edmondson Subject: [PATCH v3 3/5] KVM: x86: dump_vmcs should consider only the load controls of EFER/PAT Date: Wed, 24 Feb 2021 13:29:17 +0000 Message-Id: <20210224132919.2467444-4-david.edmondson@oracle.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210224132919.2467444-1-david.edmondson@oracle.com> References: <20210224132919.2467444-1-david.edmondson@oracle.com> X-Originating-IP: [2001:8b0:bb71:7140:64::1] X-ClientProxiedBy: LO4P123CA0181.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a4::6) 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 LO4P123CA0181.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Wed, 24 Feb 2021 13:29:27 +0000 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 34ad29ef; Wed, 24 Feb 2021 13:29:19 +0000 (UTC) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e33c3c78-703d-4c17-c61f-08d8d8c8367a X-MS-TrafficTypeDiagnostic: DM6PR10MB3146: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2449; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GS0PKvA1pkTZ/NaLPNXahwA9HnjzcouT+HlvGGaWUKKaUNnthbSTTSctaFCAMWrhdgbtbmC7oe2s+bFwzuQLCc1XtdUEHadTNRMeTofF25CE3ITt5njJqbt8ZYzpZc9W1p/mfZQhNsT7f2OsqR0SWahu6XfqRLb+TS/2192GsBXHcHjjSCpnwM9ZNgzJIHGeMQ6pF835F7mkJoZxuAYXH9H1KpEKpS+deMWtvF0LXsyHpvXz9BtqqQwlLIfZ7+jrVgTqU5sFQnUI9NPlnSRjpTzkpi8QdjJTXHU0ciZ6kI4ozX3jbAHqhp+dUIDpVXK8fDNNWVnIn/R1MuwP57isl3ePBmBTSOz19YH4/Y1rH9SMKyDYsmemGvqoyxxIcFg8ZfsFE6VyLBhxo2ysFEdbmm3iWb6L8AJO9CV4ObNe2ewHwaNMbTS8EB6EDkm+SMbruXKFvYQu5DJ5yJ1W6tzYmFVr4DeOUktSNekinvSrdI68QoF5JxblKYymyiDbFa26fVBTTuhrMfpfAHDaNfk1Gg== 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:(136003)(346002)(376002)(39860400002)(396003)(366004)(107886003)(2906002)(44832011)(6916009)(4326008)(86362001)(478600001)(8936002)(2616005)(316002)(7416002)(54906003)(36756003)(83380400001)(186003)(66476007)(66946007)(52116002)(1076003)(8676002)(66556008)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: L8v+PuZbvhz8/hXCBmZFlaOKks71q+drVcG/smG4flArv8NiGOONcfA+KGuq+Ze7CoFom1ifDmmoCEOFnfbkUDojLw3/tB1eJjFA8gfbxvpy1ZwCfCybIi9IEXH5TFuxEOLh1YtC2tuFs0KBH0zwHjJQiJleNNK1E1cvj9XDorTO015BarFYIwXTRvIt/VTTE2n9s47gmx+OJ1MNfb9ojuk45rsThSJ1boVsgZav295j7z9/5I3F+GqKiMn7QW+LYBpKY6LaH75jrflwSYa0J4sbIs5VJPwBtlOoS0EYe1xGtMG7EN7yUCks9fLS+0bR1RC4ooCsYs79zDw8VIBiehwxlCyas6e4orF/0RbUowpojB8N9SoFWyzX9UBX3PyL48k2SSpcotVmAYIrMOox19ysFYb8snbfHAaQE+ZGX9LJnRKu1lkvEfe5HujGvaOqOi0jgW1cXoKyJruCgIuOOcdcpCSpv0b5UIA6GaU3kqIpShcAxHS0apqmqVcYkf3GsBv1eAcXFjOVeXeb1hoXHtySxD+C8xwK0ZiWXik98fpMKluonvyChB8HVkuqwwcbymGKClRTsKyExaJ7cJb7l2IMWfeCfASov1w9q/7XIh1xnvlJhE7VtpAvxFdSOaSJ6/TEKXPKNVPrkhwmUkCkQTdGIvseAtrgb1yQlNqv5QGSsbOl8Gpha/2oSgj3PuTqa+32P/B7H2pMU5ZcVmNQagPd9M6DV9/IJFwgqmOmVuOzG8WIKAUWRS+emKJMRbs776SOMe0RLHNJ4UfpWO0moTBNchtHNaOy2aJzx656eqTWsyFihVeDpXKY5SmUwedAoTpcqWI6ZHjJDZ700RlISSRcTVEMmcQZS/LXB0cxcxnOpF/QYeekoYyg6ns1uiB3k5QrkQ9JbCSOfJsWPIAJ6s+kjaEwNEhNlfx645wQTomuroCuLyMx4LNvi4RKFvB+D3Vuu1D1pzCpT62MOVXYeg1ZjaOMN2EdVMQTiscbSBCzNrfm40QDUO4THPUoaH4UJBJmqmFdlmxtVlMTxkTOEf1dH31K/TFXamvShdf6GfUmWtAVeFKuZU+PJ5wc5LLk7HKGipbOPXdh6HuNGV8XmIXvcnpkYcBFIfPUpR+T6KRvc++dUSt5XXCUNn/996JFEpbg6X/JtOMXv88Hnc1tq1/tuZSpPJw6EG0o/MYw4q158/i7aLpjqVIHr0JjxZ6LV0IFeHesAuC/lr7J8yCbJcQdY78oaI8IQwrFTvuwvtWNcgVVqY5KWD5pq+9rW9x2D+QIxUxXDcz2uI9qTpks1ipWJEaZuBeFxO5xRq7wG8GpxBkR3LcC+KlRKJwSfMJtFK9hgyV2VBVkAfI4gWRuXQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e33c3c78-703d-4c17-c61f-08d8d8c8367a X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3148.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2021 13:29:29.3918 (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: qS7O1M5+lFAopXeKTfQboBoehh5JTQU0UlQx13CeMTwPYShIOS15c7F5+DJ4OgpbKcVEPJbxbfBlj7KfW+o0yOxs9sfbwd6zQhcbqMWBdpg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3146 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9904 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102240104 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9904 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 lowpriorityscore=0 spamscore=0 mlxscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 impostorscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102240104 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org When deciding whether to dump the GUEST_IA32_EFER and GUEST_IA32_PAT fields of the VMCS, examine only the VM entry load controls, as saving on VM exit has no effect on whether VM entry succeeds or fails. Suggested-by: Sean Christopherson Signed-off-by: David Edmondson --- arch/x86/kvm/vmx/vmx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 90d677d72502..faeb3d3bd1b8 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -5860,11 +5860,9 @@ 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_EFER) || - (vmentry_ctl & VM_ENTRY_LOAD_IA32_EFER)) + if (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)) + if (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), From patchwork Wed Feb 24 13:29:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Edmondson X-Patchwork-Id: 12101901 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=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 B3B4AC433E0 for ; Wed, 24 Feb 2021 14:16:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64D9F64EDB for ; Wed, 24 Feb 2021 14:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234890AbhBXOLs (ORCPT ); Wed, 24 Feb 2021 09:11:48 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:37706 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234889AbhBXNcH (ORCPT ); Wed, 24 Feb 2021 08:32:07 -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 11ODSnE4148234; Wed, 24 Feb 2021 13:29:32 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=BmHbFWpCy4zpjT/Wed1GBPgQ2G0Bgz5qE1pyrzTcNQI=; b=w3RrEryIt9qftyXq0sItn9PinBBmnok/bEd4twg/Lbq8gCPTzl7XPNCFUfcy3UfHJcfe 5omidyFntxpL2e15KBYSQ4VWu3PMC0j3RjQiEhsbHJZN67+cW8owtvuVKLByQJb5R5S+ vgcTXLstq63JmAVgKDo9j1rwSGotOBGNq77GD10LRUDlWuAHWzh8+CMBLMVcDENSejwW uTfl2b2eke3pblrXXDB7bOLJZrjaUE+upgfa4EZlNHXQLOHL/o2CQxnbjh4eBWSHAsdH ubcC/HIrQ4fnXCjuZMyWO3v1aKowLhbpGYe5FsltQw2xLuEhkE+VqJhuDiMLc0AK3RNd Bg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 36vr6258dy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Feb 2021 13:29:32 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11ODQBqm184325; Wed, 24 Feb 2021 13:29:31 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by userp3020.oracle.com with ESMTP id 36uc6t4rmp-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Feb 2021 13:29:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FBVaT0YArSZRWBQ4KfnKfK/UxlhpzDXKsfDS38egJkZjiCWfc9GLzeYCcn0sok1T8vmaQcFuy5cBJDVMWzAMKaFMQ4o60XyjpsoSnoUdJOKFI4pbHmH+XflrRVPCwIwRZksZu7FJr9rtQ7mMRs4yFfGLjsr4Y4RZ5A4GlJLFwWpdARLWd+jtxAHF24US4UVOSvGhTLQtekTfh/WVbrykFm7PT3S2XEdpQvFQksxJwUlyoNqdQK1qx1kOZQqqJJUQfZaGJX7lvT0nQ9nbChyc1+S0XiEN0h/ISY6Emx6jNEOTWo2l9wVVSM2kMCuhvl3QXUHFABP+ABgMWz4vK1HugA== 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=BmHbFWpCy4zpjT/Wed1GBPgQ2G0Bgz5qE1pyrzTcNQI=; b=PeKi7/iEw+3/AZfwnG4u33b97q1Efbqjp0rQI2IynjwmHYEyQIyCXFD12VnZVzxX5851LgjdeFkTVS/gpvcAtfgjYNYIHQv4ylAvcTECJxhWI0kGRrSiJruHBkr5E9+pVS3iIVcOxNMWvV86zW3FyNdwpE9vhlqCd6LTf6NtMDPHuP0EjoCfRL0mwx0C13tTxOdGtbrxx7uulgHbeodKrWLqHilXGMlqTIV2ZZiQzz/GSGjvhlumNWTMUtsdqFZ+sq9Mf7dVeQkGzMOFbnMfJ1JTSOMVJWVvCfDEQMYLwmMp4sL2we9MtXSNUJcsB5X8Eh/vGA/UFHeILLGNcPthkw== 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=BmHbFWpCy4zpjT/Wed1GBPgQ2G0Bgz5qE1pyrzTcNQI=; b=KieW5Jwrbihuuvf1ab4r2AzSqDfAh5e3IV3oVNBspsNeA3Eec6dan3ZkEO6Yw5TtKpitYfyhxqzo1VZPmbtlYuIr4GKXFUuW7LM85QrlYraeBol4D2uwDf5ezZzdwPFIvOZR8+dsbDlzPC3o+4M+zmMjcCsPmu36SZl9ZOLgkPQ= Authentication-Results: tencent.com; dkim=none (message not signed) header.d=none;tencent.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3148.namprd10.prod.outlook.com (2603:10b6:5:1a4::21) by DM6PR10MB3146.namprd10.prod.outlook.com (2603:10b6:5:1a6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.32; Wed, 24 Feb 2021 13:29:30 +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.3868.033; Wed, 24 Feb 2021 13:29:29 +0000 From: David Edmondson To: linux-kernel@vger.kernel.org Cc: Borislav Petkov , x86@kernel.org, Jim Mattson , Vitaly Kuznetsov , Wanpeng Li , Sean Christopherson , Joerg Roedel , "H. Peter Anvin" , kvm@vger.kernel.org, Paolo Bonzini , Thomas Gleixner , Ingo Molnar , David Edmondson Subject: [PATCH v3 4/5] KVM: x86: dump_vmcs should show the effective EFER Date: Wed, 24 Feb 2021 13:29:18 +0000 Message-Id: <20210224132919.2467444-5-david.edmondson@oracle.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210224132919.2467444-1-david.edmondson@oracle.com> References: <20210224132919.2467444-1-david.edmondson@oracle.com> X-Originating-IP: [2001:8b0:bb71:7140:64::1] X-ClientProxiedBy: LO2P265CA0484.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:13a::9) 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 LO2P265CA0484.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:13a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Wed, 24 Feb 2021 13:29:27 +0000 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id a092ea89; Wed, 24 Feb 2021 13:29:19 +0000 (UTC) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e0b2eb8-aaf1-440b-28ae-08d8d8c8368c X-MS-TrafficTypeDiagnostic: DM6PR10MB3146: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2582; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KHfS4KUZ3Yk0LmCfcIX4Qf9/6XhtzqAwgxr76cU6lQmPv4uwjQaPoInbx+6eNlCjB6n7LMHIkrsLoOkxCNfeQrHWulRC2PByb1NPXQuOdtuNBFs1YSeShnmiIouyTKDkGJFJ8Vjmj9FIdVASjasbizZVllyHP6x85JQ4pE1fsudV8O5qGgwkcqoASVNS7bYRezFCF1MEYSDsWE5H3M3JKKvKuRQ/9oQC2RVw0ubzp3mDHGEtPan2jajNnGStRX9rcfzpEBEiLfd/yWKFY4ub+rS6ky27pIfvFRQf//E0ZX8kB4199hrtNGsDFZVQSbC5Jk3S2nsA00S4PJgdlAq38AzFS0ST+8C4JZ/qvyvFknOz65DbJQ2ONxnR70LjpEV38qeOEx3JTM3v8rz4hHxIAZ539BP+Kc9qQe4LYyJQ5kfStYlmS08pwLYLr0W3/XNhIN6e5igRJBRN2SgEFafj8PWwmM3GqbRlv5vbHZ1qFWHYxrG1jSTVsRn3kYZMjKMKsWHrhfiUfqZ9w80OfWNSBQ== 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:(136003)(346002)(376002)(39860400002)(396003)(366004)(107886003)(2906002)(44832011)(6916009)(4326008)(86362001)(478600001)(8936002)(2616005)(316002)(7416002)(54906003)(36756003)(83380400001)(186003)(66476007)(66946007)(52116002)(1076003)(8676002)(66556008)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: bJCBhmJpiCna5ruVH4N3b5/CVi2ZTFsk5bdwuKhdvdu4auzRGo82oCUTJjauuCvETVce0vTnIKNpuD37ia8XE6Avaw9B2WC7bNgCERFlZ3jh9VFcFhzBiqBV4ldpLvje9/mLhmgax4FtfmHo4Xe3dvgYUtMoF+PNJ9iWMX8viHzEpsIqGLiwoSXdcA+GCky4CMmg8Jel9c4FWsmBAgtUdNzWZE9RHP7YCpo72S1TcEmRnkbgnGyN00935G8xMyEkzzLc1Mbef/1zfdAjtItg4XLyhnDpDYw+Xcfm4TNCOmo33DdlxtQwEllYJezbcynN+s4gim4WJLFE3octw1RMEmJbMjkWfmVOVeaLHzXdPo8y3G1LpjKdPIoDrokJEC3jMvef0zppHatEm1kts3DEAg8G0DZS/CB6KPZB9gnvwq4xfZFGjk/4M40ofAn2W35qpq/mvbEuSipJMDEIZjM/RLWti29kpxw8bVmX17AWsyza5A9iBLwtK/G3yUgILvdSAN711UUgOZ7MaXK1wSNkccWhV+PzfN8oRQN6XbL0KPQchEs24bWm93Qj2XSM9vFuS3L+0GVnaWZSt0XS6Jo53M4wSR7j1BNd8h8SjmL2VOAw+n+9nFHfmddncRnVT+KD4DjwRWFvyup/70+FHgCi3PI3pNs4EiE2AU9gMLp04+BTpPKgmBSOY0DzwL+j4i4bU5JUpDm89bygs/TggX32yGOiH1ST2UKYEv4XNvXHxytX4eGjq0z+7iKDICjuGmmst9l9PPoXlmVwI2OMZCllKwsISZj/hIPpTHyeVF/kM8nxcyMwN1wEQblnGtzB0pWDa3G9aKDT/ni6BHy2jJ4XovE15w05Y5iTvZ+7EBhMrRYM2qz9nPv2ro5t+Bbebqu8wTRknz7oaxJ8ETHpxsQcMkjESVtVmfvrpRYFDi7U7XYadXA7wJk3UZLbnxqZ9RljSu53oL3ZykGAFUl0GJJBLmKgs8PUlrtgFdAD1IQjgmHzrUu2N65/FkQ/IcJH5azqgtS3uLaols+R06oesBI13pxEjl5Kfnd5d9LGEj/GiRMA98iq82qdp1ee7PF74yQITfjd+cXGMUgXa/K001k+2x2w5HY6zs9bcxMYGKsTyRWygmxH3CRFrqMvOa4Qcrhmn6Aj+FyoEAsMW90xwNFMLPGbP25AWFwxnQTeZhLlehhTxOjSTOnLBPJ8DPV/WZxFE9VJfpHtu8qXtal3Nyf1MS96xEaJlzurmmRSRkw6iyGV4WagkjvgtUAUL4UhkqmHq47AlCNQ0xRqaX5OOSzAgdZEvsY2HqcDKKz3d9A268smd/3eUtMMdG98org6dSv8R5S6ZUn489ANlrn17inO3A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e0b2eb8-aaf1-440b-28ae-08d8d8c8368c X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3148.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2021 13:29:29.6207 (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: nmD1bzbL3qh1+vMDozNHt0S6LEUmJNfLd6rVt5YT4m1feg+d/UmBAIlBPX68IzTUpZxVVb+U8yUaDHSkBgFreAB0aVVQ90ulPpeTtgtb9r0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3146 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9904 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102240104 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9904 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 clxscore=1015 mlxlogscore=999 lowpriorityscore=0 phishscore=0 impostorscore=0 adultscore=0 mlxscore=0 priorityscore=1501 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102240105 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org If EFER is not being loaded from the VMCS, show the effective value by reference to the MSR autoload list or calculation. Signed-off-by: David Edmondson --- arch/x86/kvm/vmx/vmx.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index faeb3d3bd1b8..ed04827a3593 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -5815,6 +5815,7 @@ void dump_vmcs(void) u32 vmentry_ctl, vmexit_ctl; u32 cpu_based_exec_ctrl, pin_based_exec_ctrl, secondary_exec_control; unsigned long cr4; + int efer_slot; if (!dump_invalid_vmcs) { pr_warn_ratelimited("set kvm_intel.dump_invalid_vmcs=1 to dump internal KVM state.\n"); @@ -5860,8 +5861,18 @@ 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); + efer_slot = vmx_find_loadstore_msr_slot(&vmx->msr_autoload.guest, MSR_EFER); if (vmentry_ctl & VM_ENTRY_LOAD_IA32_EFER) pr_err("EFER= 0x%016llx\n", vmcs_read64(GUEST_IA32_EFER)); + else if (efer_slot >= 0) + pr_err("EFER= 0x%016llx (autoload)\n", + vmx->msr_autoload.guest.val[efer_slot].value); + else if (vmentry_ctl & VM_ENTRY_IA32E_MODE) + pr_err("EFER= 0x%016llx (effective)\n", + vcpu->arch.efer | (EFER_LMA | EFER_LME)); + else + pr_err("EFER= 0x%016llx (effective)\n", + vcpu->arch.efer & ~(EFER_LMA | EFER_LME)); if (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", From patchwork Wed Feb 24 13:29:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Edmondson X-Patchwork-Id: 12101895 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=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 00D84C433E0 for ; Wed, 24 Feb 2021 14:13:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9E51564EDB for ; Wed, 24 Feb 2021 14:13:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234783AbhBXOLI (ORCPT ); Wed, 24 Feb 2021 09:11:08 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:41186 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236980AbhBXNbW (ORCPT ); Wed, 24 Feb 2021 08:31:22 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11ODSwGd041976; Wed, 24 Feb 2021 13:29:34 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=47SAsAeWZxzj0pYLTV3E2eXscEeA4Q0xcedm5E5bEwU=; b=SadxG/28eZ3wgSl13HmsyTCQ30/cyteJCAMbZnpw6EtlBXMcuFByk0VwKjPQ9HYYgxbW SY2awUKP2UvrVWQci5IULRU36i8feu8IsCCNfM9cYNDX9OhwPut8en2I5mszyIMxLB5s eZUWF9cDfzqDiTccOXP4QhuzghyRTgcl6e9IjOFLeJ28FUFFes40iGRiOJ/ACZjHgtey 6Ww2/y8ZQtvkKgOOJ2Rbw7ZRevtLaYEghi5j38+W1A9PQ56kX6VsY9eFvHRb5IAhwoiZ DuwPWgKv/BZmuEA+N/lhHKH7WJAxhTkKBzjfr7NMTjw4MouqFrurnennNR7zuk8VcJYN tg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 36ugq3hs4x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Feb 2021 13:29:33 +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 11ODOaJQ081673; Wed, 24 Feb 2021 13:29:33 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2047.outbound.protection.outlook.com [104.47.66.47]) by aserp3020.oracle.com with ESMTP id 36ucb0r5vk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Feb 2021 13:29:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hqZoL5dPtauk9zeI1g/u9KdCxIVNhU4nAH7IhodtTX74PgQw5h34w2knpOjSfxXYf36wVditCWRd1jiUwlh58BqOBAbz4RgA0AFgTDtEVm27zfRGzwKW+8tFIrFFqqrGfOn1eRKFGsn6dESQinC22+be3TGCWjcMa2D8NXs/c/U6PMSAPwKwlj67W83NcWtWs9OXppeQVStseclw2cjF8n5NhZtUOm29kbNIAxeq2a7XTMqVbprbJ3CtVqzQ4vsVMpTuLC+Md3C7lM/o/rNYg6AGoz4VmggCqhSqg53DchdUmZewy8gWmgNNbEB85SOHUOsreKmxfmVVAGTrrHmYhA== 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=47SAsAeWZxzj0pYLTV3E2eXscEeA4Q0xcedm5E5bEwU=; b=kNuhDOuETGoFYttGN11AE+TFBctbEtVQJhirfafTakOrI3W4VDUjYenusPaeVhICCsT/+R3f+USHDDZaGidNf7m2+0n2IQIdGRSAMi6gMb69SOHf6XbAYZhL59bMhHO7YT6wibz6Rgn7HhrSWpWFcjYEA3y7suQZf3lqh6rcR1boNfgNctDyjaZC2e+JDRUflizZruOHjusc5/h3/yaWv699kmtp+w3eK+X3ZKzD19ZxvXSs5cp2HCj/tWoVCnj3q20LN8u58IOynRMksWQ8p7UsmuExY3t5VgCCYI/T+pJlmwiTG/xWOi8OovQ9CRQS4u1j0gMe+NvPo9hgYgpLyg== 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=47SAsAeWZxzj0pYLTV3E2eXscEeA4Q0xcedm5E5bEwU=; b=nJ9hEqyZSu7uHnBfnKi/gq75msr3EtjxtgYX6TqtiD0sjVYGIZ7No8iTPmz0C6RWKzLppIX5mdOMhtrera5gU9d13JpYK4FFg4yq/7ICshYwDYTED0QGdHiHiRRR8Bov7KeMgRQ845qfNG9W3WXjcdJ8gV/veIdMsDNhQzb4NoA= Authentication-Results: 8bytes.org; dkim=none (message not signed) header.d=none;8bytes.org; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3148.namprd10.prod.outlook.com (2603:10b6:5:1a4::21) by DM6PR10MB4347.namprd10.prod.outlook.com (2603:10b6:5:211::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.29; Wed, 24 Feb 2021 13:29:30 +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.3868.033; Wed, 24 Feb 2021 13:29:30 +0000 From: David Edmondson To: linux-kernel@vger.kernel.org Cc: Borislav Petkov , x86@kernel.org, Jim Mattson , Vitaly Kuznetsov , Wanpeng Li , Sean Christopherson , Joerg Roedel , "H. Peter Anvin" , kvm@vger.kernel.org, Paolo Bonzini , Thomas Gleixner , Ingo Molnar , David Edmondson Subject: [PATCH v3 5/5] KVM: x86: dump_vmcs should include the autoload/autostore MSR lists Date: Wed, 24 Feb 2021 13:29:19 +0000 Message-Id: <20210224132919.2467444-6-david.edmondson@oracle.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210224132919.2467444-1-david.edmondson@oracle.com> References: <20210224132919.2467444-1-david.edmondson@oracle.com> X-Originating-IP: [2001:8b0:bb71:7140:64::1] X-ClientProxiedBy: LO2P265CA0155.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::23) 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 LO2P265CA0155.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Wed, 24 Feb 2021 13:29:28 +0000 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id e46fa011; Wed, 24 Feb 2021 13:29:20 +0000 (UTC) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f44e696d-456e-4e1b-2c7f-08d8d8c8374a X-MS-TrafficTypeDiagnostic: DM6PR10MB4347: 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: mu0PE8waTqdijqLmdRQm1s/7rUBwGe8qOR/on4BUbRXjM4nEXkxcTUgLW3KdSlp8f5TgKTeONK77zBg6K8RUI8SQJDDb3/APLf1KFe1UPICUOLsEYm+lySZMI7eiz6Dv0qq5bRdHWreJMySUpDeoWHO6TGL4JC9SRKD3O3gFTv+4sMJNST0I6GaK+YMvw9Ag/xy1VDmo8o251Vj9mm/fzpyC4A9aRrNtuGrNlW5zchNAgG+ht5lTsL3GrhOu8X/Enm6RmUMXeoKZ+mJOL3yzzD2IT48KQA70XtFUJ9uBfgDL6AzRAhzenAwTtJaEXlrR14cXGiLZ6cyrsP3OdkIxpcEW49mko5e2UXPUfebpRM2phHwij3MntzsHhr/yNsq/cu9k3HD2KNPF5ROnB5PXRJr2/4X3/L8L3tBNtNxuvRtpGRdWqTQ+tDZM9OuhazAHFqcjuOMJztrwaJIgH8CR7VEWuGjfJbxpMPTCqoAla6RlXGrD8hl0TS3Q5Jy723jXhniPRXKrn/2hJZBb/TXI1Q== 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)(346002)(396003)(366004)(39860400002)(136003)(2616005)(186003)(1076003)(5660300002)(316002)(478600001)(4326008)(8676002)(66476007)(66556008)(52116002)(66946007)(83380400001)(86362001)(2906002)(6916009)(36756003)(54906003)(8936002)(44832011)(107886003)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 2whT0qPJi7QYOuamrew/gvuzfBPVr+LXmZKocSHBQn1zN0p8rASBZmTInJ031dTCWhrPuqVnsFP7AS0UVXtXDgRNhB2g9m0AD/Pw7GR3Q1LEx7JMPZEVH3LWOvRik9Rin+0+pS0XTzV+g3cJZ8zxh+KZVjaBLNbZhT2h0TFNvMZ24aZbC38DyJB0kSUum//1Q+Dg9Cl1WiwbTNoTYLOAaNYnY31j7KSJypUnk9QC2Wsdu4/rywPW3lT2mN3Odk3UvE08POvnPfaNQrStn+HUVd/RTKFNTrIWY+lWy2BruV0KCsJ4fL4uZ6SpK5x6QTTapldh23Mpj/OU+cDUSgnqRpmlCWXOvza0XdKjLkPltDAhgGwoVtd67n5cbW6pAexYy0M1XozGOFacIfo+W3M+KQZD6Nw6+YjaPLYTTHPgDRj6AOfz76XrQm3N7P7H/De76wNccwQcqd2aVdxhis0W7F2WWDScuPISai7tq7QWOF4fFkmc0H94eDrCFW4StOGsG2dPyLO5ILHnnHYKf6kfYlp6UudqiKyM4rjqyQ2WVKkAQiA2uLmB6N2qpuZVQEcA8LLfmkJZr7d/ajXgEupgIFCu27EMt246dAkt9f9+LQn9gH9a2tCAxz/AKiRaLoWVUx2oK74GqI4QWVLcj2rE5IYL+NNhmsfZ0KsVdgGxjSVutzsfpf6L7TABqDAJ7SbGy+F6qAGOiBOjD6qeD3TRQiD3ig+VRdnjQ6ndEFutQVouCeYKsjSSf9IAiHfHiaMgmWPSi751jUUctci79qP9tlCG3mxcLi4GaAYrO2DgZukrj8fWkbmHxw4KFGzunuHzPXhXUXMiVFc6n8ijsvxxIfCihHxjjoS8UjWKRk5FQYCHACBzGhSoruGI9lAf5+e8+mJZpXUdDafoiHWDHatMa2gsmOG/joef277ki06ryLXiiHZJOMmkSVjIwZ/WgrjPUuDsC5i5H3GiiVz4SEzkjOjNsR441gpayHh9aEIL3gyA6wLTLXOI1PbPSIoqOnUE4/Xv4ilxpLR3Be3DG5O4m6n0Cg9bLLc4UoLUpXWeLhXo6BdqHyf4bDLIFUORZGIc23XUQCoK7oaUB5JE+WrhoTcbYQMtXFLrOOYBi+BIPyePEyqseW2CM00yuj8/nYtz3EdXtBdsCxXQyzG0rAwAnXjgCZMv9PpecMzSutN2tUnws1TT8rUhyMx+z/g4aL+JiAGcvHrtNoo1DCsqUvIqbMjnqo1tVynk6LXzgUojLqPmbYbyxXgRp9UDHq1DXQHAf6D+Ty5inV/hyNoMf1bKYKeR1U93B4u8+qOvM/bggcltnSmCKRfbnaqj4VNG51nZpikH4nSPq9AdzMZj3cvSQw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f44e696d-456e-4e1b-2c7f-08d8d8c8374a X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3148.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2021 13:29:30.7710 (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: wJ4GeBvyDrnATWHIAiCcO+6JRTFLzJby1YJM6kQ2OAJrB4VyRs/+b+xMwLvyrdLUgBkLNCBAJi4cDsmm6xiYiYMN2yl+oy7wBcbJLPSH2XA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4347 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9904 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102240104 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9904 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxscore=0 suspectscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102240105 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 ed04827a3593..de42b8c14a38 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -5810,8 +5810,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; @@ -5890,6 +5901,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", @@ -5919,6 +5934,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", @@ -6019,7 +6036,7 @@ static int __vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) } if (exit_reason.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.full; @@ -6028,7 +6045,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); @@ -6114,7 +6131,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.full); - 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 12c53d05a902..4d4a24e00012 100644 --- a/arch/x86/kvm/vmx/vmx.h +++ b/arch/x86/kvm/vmx/vmx.h @@ -541,6 +541,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 */