From patchwork Sat Dec 30 16:19:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 13506858 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 333F2C46CD2 for ; Sat, 30 Dec 2023 16:21:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CD8676B014E; Sat, 30 Dec 2023 11:21:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C891C6B014F; Sat, 30 Dec 2023 11:21:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B51386B0150; Sat, 30 Dec 2023 11:21:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A439A6B014E for ; Sat, 30 Dec 2023 11:21:56 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7F1914042D for ; Sat, 30 Dec 2023 16:21:56 +0000 (UTC) X-FDA: 81624001032.28.DE35C52 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2059.outbound.protection.outlook.com [40.107.243.59]) by imf22.hostedemail.com (Postfix) with ESMTP id 94856C0002 for ; Sat, 30 Dec 2023 16:21:53 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b="N/ZA3KNl"; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf22.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.243.59 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703953313; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6opTrVbMTwh0pCjoKcZ2ovTnQR+ThGWQn4V5Y5Vn2+g=; b=CdA9JzYgVEVG4g5dlnHqll4As+lcJ4vzJeOSjUc9+N4yNxeOS0xmfcpBVUxmF1rPUZXasG 7DYEXQKJDHFwgVacJkbWAcnquGqJ/ty3RfgKxa03Pf8X078aoIYejukBy7moW/wMTM5Yij EJbBpWoO+0szgQnpGU2YyEl/b6r99Ew= ARC-Authentication-Results: i=2; imf22.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b="N/ZA3KNl"; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf22.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.243.59 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1703953313; a=rsa-sha256; cv=pass; b=bCwpou2FE5kkLNRVhHM/9GfI8AeThPugWBCry5++p8sYBu7miaQtCPikDrnKY3Fe/vECD3 eAsCvU395naACwpZIXqLBIJQTNRU+RC05UyYow4/sTLhIdtT0p+TFGnlMJIpbvx/rVyRw/ M1MUOEjx3et24K2iJK/pppBMEfgeBjo= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MgEgkSlH2qQC46S7qx1BvbshBifjSObcqdPSnrgVKhxNgp6d9PrJc8XH8xNxy3gLTCZaXSUmlfJGVpf9/OJvsUE12VpbTh4cyvR79KYnHYRc5xDbGo9lMsKHO7G9HN+yOeAWBMi8w5NyzRoTUhdbq+GTL1sOT0dg1w8zJCDFXU3maYycRO8JheKO7TtX2cnL/70qnC/1HO2C7R1OR4vSlZM1wEmfMp5cAy+tp6wYIUgdIptNmEEhfW7RevrYQOEMznFYsc0Qijsgi/Gw7ufS909rj7f10dDcWqwjDb8lLuMeSZBbz/6tznfa77pCOc5cGqRpiEnQc1ZO0myUZHPuXA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6opTrVbMTwh0pCjoKcZ2ovTnQR+ThGWQn4V5Y5Vn2+g=; b=Xj2F2kXhj6tWM6mySt5fHs6hDzMLOU+SHHxcpWEEzR4+cs29qmBZ6Xn5X3ONTwCazu6tSFIZwFuEAL4Vyv4wCnHgfmelnLv8OvfXBYEsOr92naFU7t26vcm/FF9LMPVPj09bcQMySOh8u3WBC0uDIKmodILT1PkmMcDWnc3ISnLhY2asXt52muuW2RR8knF96Y53DPQIBNS0zbCKJeWLYm9DX9TF8wG/kb3QBpktwjz+oRtWqgvoBQggsMrtbgzW/qtojH/jB/PuaDPqRkWfbHK5l7zd37aotu7/RpbxQBpiHoOpOKXKGOYm8Q/nSgUg6+GsNc3nL6VWvRRY+GAL3g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6opTrVbMTwh0pCjoKcZ2ovTnQR+ThGWQn4V5Y5Vn2+g=; b=N/ZA3KNlEAb10zB2tIFTyshYzwcm5e79oJCNzk/YypiRZ1vxvdetjTroP4jdNk3kJ0M+6xEGrGYowlKiaqYN38XkiG8+8C42pMcTKcSkeqCoOGKkQkLShmgUk2axLZBX7St2kWseyqnfQzUu21/xioeJjeilMZYaq1dwr0OqREs= Received: from CH0PR03CA0095.namprd03.prod.outlook.com (2603:10b6:610:cd::10) by PH7PR12MB6587.namprd12.prod.outlook.com (2603:10b6:510:211::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.22; Sat, 30 Dec 2023 16:21:47 +0000 Received: from DS3PEPF000099E0.namprd04.prod.outlook.com (2603:10b6:610:cd:cafe::28) by CH0PR03CA0095.outlook.office365.com (2603:10b6:610:cd::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27 via Frontend Transport; Sat, 30 Dec 2023 16:21:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099E0.mail.protection.outlook.com (10.167.17.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7159.9 via Frontend Transport; Sat, 30 Dec 2023 16:21:46 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Sat, 30 Dec 2023 10:21:45 -0600 From: Michael Roth To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v1 09/26] x86/fault: Dump RMP table information when RMP page faults occur Date: Sat, 30 Dec 2023 10:19:37 -0600 Message-ID: <20231230161954.569267-10-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231230161954.569267-1-michael.roth@amd.com> References: <20231230161954.569267-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099E0:EE_|PH7PR12MB6587:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c7bcbe1-080a-48a2-b4dc-08dc09536b2d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xsVM5EJUnRzX0LhSBZKkIUCb39qY1rH2PwTJPXV9pw4fK07Bxj9q62WGFk5EYouBLq86P9ESdKb6k8Zc68ci/UOHqNek0WK+jYnafJNVnSaorzKjtGuhtOfy8y/Wncpa9c1cE0YDC7tReij/6wrBpuIwN1+FTv1ajSUmPxI5gtdYMrzdxEwu4FQtplJf04y05SQt0LbsTr3vw++Uksoouns1XwT9Tdfh4N9AL7sABGkRvbYj097dm+DNzuT8vSH71kKQ3LWuO6ytXPXgOMPB1k1heTLlVnSPNa0eKlZ9arMgxBB2im4igNcbrgE6zIpBjGfQOdIMV4TYBHNPoTSEEJTE5ZDFQNyip5QyWCeOTLOzY22F9g+9j5hXXUW5Wu6W5HA18l41WBtATOXRTM27fEA/gefHsAVUBEFD0CXRBQXlpC4O0zvkrt0Ta7k9xgiA1j3awIB22x9yT7l8d2dee4+vNMCO7bRf59SAYJeViF/IM17hPIwpoxnaxDpkxrC/uENpLwYmrtq41YzU4BdPLpGi+qBhOVuVT6QeIRm5c1nrvk8wQGpx7QWj3twK0qltDEALVZjiKkNGfnTSrtvd2gDq4MqUrbRTc7uETOYKvsTXS8jcYppvmrOGTPFIPcG4DzIBdQXSGhGIAlLPNlm/pTInLqd6p/LJZ1ruLPmUHEUDz3i3sj1x8+kV2+4c5Ep3nCwgmjFPqP+oI5CKxzsnQ3GSwOvTanET83ShulDfQ48RWgblvcidyXsaElbOm15s/4V5NKh48wM6SzJnZ3BfsQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(82310400011)(186009)(64100799003)(451199024)(1800799012)(40470700004)(46966006)(36840700001)(40480700001)(40460700003)(41300700001)(2906002)(7416002)(7406005)(5660300002)(44832011)(8676002)(4326008)(316002)(6916009)(54906003)(70206006)(70586007)(8936002)(36756003)(86362001)(82740400003)(81166007)(356005)(478600001)(6666004)(47076005)(36860700001)(1076003)(26005)(2616005)(426003)(16526019)(336012)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2023 16:21:46.4079 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c7bcbe1-080a-48a2-b4dc-08dc09536b2d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099E0.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6587 X-Rspam-User: X-Stat-Signature: i9i68c716gdd7tqqwjfij8s6pp3dm9we X-Rspamd-Server: rspam07 X-Rspamd-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ZQKn3uovJth198Rpq5oYIp6ZD2pAPvLb6rBynrC9OmU2dwyto2g5SCg42BLtRlNw9JjUx7XP0HLba89ELcoDDxNaZx7f4+w1tDOfBSKwtOCX0b959qHnphKDsMYg7InQ9zes5Dr+jpv39P2YZQ5e2Ok8x8E99FXonOQpDw6JSKKxhzCzXPK4ljmPVy6ZGJfDyPmXBR0foSXRl8S9M1g328KJQEpP7SPJ6qOI3kq3foo+KBUaqCw3OcLZtXFRvwscGLaaNwPnjgrU9gtELM2zVGx69xxEos+KscfHhBRR3ZTej1M5Sgq2565bAv/LYGSPrkA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: RMP faults on kernel addresses are fatal and should never happen in practice. They indicate a bug in the host kernel somewhere. Userspace RMP faults shouldn't occur either, since even for VMs the memory used for private pages is handled by guest_memfd and by design is not mappable by userspace. Dump RMP table information about the PFN corresponding to the faulting HVA to help diagnose any issues of this sort when show_fault_oops() is triggered by an RMP fault. Signed-off-by: Michael Roth --- arch/x86/mm/fault.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 7858b9515d4a..8f33ec12984e 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -34,6 +34,7 @@ #include /* kvm_handle_async_pf */ #include /* fixup_vdso_exception() */ #include +#include /* snp_dump_hva_rmpentry() */ #define CREATE_TRACE_POINTS #include @@ -580,6 +581,9 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code, unsigned long ad } dump_pagetable(address); + + if (error_code & X86_PF_RMP) + snp_dump_hva_rmpentry(address); } static noinline void