From patchwork Wed Dec 14 19:40:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 13073394 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 31C01C4332F for ; Wed, 14 Dec 2022 19:51:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CA8EF8E0008; Wed, 14 Dec 2022 14:51:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C7FE08E0002; Wed, 14 Dec 2022 14:51:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B21168E0008; Wed, 14 Dec 2022 14:51:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A194D8E0002 for ; Wed, 14 Dec 2022 14:51:44 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6B0FA1C5BFE for ; Wed, 14 Dec 2022 19:51:44 +0000 (UTC) X-FDA: 80241956928.23.1B0B2B9 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2061.outbound.protection.outlook.com [40.107.94.61]) by imf28.hostedemail.com (Postfix) with ESMTP id 730D9C0004 for ; Wed, 14 Dec 2022 19:51:41 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=AbT63HwZ; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf28.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.94.61 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=1671047501; 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=bwGNNhr0BV8XU5gNur70iQYprV9zVRyFOKALIClyqYk=; b=MKYaly9eYd7mxPsrdxpN5xtIw5VZXBt1VqUaXZ5EYDKHvaFB9SQKjBeZ2MGgrehIKTBBQm O1Wo3QiUdyhI1R35YEXOGYwjBQFEyUY3ONUUvQ0fhRt+pRGm4iaPCscSALC6YCIl2oNc+K a6qqcH7ubpPhyyE8tfri3oc50ZgQfOU= ARC-Authentication-Results: i=2; imf28.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=AbT63HwZ; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf28.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.94.61 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=1671047501; a=rsa-sha256; cv=pass; b=0x6l4zlhELT/Vo5NUUdyJTt0dyjHGgEO46CsA/5K3qPH8bWhf2YqrnigLbegya06O6PQiu TsKshhz8W+iaMeWgNKEgqwpgDGBUcFLjHAQyoM2kUr7b5qWY4/+f8cJMpWW3CllY/S2b5g V+XFidAq/VXJYfUvctVGsxvDl65/cWU= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UchcarU+H9/ZmcAR7+LfGzKny1oSjj9QUSWLi1NUtx1zvF1yeklFEfBS7M8yR4cMFZJg4Xsi1JYAuSK9jD57bAMYVOjRsh2/xLEtGqrE+57ChXKNaK0hEdR0Js79x1b9fccjMHg+FeRGiElcXF7zBrqcwPo0y+ap/bXz4SU8I1Zba2YHIy7qte304S/U2djgwyajEASxwNDBZc8l2zgyY7SRe0Ya0k15nnJ8S18BCqMQ4d/qp0iqZgTbLYJ/YPo40xsw7Jd2JemkROjag6WtRkrS8sxTMf4hqGb2nFWQyEXbe9sz3GrD+pv5ijQjrfiktgJkU22TRbwhyQ8Nz2AQDA== 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=bwGNNhr0BV8XU5gNur70iQYprV9zVRyFOKALIClyqYk=; b=GqDHuGh/jhffD0ZveL0Q9gXFuARcIh8GmJLg3AQIJFJCvOxifOOg6it6Ksc6HIG9HLKOB/ChPLC8TjeVGaSeTg2+bM87CjyeCDNyFm5b9NFatOFLBxM96JgbHSPDBV5nkZeO8X6xUEgIBp9wMwBvAxXtAKmhKzDr43cOChejZnVutbzd7MSdmXaRJ2sU41cA9coWq74mSLUXvJE6n6a8v7dQ9LILggs0QyVNwOXLVOss58J1Xeh/xIaHoJYdMWE6OpklGN9XumEYAJF3QvyC04qaZk0JyC1HdKojQ/EeiH9HMd/FsqSUibkkhSkYhEOmljsCdewQhXdd+M7SUMw/OQ== 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 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=bwGNNhr0BV8XU5gNur70iQYprV9zVRyFOKALIClyqYk=; b=AbT63HwZtpfHA/VWHqJswLGecO43bGaBgxCZroLGMFmAgy18tDD2LUqVt1HsKrdHIH97ewUv6HNZe9nr5fKMUKQZaBHUeFFupdDJEaG3bQviij3AxYaMU8mR//b0iVYk5swkqJm5teeRCIrE2UBouR78Pa2YYTK93DKVrBltKA0= Received: from CY5P221CA0004.NAMP221.PROD.OUTLOOK.COM (2603:10b6:930:b::12) by DM4PR12MB5056.namprd12.prod.outlook.com (2603:10b6:5:38b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.19; Wed, 14 Dec 2022 19:51:38 +0000 Received: from CY4PEPF0000C978.namprd02.prod.outlook.com (2603:10b6:930:b:cafe::4f) by CY5P221CA0004.outlook.office365.com (2603:10b6:930:b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.11 via Frontend Transport; Wed, 14 Dec 2022 19:51:38 +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 CY4PEPF0000C978.mail.protection.outlook.com (10.167.241.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5924.10 via Frontend Transport; Wed, 14 Dec 2022 19:51:38 +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.2375.34; Wed, 14 Dec 2022 13:51:37 -0600 From: Michael Roth To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Hugh Dickins Subject: [PATCH RFC v7 21/64] x86/fault: fix handle_split_page_fault() to work with memfd backed pages Date: Wed, 14 Dec 2022 13:40:13 -0600 Message-ID: <20221214194056.161492-22-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221214194056.161492-1-michael.roth@amd.com> References: <20221214194056.161492-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: CY4PEPF0000C978:EE_|DM4PR12MB5056:EE_ X-MS-Office365-Filtering-Correlation-Id: a4bde643-db12-4646-ca78-08dade0c9d2b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mFaTg346g8lcyFMW1cwlnoV+jQvmzSLRzmnUOb12LkhCFmmFRY9JlREPKL+VtpbgS7hvHwfechiK87qJMGnQHvGOvIM3vn+XIW+zztu8OHkm7eqgucuv3d3RdmY0Mag3WueRkWw2FAH0UrrlNDF47GsL52WI3AuQc6b5U9eSOFmMw4QtY62c2AbIZfeKzJPu3PFevA4+vK+H8IZDXqxLRcAnVuNrYBJFEcPISA1FYcmnfw4hCgzfY38ErWwh2ipsrDwqE+CNTNYJEHTgDMDslv2PayJmhZuLhVHMOKqViu5oIYXo6w4ekXuD/CpIyKItBpV4u7vNALAUMapHth5Jg/+5mmltYO3SFbmRs7fqfh8axDHGH5O5UnmE2KyjL79RCz4h+3qIT+HiCi2uW23VXayxBC6bfRouM9aHFLSL1FtSYaN0IM2coJYIJieriSk7vce99+xAvN+5gTr+/Pj3cQFmAedbJxuCZjWbNRpF6oe1g1vjqH3FUn/fCjpJsiR/xhIGa/tdgDfLGyWAiAV8FrJK1kcCRX7jDNG6fp4NzfaXt0P5vK39sN/O8sl8hUTX7sljQKR+RlQn4Kd91CWWGgijk+mVJXjg8+znJwQ+o5RB2P1lkoyqudulVSxw0fpKlKZejD4OTT6qO3/odlK6+3dD4oYkCIK/bJD/ZJsIEJJxZxPQX3wTYBEhp9OX/JT6BTnGtpzOExmrgqtlzbHH7e9VYsB43XG0RFVtnumqnV8= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:CA;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(346002)(396003)(376002)(136003)(451199015)(40470700004)(36840700001)(46966006)(7406005)(8936002)(41300700001)(4326008)(5660300002)(70586007)(44832011)(70206006)(8676002)(7416002)(36756003)(16526019)(1076003)(478600001)(54906003)(6916009)(2906002)(316002)(40460700003)(186003)(336012)(86362001)(2616005)(6666004)(426003)(26005)(40480700001)(83380400001)(82740400003)(81166007)(47076005)(356005)(82310400005)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2022 19:51:38.2806 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4bde643-db12-4646-ca78-08dade0c9d2b 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: CY4PEPF0000C978.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5056 X-Rspamd-Queue-Id: 730D9C0004 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: pbwqe6heto5xdq7z5un1mwg4351bh7sf X-HE-Tag: 1671047501-760138 X-HE-Meta: U2FsdGVk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000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Hugh Dickins When the address is backed by a memfd, the code to split the page does nothing more than remove the PMD from the page tables. So immediately install a PTE to ensure that any other pages in that 2MB region are brought back as in 4K pages. Signed-off-by: Hugh Dickins Cc: Hugh Dickins Signed-off-by: Ashish Kalra Signed-off-by: Michael Roth --- mm/memory.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/memory.c b/mm/memory.c index e68da7e403c6..33c9020ba1f8 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4999,6 +4999,11 @@ static vm_fault_t handle_pte_fault(struct vm_fault *vmf) static int handle_split_page_fault(struct vm_fault *vmf) { __split_huge_pmd(vmf->vma, vmf->pmd, vmf->address, false, NULL); + /* + * Install a PTE immediately to ensure that any other pages in + * this 2MB region are brought back in as 4K pages. + */ + __pte_alloc(vmf->vma->vm_mm, vmf->pmd); return 0; }