From patchwork Wed May 1 08:51:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 13650345 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 75175C10F1A for ; Wed, 1 May 2024 09:07:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 05F556B00B0; Wed, 1 May 2024 05:07:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 00F1B6B00B1; Wed, 1 May 2024 05:07:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DCB716B00B2; Wed, 1 May 2024 05:07:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id BC89F6B00B0 for ; Wed, 1 May 2024 05:07:01 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 92F14C07AB for ; Wed, 1 May 2024 09:06:59 +0000 (UTC) X-FDA: 82069247358.24.E217FF4 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2073.outbound.protection.outlook.com [40.107.220.73]) by imf08.hostedemail.com (Postfix) with ESMTP id 9D13D160005 for ; Wed, 1 May 2024 09:06:56 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=1RniRHzq; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf08.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.220.73 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714554416; 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=alTvwCC+QqKAYNVMqng3/wZwTqjTdFBEpHqD12DsSYs=; b=GbrsHNu0UzPO1QlS67irttCF++z1n1NFeTMMPfBjznkz9zh4INDHSvzj/c680MuxVpHUp2 H5zR+zCm9sws/T4oxGjYdXiTSjzWqsWZFPbrQMb9IIxzM3mkQ7N9tlGMm2HJLTnd3Sn1L2 gajagBvOJP0toE792vzez+6L2cWGxHY= ARC-Authentication-Results: i=2; imf08.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=1RniRHzq; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf08.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.220.73 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1714554416; a=rsa-sha256; cv=pass; b=kp7nA/mrA/Aw63xVbmGpWiCdUMPlWOhnOuFw6NIdtCtXBzVvCqrzXpYYwXTpV/x3QJbMm0 TF9tqujBsMa/mKvGb4YITjxiB+0xgVIPUv49Z/ZL0whkZXKXjxV1f7wK89o1o7FTZk+F2L 9wowS3q4/16QO574cUCkq+5JnjhSSGE= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hs4Zpl/KDiYMOwiM6MGWXmc3tZVzsz0qzZvRlm9MYn0uN+RJjhcM/Q7rMHiOASNxm/musDM7CXY+u7o2qQdVwLEWIERNzFCsZIEjNy3zIzqweQgm9XlDS9DnqE4eGwMQhWyThGCtWd38x20lklXzRxWFBmwW4Hr0xtqbLMz2BHmnaNKtbMfKpD22JgdocuBldhf9kzRAtL7asLhIY+aUzNoW9X2lAxUzWFYubRalIxlZ+lkuAnIaKXQeWKiU3l/Zz4h/kE5nRMKb3RvNyLLoStpyJPPbN4vvqPQMWsYRLsfL2ocesYDKO8SkD9FTIkMlodjkIEpVeT/b0oUSEpv0Pw== 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=alTvwCC+QqKAYNVMqng3/wZwTqjTdFBEpHqD12DsSYs=; b=jAKrzLfBE+8cAr+TTxs+YEV35l9dzR5aGvP8nNLWq5bnYtqm6dLnAbm2SAwgcN7Fp8TkqwUePv3Ne81tsY84uynn9aef0zuVRSEeo+f7XIIKq1TN6I14HOvjy4JaokYR/cexbAHk7QkR5n3tAa2ingWQrx0fb7Jc34pVGaqoRMTdPjvuS1Hg0l5KHq0/bNi7LZa8tBH6/ayGOXEfJlcc4ga0Uqi8X4lRs7JxbObQkfaQtkXt9HlCbxLxYOzOJgiQoFeoPKQPhzt6Cpnc5LmZI/I+0FprGgNElcDsmZQ0O3zArTyRmGlfyoBtQt2fmIUh2ofUAm5nETZqIv4NMUIKlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.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=alTvwCC+QqKAYNVMqng3/wZwTqjTdFBEpHqD12DsSYs=; b=1RniRHzq59ira0ee4CYBmOLd0r1cGkiWOJAQkr2v7DDe+iY6yDpWVgQuAZDl2hSqxh3cOUUgNDYv3jMpm0guwmimVgEiR/+bP6Ilmdlmv0YlmFlwIMX4k5lGBw4vTQbXtxQt/udWmmtYMEc6xgGMuXW8Z6XSJrsqPa1kMY5QYsI= Received: from BN8PR12CA0012.namprd12.prod.outlook.com (2603:10b6:408:60::25) by PH7PR12MB5855.namprd12.prod.outlook.com (2603:10b6:510:1d6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28; Wed, 1 May 2024 09:06:53 +0000 Received: from BN2PEPF000044A3.namprd02.prod.outlook.com (2603:10b6:408:60:cafe::b5) by BN8PR12CA0012.outlook.office365.com (2603:10b6:408:60::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28 via Frontend Transport; Wed, 1 May 2024 09:06:53 +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 BN2PEPF000044A3.mail.protection.outlook.com (10.167.243.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Wed, 1 May 2024 09:06:53 +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.35; Wed, 1 May 2024 04:06:52 -0500 From: Michael Roth To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v15 01/20] Revert "KVM: x86: Add gmem hook for determining max NPT mapping level" Date: Wed, 1 May 2024 03:51:51 -0500 Message-ID: <20240501085210.2213060-2-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240501085210.2213060-1-michael.roth@amd.com> References: <20240501085210.2213060-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044A3:EE_|PH7PR12MB5855:EE_ X-MS-Office365-Filtering-Correlation-Id: d13c5f51-a792-44ee-c5e7-08dc69be0b5e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|82310400014|36860700004|1800799015|7416005|376005; X-Microsoft-Antispam-Message-Info: pE+Dw05hoQsBzaunELHWHwft+hszd+4S4vLIt5eeMUk8Aj8aIeKeC9SYRErikfcv9BaesLFsCoqzI/R7rjMj+3i6gbOj8MrRD4qRsvfDS9MFgkP58OIMUd3kzJqfdlJ+cy+3h1O9Eb9OQMPfFcPdJ/URTiyI+YAUwrj6Ul0+VfI5qfsctB6SyK/L1md0OWQPV/Cef9Q/iol1rE8txlwcOgtogp76CP5nKmUTJskeJcgRP3TS4LpQW85wuEV4Ti2EYU2tmqqVMhTaPnPHNfC6WeyYkdX9rLFOd/AFdTkr5FPXb/X3/k1KEsOyAC8IG3lpjKN/JGRHrZvN775Mun3PDYlJ8QbCfVJaoty/dkgoW4SFTnOHxqapTeJBkyayZbmltgdTejO1+YSDjVFmizds96I5A+rLNvvbbH+UJKf4PWA53/AXodQJESOvoDjSAE4S5LwIvSEePMVe3G3VK1Jx9DYKuNOYxkPlnTEfouviaOQbNJ3xK8++XdeDPaMx5bwoMVbEH4v/4Mh9jXmm4MhrLUPHExF63nmvAvFZs99Dpn/T7Eum1LGzMfxPuMsP/R8rTE+OSBZ0sFx2iL9VQb/2nD6SIfk+rbX1EC5d7ex3aZN73xmKNxdd86mmCjKUdSPHmburFljdd7paTVNuMXci0LfqsbP36E18wXPbrWKQ+Ky9lkI8+/DUYVJsN+14ub2W9GgsIRlPX1LN++cjXR9/hzBHVlO1Y7pjByE+t69L7IEI9KJEnP2iW3Kg36kDhoQ0T7C6/R4oudLnmFw/6a6EXS8/qMKfgd25+7GBKff59o0SCbiC74DSwVIiss1HihXVHU6a4MYEnl1jW5sCknRJh49QtE2jUA/lah6Ap4rq8XA/1SG9z/+J/5kxXxcBrYkr8+DrVaJ23t2lwvtVt0exiRIuSLXzl54cxzv0IFb9cOodS93ZfNrfd6yq8KRU1++pKiigXhy1TKaYjyZGF9w6hvUrsNZYNPOiegsoN1WHMxHMzjiTbcgnWGeQQTCz0mtvBk1fQu3qKHzz6nM1CteKYIH8kSEB8DQzo6ILa4GON2RlQkrd4S9hT387eN12lUzGMV+CdksC63OEVEUs0366bLPvn3hUTmwdkQYTXSimB9SDXZIvKNVA1bLG/RY0l2l1Un0EJKzTO6WdRx3oQAzMMoJHN25HNTTMbwsJPd5W7hnzq8Pem4CebrCwERGP3i151CNmXvYmD+Cqh0ftUQT/U3UkppBxNXCcCAWSeNM+lRYpgYf1Jj69r/8FSqQvMIaeH32G2sCsek11GR38Nv6u0fcNH0Xm4p0b6hhbI767THbj4qPGWtrGvF0m9v97rjNw 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)(82310400014)(36860700004)(1800799015)(7416005)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 09:06:53.4762 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d13c5f51-a792-44ee-c5e7-08dc69be0b5e 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: BN2PEPF000044A3.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5855 X-Stat-Signature: 7m5cacg47ic1etyym9y5fpx848dz5af3 X-Rspamd-Queue-Id: 9D13D160005 X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1714554416-60149 X-HE-Meta: U2FsdGVkX18zmPxQui+cbveLUB0N5yWqlT7X+OL5E9swMfUgpsu2StZ7ITNlavk/XMVlhPYpec4Ku+N3TExYuyKbfuhS1PIOAYYd1hGkywMUduNmUQ6RY1KcGL2L8lRrJpGKCu59OBhG+k0lG8VALKHiZSWLlvGmBGg74KuBnvmtwPZtYSNAqtmS90+O+82nEtd6yZePdS5GdmLRqijg4l77by4D9pSy9I5tDyy/Udwa15WieXUsV1k2rzEYnbFaUhIDQImufTM5Uh8yfIzBGp3wr+F7Or46y572MFRed9Dl/zlFVScpcW+c8mNQQT87tJLOTDigXELAgWc12XrgScCsO7DnzzgfzUYCeXrfq1jyAyQ3/Ry7Ps7m+ENILorD5CjsgGUAjJ7YsOD/JKd0GKrd/KK5Kf7HRZ5zoKF3iaTsT+mvLY6G9Z7eeUMiCYAu27s8rfByGV3tYnQUrn07crMvWKjAhTWfnBnAR7ixJmHVtvw27e29iyVaSiwPyPoOwHiqS4RFPP5r/FN2gwq68X1+FWvBaolyQn3hRG/rqyKbTCbUZNsOxtFbqMuDCl7lSaybGjQKrjXzZXqh7opa7WLLX/NFMggn5g+T9piNQvzgEqHDTyYKZ6HvdbbA/4vhIb3f1er7ESxgznwi6p22JiCJ1pJ7OAmHMyOZCVdlInUbAIpCxJSD2+1sN/By6E8gik+ryykmoDDbyhQ9lEvAJYLAva8aYWxi3t7P3fgAyBvXkl4kcFtujmlRNJIjtRoCIKpJ5rMtANUtUq+7bvUbD6Sejh+n4gfk37WohLdXQPjsgeHN0XMma/BDexpGpVti9CD2yuhh/8ygT9QkC/65M6AX6QSFmBPmnq9O9Hsrqg3ZCAjnnIuhG+is9MriN7Zr51+V6FOM8lHWzBhFQmEnR5saMuN9hgA1zeE2UuCwBXxjWuSCMKH4uySm5fM5Gdw4cg5oTq0zdlp3RzXsZRA dI3NSRVh P8TJ2JovJ2csTRV1zggs6+enwg/3W4u6KBg9Tt1cG6QBFEtMBNW1cL5Q9fTmWAPkmxphwrk4GYdUrTAQ3dncx8/PReVPUaE2e+nOPrh5vNLaAw4KJUBMDx1wdzoJxdzBghpbCZ6+mAfbgwK+wlL3agnVQGE+Kr8UBpedic3InTzA4Ufz2b5kgWizOyXnyFVpfJB8JJIvqX5P/OOdZMebMIlXkIwljdhAuVkWnsMRc82j6L+z8IfkVKXgL5YCyfn8pJRRZI3LR3U8ulYv3CrDKoFhx/3aMBLDjMHrK5HW5loykwo8rulRcyqd/c6+G0gYACp3KryyuggkdvS/lfpiZRge6DqxoE2cgaDer+SKkxteSXjO9qLI7sG0zJQroFTC4btxa/O89Pfqw7C5e9NNIlCQgRWCPndeKn2Op 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: This reverts commit 20cc50a0410f338657e23e77fcc21fee2bc291e6. As pointed out here[1], this patch has a few issues: - the error response could theoretically kill a guest in cases where retrying based on mmu_invalidate_seq might have been sufficient and so it should purely be a means to find the max mapping level that never returns error - the gpa/private arguments are not currently needed for anything - it's not really a "gmem" hook but uses the same naming convention as actual gmem hooks Revert it so can replaced with a fully-intact replacement patch that addresses the above. [1] https://lore.kernel.org/kvm/ZimnngU7hn7sKoSc@google.com/ Signed-off-by: Michael Roth --- arch/x86/include/asm/kvm-x86-ops.h | 1 - arch/x86/include/asm/kvm_host.h | 2 -- arch/x86/kvm/mmu/mmu.c | 8 -------- 3 files changed, 11 deletions(-) diff --git a/arch/x86/include/asm/kvm-x86-ops.h b/arch/x86/include/asm/kvm-x86-ops.h index 2db87a6fd52a..c81990937ab4 100644 --- a/arch/x86/include/asm/kvm-x86-ops.h +++ b/arch/x86/include/asm/kvm-x86-ops.h @@ -140,7 +140,6 @@ KVM_X86_OP_OPTIONAL_RET0(vcpu_get_apicv_inhibit_reasons); KVM_X86_OP_OPTIONAL(get_untagged_addr) KVM_X86_OP_OPTIONAL(alloc_apic_backing_page) KVM_X86_OP_OPTIONAL_RET0(gmem_prepare) -KVM_X86_OP_OPTIONAL_RET0(gmem_validate_fault) KVM_X86_OP_OPTIONAL(gmem_invalidate) #undef KVM_X86_OP diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 4c9d8a22840a..c6c5018376be 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -1816,8 +1816,6 @@ struct kvm_x86_ops { void *(*alloc_apic_backing_page)(struct kvm_vcpu *vcpu); int (*gmem_prepare)(struct kvm *kvm, kvm_pfn_t pfn, gfn_t gfn, int max_order); void (*gmem_invalidate)(kvm_pfn_t start, kvm_pfn_t end); - int (*gmem_validate_fault)(struct kvm *kvm, kvm_pfn_t pfn, gfn_t gfn, bool is_private, - u8 *max_level); }; struct kvm_x86_nested_ops { diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index eebb1562c5bc..510eb1117012 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -4292,14 +4292,6 @@ static int kvm_faultin_pfn_private(struct kvm_vcpu *vcpu, fault->max_level); fault->map_writable = !(fault->slot->flags & KVM_MEM_READONLY); - r = static_call(kvm_x86_gmem_validate_fault)(vcpu->kvm, fault->pfn, - fault->gfn, fault->is_private, - &fault->max_level); - if (r) { - kvm_release_pfn_clean(fault->pfn); - return r; - } - return RET_PF_CONTINUE; }