From patchwork Mon Feb 20 18:38:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 13146863 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 65F10C6379F for ; Mon, 20 Feb 2023 18:46:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A1876B0071; Mon, 20 Feb 2023 13:46:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0507C6B0072; Mon, 20 Feb 2023 13:46:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E340E6B0073; Mon, 20 Feb 2023 13:46:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D627B6B0071 for ; Mon, 20 Feb 2023 13:46:46 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 9C92CAABBF for ; Mon, 20 Feb 2023 18:46:46 +0000 (UTC) X-FDA: 80488551612.03.1BEEE34 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by imf25.hostedemail.com (Postfix) with ESMTP id 8F08BA0006 for ; Mon, 20 Feb 2023 18:46:43 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=p3yYnq7N; spf=pass (imf25.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.236.41 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=quarantine) header.from=amd.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676918803; 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=JJ7mvXs67EJ0aE4TtzERlbU26qCRRM7fEygmoXMzAmiQ/JFmy1q2p9cLL/CwB7PDq/Atk2 LAHDG4uPSLgFUWdB1u2k0jSSCqtNOKNjYAbj3fyowWwk8xmuGSxKWisBMqOxH0ixjX7zai uPom5saaP5sLjjtLu0kXjqRGzFybEqE= ARC-Authentication-Results: i=2; imf25.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=p3yYnq7N; spf=pass (imf25.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.236.41 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=quarantine) header.from=amd.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1676918803; a=rsa-sha256; cv=pass; b=jmisKeo44RYZk7S3HpvOeZL+ozvhgmYBd183alw6QLjJZwwkJ2nxuUBoE+5x69Sz7RhLS7 0YvJSnHEVvJO4CQYpIcVkvGBW19wBTTPes6YQEa/UjL3Mm6ffMPQxOtvf60QA0dhMT04Lc +3g9MbOD1SnEaAjdQ7a/z3qpsYElCQg= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MVRjs2k+sxXg5GY29MPMYn3AhV7TtUEMEc+Eov3Fq1flr4YlFQp4e71aQHJH7B354wDn6IJfvbNr5Vy54jHzITFRRQfL3AARhes5/NTgS1YFc2A73TMBuBlzK3w+bI2v2nsjIH1ViT552WjGGaFlietZE+4Agn5CwadX7UMtGZTGpCf2DiGASN/+ai3Cm0GtWqCnHRY9lMj9g8bCjIGYpNRgH70zhUIz9UpLi4UvrT/oZ/rUeVIkgdY9jowo2gsdAfMHEteGfZW0b5s7+QPTr26MIqUt9OL5g/PjpEhPWY4jAJu5filRKGBob3HHxvy29pqKgqDrpGw0gpklKBhk2g== 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=dZxBmpghRAzFGqYnF13dvp+FEhJJxgFbjYsmitOriqEXm6hIJD4AhJXMAU4h5UwHzFXabEJox3QjUtmPJS6ZIMp7sx/GUzX2cXgrUeNum9cw9yvaUs37QHOrycs0LpipBVOphY3SDWvU8LSzQKXvqydhwATuGSmNByo63H+JH2fuLXMIm7prbE2/uqWcTtSOKbP1KYCKgQOai3NNj4Q6WA+Ob6zZnXzEarzOTRZFt4wuLGbT0nSmX7gBC5Svu0TNsv8++RJodGBelqQ7lixW8wKtbZ5xTzaRzVM7TzjB50LL/00B183RpCM4IxMBnMtYkCiLJ7TMjaJGJf3Uf0E/ww== 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=p3yYnq7NW2BQ6QCQ1WAVRrLCAI0g/VIjE0oTcmF5RJKXruLyMHR6k2O5zsqySzBpo5tqS6UQenn8JKcZ5QX9vCwEwUEr//BPsnpkqQzF2Z0h3jGMzHEqQRhuN5OBMuT6Y40iJQlN90gXCwgWEp89wHJy60RLHXK/Lv69yvMWUdU= Received: from CY5PR15CA0054.namprd15.prod.outlook.com (2603:10b6:930:1b::20) by DM4PR12MB5264.namprd12.prod.outlook.com (2603:10b6:5:39c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.20; Mon, 20 Feb 2023 18:46:41 +0000 Received: from CY4PEPF0000C966.namprd02.prod.outlook.com (2603:10b6:930:1b:cafe::19) by CY5PR15CA0054.outlook.office365.com (2603:10b6:930:1b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.20 via Frontend Transport; Mon, 20 Feb 2023 18:46:41 +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 CY4PEPF0000C966.mail.protection.outlook.com (10.167.241.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6134.14 via Frontend Transport; Mon, 20 Feb 2023 18:46:41 +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; Mon, 20 Feb 2023 12:46:40 -0600 From: Michael Roth To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Hugh Dickins Subject: [PATCH RFC v8 18/56] x86/fault: fix handle_split_page_fault() to work with memfd backed pages Date: Mon, 20 Feb 2023 12:38:09 -0600 Message-ID: <20230220183847.59159-19-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230220183847.59159-1-michael.roth@amd.com> References: <20230220183847.59159-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: CY4PEPF0000C966:EE_|DM4PR12MB5264:EE_ X-MS-Office365-Filtering-Correlation-Id: ba5fa676-5082-4d16-0e82-08db1372ce65 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B7d/72wrsRpK+69U11y8f7soos0SsuWP+xMyNq08E54psX1/nQ4WL0L6VC9MUTK3rXt7gXXHCJfXuW0Xjwa+Dt2Osio0EoWKZv8leNvtsXtmc4+lOgBHjxVqbTOxN7tDQMD1rSo48LfsTk7Ua/WCVihXVNnbHZoshykNRgvrfaotk4Is05Fl7Op91tB7DXutFOflbN73S+Cy0c1w6Wa8AthKSewebo2L9xXduCiBfkIHVMnPk5GvE8QkXcP0/GGWUdiwcR3VGtgYv6LM2hmRD4G+TtNFyHG8GY1AtPTa91Jn0Qki9ShzymXykJWBHWRzF1V+Np6Ua7FcsRNRMBkl/+TfTasQxD2Kz3xuDoKk9MUB/jB5XdaSC94BRM8LS2Oq9t+Xp4v695l5PdV5cy/5hSlmTecCs7C6t8gvVN4QYvUWyrl9gVqEXW9q1vxcJ49NqZf+XgapBmL8ysg4qEhExE459i9v2B81wBVPt2dVj06/9F3aakZbsPVaCdEljCyEgirNCW1qzMY3hm2F5HgH5XJwRQxjeeWHLaquRGpBcFfz7AT7xC7CJMP59jlhvIxC1XWGFB0bcFoahPy1RoH8JUxnBfjjX38J3rWr+kPEUU0MN3ReAt7YLvncj7fEInKSzywbCGuwSrmvec9Oa9dHziCzxbqS57LPHkaYh39uhmzrMPHlB5QfUxtzfV/QIxPefi5n7stR7z0TYtAqLWQ1Ca65SlNSFKc0EVthNn/FJUw= 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:(13230025)(4636009)(136003)(39860400002)(376002)(346002)(396003)(451199018)(36840700001)(40470700004)(46966006)(82740400003)(81166007)(82310400005)(36756003)(356005)(36860700001)(16526019)(40460700003)(40480700001)(6666004)(186003)(26005)(70206006)(1076003)(316002)(2906002)(2616005)(478600001)(54906003)(70586007)(336012)(8676002)(6916009)(4326008)(8936002)(5660300002)(83380400001)(86362001)(44832011)(7416002)(41300700001)(7406005)(426003)(47076005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2023 18:46:41.1892 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba5fa676-5082-4d16-0e82-08db1372ce65 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: CY4PEPF0000C966.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5264 X-Stat-Signature: brb9umby6hyrfiwdfz4srp1nxqakrxk8 X-Rspam-User: X-Rspamd-Queue-Id: 8F08BA0006 X-Rspamd-Server: rspam06 X-HE-Tag: 1676918803-168809 X-HE-Meta: U2Fsd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Hu2SJuTpAlkGmHGKtj2QcVlNzMjYuwxlhgMZAymMxgwLOWhLpF9oR+L8jeEblHsbLazowStRHOpwMDuZMZMtH4klTCq3VoN8Khqhyq/9czE4xIC7nal/S34P+gmOYvZ0xFHgpqdsYI/eB6JS4BLuOaSUuHIWjYuoGdm4GRMCa3bRcRsU0KKzQfqU4UuynuKJ9bSIeTkNL8aLL4e2nwi9mLd4++N+U/Enpbhb1q3k4sdUqIMG9+8T3vs3EWeVyKurXLpPILzxot6QRqr5O5vV6VzLOUIjWTmSE6zYTv8L0cW6jVNY5RCy78uU= 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: 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; }