From patchwork Wed Dec 8 17:18:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12664907 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 F30DBC433EF for ; Wed, 8 Dec 2021 17:18:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC70E6B0073; Wed, 8 Dec 2021 12:18:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E75FA6B0074; Wed, 8 Dec 2021 12:18:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CEEEB6B0075; Wed, 8 Dec 2021 12:18:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0067.hostedemail.com [216.40.44.67]) by kanga.kvack.org (Postfix) with ESMTP id C0FF46B0073 for ; Wed, 8 Dec 2021 12:18:31 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 85E058245578 for ; Wed, 8 Dec 2021 17:18:21 +0000 (UTC) X-FDA: 78895285602.09.ADEC5EC Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120048.outbound.protection.outlook.com [40.107.12.48]) by imf04.hostedemail.com (Postfix) with ESMTP id F268040002 for ; Wed, 8 Dec 2021 17:18:20 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LE/s6+WRbMDbfUncsYoBUC9WNZEatc0K0R7Yzyl4x5r1ml9XGBlsrHxU6aUzkVeF1aSIZAWj9AlYeF1kfHW/UBygy+BUyNMdpdnLcqSHQY7C07CMtBAo7T1Ckg6LQ3zn2N7emys4/u5kSGbAQxKanAaerbAoxrc//pfQwztTGF7B//2IaDULlsDFWJL5A33QGbcjZwUaH6LAU837y3QpuNHQv6Qj1HwTTKBmmGFhjooFAcOe4fL1a2E5wFkzCvV398jTAUMZYfyEhVJHaeIt2Lx2dJeapNpkT3fDo2BH4xpsl4s94ayFDUl1EYwUZaopwIG+yJWoFvSfc3GdaH8ifg== 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=CecWjS/2UZ0IgcjyZ1BNFW6PGMsjPsk8NnvtJJ1/fvs=; b=h3fUGFXwPFbNzmOmiKKth9884dmg9d1gmKik929ZFnD5fdG5rERTR+pOF/QNGMs7Gd9Lw1PGA8Sbd088pn2HGd2JjCfvFIu1vXw5EbvOrJp6SPw7jfqYbp2NwPFkmfpGdiQpPmj43khdiljNOtUuCJF9VpQpI0o6wuInDGUIPe5MQOjcAJrEzeJtG2o61Ercb2GuCHmNN9x1VFW7Z8xrrQXWMxDLIfZ5KiemEZ/Xm/XTDOMMWRVXBsg5oTsB4ZargWPOe+/OLblejn6meBt8s5GNlWdWGb1DzHGYQ6hA63ax342xSwyjSPw3CpNg2k9uV2FZWsUBK2pKHlCY/J9Frw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR2P264MB0228.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12; Wed, 8 Dec 2021 17:18:17 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f%2]) with mapi id 15.20.4755.022; Wed, 8 Dec 2021 17:18:17 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" Subject: [PATCH v4 01/10] mm: Allow arch specific arch_randomize_brk() with CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT Thread-Topic: [PATCH v4 01/10] mm: Allow arch specific arch_randomize_brk() with CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT Thread-Index: AQHX7FeXvLiXZmbMIE6c9kZusjZ8EQ== Date: Wed, 8 Dec 2021 17:18:17 +0000 Message-ID: <75bf69360af50be65643a1f02ccbbadac9eb3157.1638976229.git.christophe.leroy@csgroup.eu> References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3d1cb298-bcc0-4687-358e-08d9ba6eb9ef x-ms-traffictypediagnostic: MR2P264MB0228:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2657; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: tWItzkakzdTfEjSoU2u2PoZgH60sVieVzMXN4/ef+2mQfejo4LVfjuO1pU1lS1E40KwHN3QMRpEN8pJ/pnC66ojNoO0fiXRmh2wlOEfUmO8ZfRquCQc57c8td55ahe0tOHdoJ9b4e3CIsUKlezaj0885Yi3AO1l0qToA/l10xwsmXkBiwe6EAmgh5dxVZMyDK6d+IGnbOWDzifKsoeTyBKI5brhl4hDOw92h+uoALyElCJmDubUhFs0Po3n0sRVPoxedhOZ6cCo1OJDzCmcgwLXjsO9PJUfcqRu1piifI0TsQLWLTloeaQKMxDCiuWj85UE9gzU6Ai2bYj3OH2jUJPDfaZOz69UMYikMV0pd9rCibIhtpoXiUtDuz+ESsLPX6gdvJh/EpVZy1t+UdKicbN7kWldKXBgkIXrn20PT+N9hUvFECSwcjl5hLFEwZOgjfjskGaqT07KIscnzBCR1UdXRXtY6lDVFJ1pow49XS0XxVX9NentBllURcViDzbExPwU4niIlkQXyxiz1qUgo/qQDyv67Qmz2WHGODDc86nTIP6NlEbXqoMw1/n9iv1EJ7a6N1/CqyuZ8lp0mKU+XWNxnB8D24H+5oc7uz/C4z6R2CuGncdX/1MEuULkyKX9wHmqJYLXifIRXxqVATDX+RMDZUBN/jQQ1x097KXZO5Uw57d390yUaMirj+cL/r97VXLYb86Zs1QQoQ1Ls7YBZuA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(2616005)(91956017)(76116006)(66946007)(122000001)(4744005)(5660300002)(38100700002)(66476007)(44832011)(6512007)(64756008)(66446008)(6486002)(66556008)(8676002)(86362001)(4326008)(8936002)(54906003)(508600001)(36756003)(71200400001)(38070700005)(316002)(83380400001)(26005)(110136005)(6506007)(2906002)(186003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?juKbev/1O23S7CAZaDCSmBC?= =?iso-8859-1?q?K/CLdeUb/Us+Vif2uWPIYrxV2PQypIkgEfdWuOGZpTudManVyKQe4Xhp1NiH?= =?iso-8859-1?q?f87hLsu0ZdymiUsn7qGgNzOQF1Ye6o0O2cDPmXrYHCxByoNxG7X5PsgK0YFL?= =?iso-8859-1?q?JFwKsSiN75tlZ40kG7F7YFSeGxBqJkjx2l+oEmia4eRyOosykvakEngbSBzf?= =?iso-8859-1?q?VxS2jnMEzHHeYkQTnDoxVMwGNE/jHiLFWPC4SwbEKpqC+mrXhxwPTqhTB3P7?= =?iso-8859-1?q?BMW4xD9gxmWf0+BmryC2Fox/Lr519f+LEv3pCcMyRx0GtMMcoovsEE4hHHTV?= =?iso-8859-1?q?J8tzxW+JBqXTmliRFpI6eVw5FBwi/KA2NE1ZeM6DUjAw2piY8HL4UFm4AotP?= =?iso-8859-1?q?EDhByCR42cOAbK5s8t4lRiRxTOaZCeB2OmVd6H2jVbqbwHexLFuVP8evHWTq?= =?iso-8859-1?q?0Bg2RrRxYSTrLovzWlFL6c0j8Pz5h8r6zCBrK3pBW5XkuC9DqmI/JjHpVwqa?= =?iso-8859-1?q?2Y1YR1hapGN96Yb/kutudElOARL9H0qP1PZiflqVcD+ItBUyouhTjXN7i336?= =?iso-8859-1?q?qorhbFrVZRNSLklIV5t38pyZY72HnVq7/buJaj52VdK2WLOajjoUIKAjjNkL?= =?iso-8859-1?q?CNIZgH1dlcGW1vhCS/qJErkrdox3NJCVGtu0c04fbiFFkc/EeU1wi4d/0Rz8?= =?iso-8859-1?q?GsuJUX/SOWoI2B0TbQF1yWg5vWUYF1cJjoeyXrXNu48w/SmC+Rh0tgjJsOan?= =?iso-8859-1?q?MbncXcfZcnkNEn++2eLDQOLBvKvi5jJl/42xTRKe2Jqi/E5H2Cch6XunhUwE?= =?iso-8859-1?q?8CgOme1awo7SoVwt2KkC0NcGBgYuBki2uE7+X2QRdLP/03SEI3XefEuYGX0S?= =?iso-8859-1?q?0t3Lai46EaTMog9zwqCFwIpmzmM0qYgvK7kTo9vtiFJGE7lJWydiAuSE6EdM?= =?iso-8859-1?q?rwgj+swRtl9hQvj1dMbrZ2lZbAYXeesSg/sd74/DQmBQM7hMdT3j9YT5qJ4U?= =?iso-8859-1?q?lcSFfeA/kEm784mCZ5VcOuvMRNCBt8RYxT3dLg+jLMlUXhjzmtyukJVcccd/?= =?iso-8859-1?q?z0hZMdGSpPaj8SGdC/P//bRT7Q3X0DPJ871Y8xQpwJRqsOPTB9vP1x/u1Ku6?= =?iso-8859-1?q?S7KwrCeuDxj+Ouadtth2xpPqAckyE0TRA9i8+eSAaf8op1P7OIy1Jyt884jA?= =?iso-8859-1?q?7R/dImKEsDXUZLvnGVAB1hetnJva/Py7AjK80sXrgiRrG10MHQHmgVkMO97N?= =?iso-8859-1?q?aKyHTam5aca48SaSgwek31FKtr/gj34+eG8HZWhHX1gWYl4oK3Ew9MY4Mjda?= =?iso-8859-1?q?zAJV2p59SL7N0SEOsQwiK51qF63b1X4VYL77pqmtgTPH8e1D19zlgcKHNsWM?= =?iso-8859-1?q?B9QiTYGfbIjpDGnhAcd9eTlWLv0t80NTCgaX7GYl4GfEudHElLwujCWxw0o3?= =?iso-8859-1?q?QDiNT20YXd8yNPKk+km4l4pdOzZEo9AxDdiU4vnU6WEzP8TlP2Y9nOPzGysS?= =?iso-8859-1?q?hMGUjDz5DvioqA6Q/DlCXf1+bZivBNVLVBfivhjTNgpjgbGBVNY87cHsIqRZ?= =?iso-8859-1?q?Hq5BF9/xLN/8TMSAFWxdVkOIL9tNtPGMAa+WW93Owz0bIODtsmCFyvfkEwwI?= =?iso-8859-1?q?G58Lq7Cnn2SuNHCMdQNrrE+TUney1VYpzhusTg8W1xIEBoXIebPJBTyFMgxu?= =?iso-8859-1?q?nq2ZYJv7wTwUkbb3hCJh3jYgmn8DC0xu8MBwaGoYgd9LXQa/GmDdjIkiGQ49?= =?iso-8859-1?q?AaZE=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 3d1cb298-bcc0-4687-358e-08d9ba6eb9ef X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2021 17:18:17.6962 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 6PuNUaWXPQTEPG/xTIg4OKZqHDRaOFlLZ1qyFRNU2VGcghBpLIxJYWbI6lbn6ldUAKSW9qfpzP9K5ECLmZ/1c8poFiXusX37JvDJ62iRp8A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR2P264MB0228 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: F268040002 X-Stat-Signature: 6goncsk8iye7igiahziw4zg4q18w9ynd Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf04.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.48 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-HE-Tag: 1638983900-776871 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: Commit e7142bf5d231 ("arm64, mm: make randomization selected by generic topdown mmap layout") introduced a default version of arch_randomize_brk() provided when CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT is selected. powerpc could select CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT but needs to provide its own arch_randomize_brk(). In order to allow that, define generic version of arch_randomize_brk() as a __weak symbol. Cc: Alexandre Ghiti Signed-off-by: Christophe Leroy --- mm/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/util.c b/mm/util.c index 741ba32a43ac..46d1a2dd7a32 100644 --- a/mm/util.c +++ b/mm/util.c @@ -344,7 +344,7 @@ unsigned long randomize_stack_top(unsigned long stack_top) } #ifdef CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT -unsigned long arch_randomize_brk(struct mm_struct *mm) +unsigned long __weak arch_randomize_brk(struct mm_struct *mm) { /* Is the current task 32bit ? */ if (!IS_ENABLED(CONFIG_64BIT) || is_compat_task()) From patchwork Wed Dec 8 17:18:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12664909 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 73CE4C433F5 for ; Wed, 8 Dec 2021 17:19:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 810B56B0074; Wed, 8 Dec 2021 12:18:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7BF826B0075; Wed, 8 Dec 2021 12:18:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6397E6B0078; Wed, 8 Dec 2021 12:18:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id 54DE06B0074 for ; Wed, 8 Dec 2021 12:18:33 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 1C5B18848B for ; Wed, 8 Dec 2021 17:18:23 +0000 (UTC) X-FDA: 78895285686.08.DCE7FDD Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120048.outbound.protection.outlook.com [40.107.12.48]) by imf04.hostedemail.com (Postfix) with ESMTP id 431C140004 for ; Wed, 8 Dec 2021 17:18:22 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c5IHaE1RghxPOzLoXLyQ98RvEDd4Gq0828plnRsToIv9/bbhdIjXR8yBjLzb8OqCNx+g49j3E8lVMIHPRHC+DbbzxznBI5IZ0ZbGHSiSXWYUEPKe+xN2y4FGAS390cyOJ/pAvW1pkMvQDalvPxmDL4ei/bE22bewQ2WiU/w8Uw5/wBg1Efm2K/rSjS16H0amCY62i/z33YarWLeNxZfW0THULt7HNH3HWC2hllD/DE2pd7D5SC2mdr5+SoPy49P/o84qHvBTKo4ybMh8NZOuUQz8OUmS2kUYhXmeCzerZjpYFUXir0bbfXdS+ypFqxKa9KWHUYBr2IeZkg32tRnckA== 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=mb8oXjzBpjFNS8rXv0nZ8Dve+gNuL7r2/5q0eP76QFM=; b=Bc/EEAwqihmeEIgc0CkJJpKKija2VGGujsLfFs3HvTruipgmY/KFW9iN/9IoSfHBQzvH+8g8wB5cY8rf5DbfR4BgVGryHWLCIUS54QBrpo5K/S3paUq1VAAYufbZb0tpl4CYtb/uRQRFn+LuomOuVaoHGntSBW2sdFr6GgMdiRislatJICNMk3jCde2KWO3rKZcbEl2bf42yyLSdswpcWe6wuss59cEYN93k2HAr2LOGHHThpyjMxye4ouLAS1m0K4Bk+wZ+stG84KL+qBjEa2uMlo/nLJRWqX5TZoQc0hLP3dCygD/hWvBH2rQwUnt9irZEfUGpQCPv0IAZp9ALlA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR2P264MB0228.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12; Wed, 8 Dec 2021 17:18:18 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f%2]) with mapi id 15.20.4755.022; Wed, 8 Dec 2021 17:18:18 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" Subject: [PATCH v4 03/10] powerpc/mm: Move vma_mmu_pagesize() Thread-Topic: [PATCH v4 03/10] powerpc/mm: Move vma_mmu_pagesize() Thread-Index: AQHX7FeXKyJMdySKVkCHabepEx7D7w== Date: Wed, 8 Dec 2021 17:18:18 +0000 Message-ID: <372d1488c35dca1c5af04f95d9b8548ea07ea603.1638976229.git.christophe.leroy@csgroup.eu> References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9968802f-d74c-4047-9c55-08d9ba6eba85 x-ms-traffictypediagnostic: MR2P264MB0228:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4303; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 5u8YKxULaZMGKUy2k+UmwhvBW80NEC+ZsEE8gcg3T/zBjtwp5DOLXIjHQTBm93+/INeiObeclE/nbdTcu2nv/qoOyplRpGOVQgAsGDOvGg70aIUnl+KYicmhjIUxjKEOh44MI8tbaThd6eeTA/MroIr/WdxeoED5ffGz1E+IGK3YHG54idITy0aCCr9ib+7yE+ZL36lPKPK0zCiUPyWjAfa3qSJ3EVjqhOLPnGGbSBh2MjB47wsECwt9RR/SQnpyo1tZS18ebjY014QdgIB+8Xd5aqdFqT0jh9g6IPP7nVJvpMJ8Xay5Ydw6gr0O2CqwEvO6tivY3FrX9MBey9x6XjZsrfQlHFZSk3VDvPYtIHSsGXwTib6MrXmj3iNuvJr59TT+VmgTp/m7uCAAEhPYguomECZn/TZs9f/CW0lVuVp+658Z1CvTQiISnt7ZSwZn6uTzv0TCPEqQU2P7/X0/G4uKOQviAGZVXKu3UkZcqcH/bscsHpUGjOBwwmSoFPDIua7tGYEbHAyFClKqiy4xdi1yPI3OlcNjWgoVhVcLNP+O0UrzuCGYiThs9da1LBkp7fJSryojE4uElJ4FFXOAfkF4MWMbeUjIV2CTzmNIaLB02kgc87sm73VR9uwJ5JpdIJwKb5IH6c2uFcuEDimPcfGRM2sHrli70w2gIQGSbpRJqJFoIcgGmqgn6PFV3COo6QrBDSQX0LmDHGvH9/gNTQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(2616005)(91956017)(76116006)(66946007)(122000001)(5660300002)(38100700002)(66476007)(44832011)(6512007)(64756008)(66446008)(6486002)(66556008)(8676002)(86362001)(4326008)(8936002)(54906003)(508600001)(36756003)(71200400001)(38070700005)(316002)(83380400001)(26005)(110136005)(6506007)(2906002)(186003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?OCPcTq7iChTlb+wkrhu+ryH?= =?iso-8859-1?q?hDeHduavcUj5hGuux1ihsIzN4poDrcLdJlEWz6F7Lmsqoa5CepJ03HqfvyF/?= =?iso-8859-1?q?PFaYh85bPRG0lQw9BN8NxFXJJ3kG8WSmBEkfikgTGVgN75CSXl8lhLvlIQCA?= =?iso-8859-1?q?o5EnadRJYyZWu4Vm6n3ezrJ4rAfJEkygJi9PA9aX+Svy6zsxSWMgd3mNigOj?= =?iso-8859-1?q?mCJPLjBg+qAIUzULM2D5HMA3C/Be9LKiY8mQ1Q77dtE318BomCQ1id9qhF6N?= =?iso-8859-1?q?tu3nRbFnbgLrGugHsFxiiskCWMORPEoI0FQ8VU1XVo6yvStDC9IC6HKm1oaY?= =?iso-8859-1?q?JDEwL/OqW+2/M+55cYbUNYGxrhpl7YL3qGAvynoMr8d+FmWwlrpcPVZ06tT1?= =?iso-8859-1?q?0qVVSKmxzAd7n7P/Icx99HVqKOytHYq3uj/R2ovWtueLIbpfC/CofK6dK1iX?= =?iso-8859-1?q?ci78LA8Xz+dUY9cS6ZRHfgEsxlnHJlQsleDO/g+mzIxLmP0EYDGT8YbOIEoD?= =?iso-8859-1?q?R15qpzo0QAFAC7c51KKdzEwMIMp2ECbD8f0G5yPhXKJwoUx5gU+LJYgRU4p1?= =?iso-8859-1?q?r/EHnkuBd5zBEVmsp/ag0kFnAA248jZ6A+YLsnBQYIS/RDhA5R/Nx9GbMypl?= =?iso-8859-1?q?EOU7/3w3AxRQK4B2XqmfGG2hbNUB71Y4ymM3VnWMP9NnHQWc8G/oO3CVvQ4A?= =?iso-8859-1?q?5+KZN7FmeFNZ107M8kOJjxTu8ubXGmofMVKr8zHnz/reDHpUXDnXMyaOPz+n?= =?iso-8859-1?q?MbVpaFYr7vOmnOV6iklxnlh1TakvPHxsmZabRsG8DpcMY4WAEebUi9bOSp/R?= =?iso-8859-1?q?5FIE+NYv5o8yIVUOCVbLkQJYCm+vc7WzI9zNSQTJUa6GmvWkYaLX4XAqeGha?= =?iso-8859-1?q?xWmmngD5cB0Z+9vt7bDE8orE4LdL2NUctLZpikJM33zo5dwUiDSgPo25M8E+?= =?iso-8859-1?q?cbOqUn26qOH/mgSMSV49Blc13O3kskFDHOjeFurSXwIZN2EokOok7PRhMAzt?= =?iso-8859-1?q?qOmLZ6y5Lz1cKvf3Ids+UucalGScIMUM+PQ+3znDj7h7RWTYFkUeWO000Tpm?= =?iso-8859-1?q?z4zneEtp4efNAR9c5HXOYf8NWVl+JmRm3GcWximq3U3shfP6rFC7LxZX75ay?= =?iso-8859-1?q?No6Lx1+wN+/nRO1XELYcmIyuTuMtt6fCZ1a4cUVOFBF3dFLAlM6VfrhEXk2w?= =?iso-8859-1?q?sYG5WtxWryVUt/wYq8s4G1VBpchd2W1W1AoKLEujbkYYsh/evgadnTqSoOAS?= =?iso-8859-1?q?bzAW5zkPOaXTwHAvIz5/YACsCv5mgq6TA5i+07v3uP90UCdAVKqkPCwcNg49?= =?iso-8859-1?q?PAwnyLpS1zvLKRfQIVIY6Dib+hbGw1Gpf3dEPN8jAirmA72edR5YsX9cCNAJ?= =?iso-8859-1?q?o7gxPDxTa+yDjxX89nZEons46GwZZbZGOyIS01uiyiy82HFSHrPxQlB5K6uK?= =?iso-8859-1?q?GbHU8R5hPY0cXCoJu59whw4fKFKNqeWKPZg6dWd3zjseUnM8rJ0mKWiFzdc0?= =?iso-8859-1?q?vjV2ajD4pgBs6m+bNLh8Yy3NQGyzofTjcV5xA1mdrH6TdRK1VLghnbaUu8DX?= =?iso-8859-1?q?F1jhYyUE5RO0+6O39u6XxInu+wJbtfQbPDshDn9yIt+yeLQTi2yBwdKJchkZ?= =?iso-8859-1?q?gZdnoqR106QAz7e4rNvIfxSjoZBb+RIYcDjCoOYLnADiaIF6fbbcZl6pMLiR?= =?iso-8859-1?q?drtcejjydlfV2/vtMQAK9vFnC5+jhbt8XprbwpqDo4YqrylIRcdE08JPxXuA?= =?iso-8859-1?q?iA5M=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 9968802f-d74c-4047-9c55-08d9ba6eba85 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2021 17:18:18.7187 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: wwaUfq7CZF7oLA2RRRdTKPI09LS7PevKZL6LIz3Ki0Y67CVOQ8Wzw/suNyy9pae0bryooTJMnrPIP3c5QZAB9oGnb5iKBfv6R0MyKmQC72A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR2P264MB0228 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 431C140004 X-Stat-Signature: fdymxstmhxampzczmwu3qqnyt91y15e4 Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf04.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.48 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-HE-Tag: 1638983902-729688 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: vma_mmu_pagesize() is only required for slices, otherwise there is a generic weak version doing the exact same thing. Move it to slice.c Signed-off-by: Christophe Leroy Reviewed-by: Nicholas Piggin --- arch/powerpc/mm/hugetlbpage.c | 11 ----------- arch/powerpc/mm/slice.c | 9 +++++++++ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index ddead41e2194..0eec3b61bd13 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -565,17 +565,6 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, } #endif -unsigned long vma_mmu_pagesize(struct vm_area_struct *vma) -{ - /* With radix we don't use slice, so derive it from vma*/ - if (IS_ENABLED(CONFIG_PPC_MM_SLICES) && !radix_enabled()) { - unsigned int psize = get_slice_psize(vma->vm_mm, vma->vm_start); - - return 1UL << mmu_psize_to_shift(psize); - } - return vma_kernel_pagesize(vma); -} - bool __init arch_hugetlb_valid_size(unsigned long size) { int shift = __ffs(size); diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c index f42711f865f3..8a3ac062b71e 100644 --- a/arch/powerpc/mm/slice.c +++ b/arch/powerpc/mm/slice.c @@ -759,4 +759,13 @@ int slice_is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, return !slice_check_range_fits(mm, maskp, addr, len); } + +unsigned long vma_mmu_pagesize(struct vm_area_struct *vma) +{ + /* With radix we don't use slice, so derive it from vma*/ + if (radix_enabled()) + return vma_kernel_pagesize(vma); + + return 1UL << mmu_psize_to_shift(get_slice_psize(vma->vm_mm, vma->vm_start)); +} #endif From patchwork Wed Dec 8 17:18:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12664911 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 C9ABEC433F5 for ; Wed, 8 Dec 2021 17:20:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 37C706B0075; Wed, 8 Dec 2021 12:18:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 32BB36B0078; Wed, 8 Dec 2021 12:18:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 17E906B007B; Wed, 8 Dec 2021 12:18:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0240.hostedemail.com [216.40.44.240]) by kanga.kvack.org (Postfix) with ESMTP id 05F656B0075 for ; Wed, 8 Dec 2021 12:18:34 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B9625180238C2 for ; Wed, 8 Dec 2021 17:18:23 +0000 (UTC) X-FDA: 78895285686.18.0C48290 Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120048.outbound.protection.outlook.com [40.107.12.48]) by imf04.hostedemail.com (Postfix) with ESMTP id 0227A4000B for ; Wed, 8 Dec 2021 17:18:22 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hzsvTZn30WXb6aixkWSi5ZhEt5rIEuUhKMbDqnBnraNXS0V8RkkN/FPwy+OfdvYU3izFNwtkKKERZ9X7iSo4FcuxSfsMRYwNft4r/nomBUvd4eQISl+TuIN59Uaxvi5Ndc/CQwMSeqlMSWh3tywZSj3IYv9gQDvryP9dCqrobq4+qkrJJ2q08EvJQs+MHfr+3XzkxsM+3YhpTcTFx6EREJIjaf1ST3OGqJW4qs9kzlWemQsZ2UaRrGOfVC47P1awF8zZ+DvYe6Z8k1xTcKmLRW0Cs3oUmcSF1VknHTCVgWP3OMRcAhvbrcNw2Dx23vYMlcKTf6fuwlc37ylp6hd+/A== 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=Kal8uZy0vwBrMzZSbVRzSwNCiz8HNSzE2KXYS2+awQQ=; b=BjHkaUq7qwvTwTPEnOoUlVxTAspEUXlMQlyUfF7mc9L9yggT6KJFJATukZTEzI3pYO/EjQ6aq602SNf3UBtcD4pMlIIy8Ml1VGWDTwXbz8T50TgAfA/SSV9xYJK60qfj1wfQYeeciAjyKeT9K1Z6LnRwfob58GuSzIBlTIWRs3gNQkf8WL4fy+eLbEMCnXa3y9VQBFiCCp+tZcsYfwomllJJX6HfcJkSO3Cx0Tbu2NhOABLQiDJrXxYcHCS6OGqbVxdTN7QF+NDQTgG6dDbLltryFBurObDO3Dp4iSYX8x7EiP0EYX45H/0tGMs1c2xZ4CYCOzktDajk/pYSeRpj/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR2P264MB0228.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12; Wed, 8 Dec 2021 17:18:19 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f%2]) with mapi id 15.20.4755.022; Wed, 8 Dec 2021 17:18:19 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , Nicholas Piggin Subject: [PATCH v4 04/10] powerpc/mm: Make slice specific to book3s/64 Thread-Topic: [PATCH v4 04/10] powerpc/mm: Make slice specific to book3s/64 Thread-Index: AQHX7FeYbuPGOcS7MUOB41b1rsfSXw== Date: Wed, 8 Dec 2021 17:18:19 +0000 Message-ID: <47948d4b1e2195ffbfc59c9962d7eb9951af716e.1638976229.git.christophe.leroy@csgroup.eu> References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 11a6172f-94d3-43fa-e6be-08d9ba6ebadb x-ms-traffictypediagnostic: MR2P264MB0228:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:178; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: YNvbJUzXLjGDFsVQgptEJ4qDpXySZbBJze5OPdexgXOOi1HJcqOgbrYgwu0G9WY38dJM/j9hVjhzP6Z7mRQIPD5gQPit1ltikRUwaEsAAqMIte29/aPGJhHQ79hYJSD0tr5IHvfoZv4R0N3vtHPv2BKGNjK9cf6D8+xIDT9mbVvMmqUlMv8ixnPZIarvl3fm3fTZ6fIDUIRXpkQBgSbH/ymlFRHQX5UKpKuTIvZniPKuD62Zt/XLJrcqxKt3sZ5390x4C8k0T4CFqwCnNTa/iPSW9YYEW04yzt9O84AlgLIp98ptFx9MVs7FH34iqNLWHMm9PNLTQGgEszX1vNNN3iw/mo4jbFBr3aF0SopC4GBasowVV2EtKAMKyC1xnQ838q4uLSmZ5ONAYLJUZ7QIyiJua7CUSfqgrRSM+ZlLRFtqImBNPtm+EpJOOH+Ft6pOAUPAvPkKgfzy4T9qQQpQ5NhgycOYE1fC29oDgQ0126EnvKteE6WU12bYcMUkykYYoAeGgg3KGzr5lBsOopUeDL9uN5zleIbtRCFGJa2vnoKJiq6xSoG2ttCL8KjlEfowdK2Dz8gcU04YHU5tQGyP3usQdxkm0dlH4/4zEEG48mVEiCWg2YhGTsumPwsxzSoWIosPMPqUNAa0Pmy8vKTBqKArWacYQ+hTQ6F8uBA/2UXHWPVIvp8xIyxGMImzwf2y23myMAor2ACw1ihrjz6YXjc66ZAYUHj5OQFdDLylAhg= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(2616005)(91956017)(76116006)(66946007)(122000001)(5660300002)(38100700002)(66476007)(44832011)(6512007)(64756008)(66446008)(6486002)(66556008)(8676002)(86362001)(4326008)(8936002)(54906003)(508600001)(36756003)(71200400001)(38070700005)(316002)(83380400001)(26005)(110136005)(6506007)(2906002)(186003)(32563001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?D72YcDrPXAk4WzLhloL+VLz?= =?iso-8859-1?q?+Qff1AbGMc7sZA7F4TlpKfGYJybXcpcsSsXh3L//9rQt6/7SGDOHMilj7kkl?= =?iso-8859-1?q?D3Xh0lmj9OUpW1KzV1M/aNY7sWadKqBPoHnBolqNXJk/EtJNcjqfFoCt92tX?= =?iso-8859-1?q?KyR06hB2+pxbYHIEPAaoiOKcSYLXs8F0XLftiNvBz6N5RmGs/GLFYyvjaUcY?= =?iso-8859-1?q?a8i9u7bMZ6oXY9n3xQxmXjPpFyeUGXXw8PzYc9S8eiQY55484mJl1PqVIo2n?= =?iso-8859-1?q?wT4CciSsuzpXWYAP7w5D1Feb8U/GseGnzb/xhjU37teElQtcHSoUNmNiAxIP?= =?iso-8859-1?q?tq63mBKulVL5Mk1rBPsLACo9lRI2RftAuFONc/PauFYqf8nEEqplnwHNVVH3?= =?iso-8859-1?q?1vshQ8XeuX4VS6fY7UDiJELSQVpVw8/DlV/6UaCPA7mkWxcpKS2voNXJldhY?= =?iso-8859-1?q?PCF9bp6pkYjk37nWBNjjDi3uLvf7XCnCBx3OmTI8ItcXTQKQjvvGozoUp0Fj?= =?iso-8859-1?q?1rYb9AO3ekE90pid2sJdf3LuA4bnOkUH9EQQ17fuVPelgh298SADCVJZcEhX?= =?iso-8859-1?q?2eGQnp7PbW9fkebY3kCpB0iASYPOu0oXxmNigAO//D4PSbpRp2WCaI3ltMvS?= =?iso-8859-1?q?2nUaepu7r4E5xlkb3l1At30kbovAi7zWIyj8sYcdjRmt7rCgOPseyNQCdZBd?= =?iso-8859-1?q?t6Mo0BPm16c63QGAi4fmE2dkV5WOYS8TtEvgN1cMzU97/fQppITaTFb14l4A?= =?iso-8859-1?q?Qm3nbqAcyDjZBPf/WdNLDyVyKfngQDD+7ilyi2htW8wW79ayyFZo937mM5zW?= =?iso-8859-1?q?rZtzTltohnhb8k+16nDL87PLXDl/5O2orPbuPTvZFnibEqwvWTWitrm/bwTg?= =?iso-8859-1?q?PhiwRrFJBF1MRjAcO8FARgbIdDKyLPzapz4DaBlf2GrpkOrgAORrXX4xU1q5?= =?iso-8859-1?q?fUKlXzOz4u2aAIOMppJZlpzMlYcGO3jU3OL9meN3grrDolu/AZNS4aB+pbFi?= =?iso-8859-1?q?oSHee5GqqBCFGMwvpsgfSR+QzRZkiTmPUYUaxECZDW6m4BW4me3DmYGcvYYY?= =?iso-8859-1?q?zmnfqvLAMPbeTEE81dwhbf43YJm8tplC7nQ00JjzChdcs/RRSYCK0FrvR8pu?= =?iso-8859-1?q?L4Py2kHHO/YCjF1zcIyXBejuoqwbLP87Wv+FY7lq8Qz/MJgK5j31DA+h02F0?= =?iso-8859-1?q?PPZDsmjepbehQ67ZgeWN2Gs9xTRa728D65N/siZ/Sm0HZR9CLBkORX7onwQh?= =?iso-8859-1?q?VgYdTFjvSUyd/cx08FFpf/tKjq3fDP1/DNolgMDiKLW53Z7EAJ+OfzJBkwCA?= =?iso-8859-1?q?BCqBodV8X47qUGpDtpFKqIjDsBptqKu0fMObwRgSNLW1kNSjIHQ8i+9tKMxa?= =?iso-8859-1?q?iWbBW6cDAa0gGxqQYzGmTFVkNTd9KUutSRn6YchmMXsBLx83GiCGvwATZmmV?= =?iso-8859-1?q?xD0N5HoOB4qToj9HupMB/q5lrOX/mP5B4ifNsDxO8QmayHxYlFvf43ZYlVcf?= =?iso-8859-1?q?Sj+t6hXY+TL9xqw0j/M9B4tI9WnWmyxi4ykzJpF9VzWW/ArLWi2HtCfGuN4S?= =?iso-8859-1?q?5WWLSSJy4IA7O882cdxSSbi4PlGep7cVDWW/izDVJ6k4U7vD7xRkXSoR7V/m?= =?iso-8859-1?q?1G8uRzv2IIPmJmyCV9f6CFudpWPjRZww2JEvJyDwSTejYnsUQmFgF1Xw5dCa?= =?iso-8859-1?q?uols3e9qd5oepIc9Vb3I4bPiDHucKw4prLnh/TBAb2DOBvRn87YHwPNiAr2z?= =?iso-8859-1?q?LerQ=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 11a6172f-94d3-43fa-e6be-08d9ba6ebadb X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2021 17:18:19.3141 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: GMNj1zEJd0y9IwzWAN7tkmoRgwEOCoZbBg+PJ61TcKRDAUoVRes4oe4xSGSYlvgLAkhb0Bwdd1FxnM4Gij2+/EyqS/K/+MAfGmVD4FuHpyQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR2P264MB0228 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 0227A4000B X-Stat-Signature: youcuymndo5y4t4d431wqdiaxhxnetgs Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf04.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.48 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-HE-Tag: 1638983902-940651 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: Since commit 555904d07eef ("powerpc/8xx: MM_SLICE is not needed anymore") only book3s/64 selects CONFIG_PPC_MM_SLICES. Move slice.c into mm/book3s64/ Move necessary stuff in asm/book3s/64/slice.h and remove asm/slice.h Signed-off-by: Christophe Leroy Reviewed-by: Nicholas Piggin --- arch/powerpc/include/asm/book3s/64/mmu-hash.h | 1 + arch/powerpc/include/asm/book3s/64/slice.h | 18 ++++++++ arch/powerpc/include/asm/page.h | 1 - arch/powerpc/include/asm/slice.h | 46 ------------------- arch/powerpc/mm/Makefile | 1 - arch/powerpc/mm/book3s64/Makefile | 1 + arch/powerpc/mm/{ => book3s64}/slice.c | 2 - arch/powerpc/mm/nohash/mmu_context.c | 9 ---- arch/powerpc/mm/nohash/tlb.c | 4 -- 9 files changed, 20 insertions(+), 63 deletions(-) delete mode 100644 arch/powerpc/include/asm/slice.h rename arch/powerpc/mm/{ => book3s64}/slice.c (99%) diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h index 21f780942911..1c4eebbc69c9 100644 --- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h +++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h @@ -18,6 +18,7 @@ * complete pgtable.h but only a portion of it. */ #include +#include #include #include diff --git a/arch/powerpc/include/asm/book3s/64/slice.h b/arch/powerpc/include/asm/book3s/64/slice.h index f0d3194ba41b..5b0f7105bc8b 100644 --- a/arch/powerpc/include/asm/book3s/64/slice.h +++ b/arch/powerpc/include/asm/book3s/64/slice.h @@ -2,6 +2,8 @@ #ifndef _ASM_POWERPC_BOOK3S_64_SLICE_H #define _ASM_POWERPC_BOOK3S_64_SLICE_H +#ifndef __ASSEMBLY__ + #define SLICE_LOW_SHIFT 28 #define SLICE_LOW_TOP (0x100000000ul) #define SLICE_NUM_LOW (SLICE_LOW_TOP >> SLICE_LOW_SHIFT) @@ -13,4 +15,20 @@ #define SLB_ADDR_LIMIT_DEFAULT DEFAULT_MAP_WINDOW_USER64 +struct mm_struct; + +unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len, + unsigned long flags, unsigned int psize, + int topdown); + +unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr); + +void slice_set_range_psize(struct mm_struct *mm, unsigned long start, + unsigned long len, unsigned int psize); + +void slice_init_new_context_exec(struct mm_struct *mm); +void slice_setup_new_exec(void); + +#endif /* __ASSEMBLY__ */ + #endif /* _ASM_POWERPC_BOOK3S_64_SLICE_H */ diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index 254687258f42..62e0c6f12869 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h @@ -329,6 +329,5 @@ static inline unsigned long kaslr_offset(void) #include #endif /* __ASSEMBLY__ */ -#include #endif /* _ASM_POWERPC_PAGE_H */ diff --git a/arch/powerpc/include/asm/slice.h b/arch/powerpc/include/asm/slice.h deleted file mode 100644 index 0bdd9c62eca0..000000000000 --- a/arch/powerpc/include/asm/slice.h +++ /dev/null @@ -1,46 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_POWERPC_SLICE_H -#define _ASM_POWERPC_SLICE_H - -#ifdef CONFIG_PPC_BOOK3S_64 -#include -#endif - -#ifndef __ASSEMBLY__ - -struct mm_struct; - -#ifdef CONFIG_PPC_MM_SLICES - -#ifdef CONFIG_HUGETLB_PAGE -#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA -#endif -#define HAVE_ARCH_UNMAPPED_AREA -#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN - -unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len, - unsigned long flags, unsigned int psize, - int topdown); - -unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr); - -void slice_set_range_psize(struct mm_struct *mm, unsigned long start, - unsigned long len, unsigned int psize); - -void slice_init_new_context_exec(struct mm_struct *mm); -void slice_setup_new_exec(void); - -#else /* CONFIG_PPC_MM_SLICES */ - -static inline void slice_init_new_context_exec(struct mm_struct *mm) {} - -static inline unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr) -{ - return 0; -} - -#endif /* CONFIG_PPC_MM_SLICES */ - -#endif /* __ASSEMBLY__ */ - -#endif /* _ASM_POWERPC_SLICE_H */ diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile index df8172da2301..d4c20484dad9 100644 --- a/arch/powerpc/mm/Makefile +++ b/arch/powerpc/mm/Makefile @@ -14,7 +14,6 @@ obj-$(CONFIG_PPC_MMU_NOHASH) += nohash/ obj-$(CONFIG_PPC_BOOK3S_32) += book3s32/ obj-$(CONFIG_PPC_BOOK3S_64) += book3s64/ obj-$(CONFIG_NUMA) += numa.o -obj-$(CONFIG_PPC_MM_SLICES) += slice.o obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o obj-$(CONFIG_PPC_COPRO_BASE) += copro_fault.o diff --git a/arch/powerpc/mm/book3s64/Makefile b/arch/powerpc/mm/book3s64/Makefile index 2d50cac499c5..af2f3e75d458 100644 --- a/arch/powerpc/mm/book3s64/Makefile +++ b/arch/powerpc/mm/book3s64/Makefile @@ -21,6 +21,7 @@ obj-$(CONFIG_PPC_RADIX_MMU) += radix_hugetlbpage.o endif obj-$(CONFIG_SPAPR_TCE_IOMMU) += iommu_api.o obj-$(CONFIG_PPC_PKEY) += pkeys.o +obj-$(CONFIG_PPC_MM_SLICES) += slice.o # Instrumenting the SLB fault path can lead to duplicate SLB entries KCOV_INSTRUMENT_slb.o := n diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/book3s64/slice.c similarity index 99% rename from arch/powerpc/mm/slice.c rename to arch/powerpc/mm/book3s64/slice.c index 8a3ac062b71e..e4382713746d 100644 --- a/arch/powerpc/mm/slice.c +++ b/arch/powerpc/mm/book3s64/slice.c @@ -692,7 +692,6 @@ void slice_init_new_context_exec(struct mm_struct *mm) bitmap_fill(mask->high_slices, SLICE_NUM_HIGH); } -#ifdef CONFIG_PPC_BOOK3S_64 void slice_setup_new_exec(void) { struct mm_struct *mm = current->mm; @@ -704,7 +703,6 @@ void slice_setup_new_exec(void) mm_ctx_set_slb_addr_limit(&mm->context, DEFAULT_MAP_WINDOW); } -#endif void slice_set_range_psize(struct mm_struct *mm, unsigned long start, unsigned long len, unsigned int psize) diff --git a/arch/powerpc/mm/nohash/mmu_context.c b/arch/powerpc/mm/nohash/mmu_context.c index 85b048f04c56..ccd5819b1bd9 100644 --- a/arch/powerpc/mm/nohash/mmu_context.c +++ b/arch/powerpc/mm/nohash/mmu_context.c @@ -317,15 +317,6 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next, */ int init_new_context(struct task_struct *t, struct mm_struct *mm) { - /* - * We have MMU_NO_CONTEXT set to be ~0. Hence check - * explicitly against context.id == 0. This ensures that we properly - * initialize context slice details for newly allocated mm's (which will - * have id == 0) and don't alter context slice inherited via fork (which - * will have id != 0). - */ - if (mm->context.id == 0) - slice_init_new_context_exec(mm); mm->context.id = MMU_NO_CONTEXT; mm->context.active = 0; pte_frag_set(&mm->context, NULL); diff --git a/arch/powerpc/mm/nohash/tlb.c b/arch/powerpc/mm/nohash/tlb.c index 311281063d48..3359cf7c2a61 100644 --- a/arch/powerpc/mm/nohash/tlb.c +++ b/arch/powerpc/mm/nohash/tlb.c @@ -773,9 +773,5 @@ void __init early_init_mmu(void) #ifdef CONFIG_PPC_47x early_init_mmu_47x(); #endif - -#ifdef CONFIG_PPC_MM_SLICES - mm_ctx_set_slb_addr_limit(&init_mm.context, SLB_ADDR_LIMIT_DEFAULT); -#endif } #endif /* CONFIG_PPC64 */ From patchwork Wed Dec 8 17:18:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12664915 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 C2A1DC433EF for ; Wed, 8 Dec 2021 17:21:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D6AC06B007B; Wed, 8 Dec 2021 12:18:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D16E16B007D; Wed, 8 Dec 2021 12:18:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A0C666B0080; Wed, 8 Dec 2021 12:18:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0206.hostedemail.com [216.40.44.206]) by kanga.kvack.org (Postfix) with ESMTP id 849346B007B for ; Wed, 8 Dec 2021 12:18:34 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 4E0B188CDA for ; Wed, 8 Dec 2021 17:18:24 +0000 (UTC) X-FDA: 78895285728.02.7158F47 Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120048.outbound.protection.outlook.com [40.107.12.48]) by imf04.hostedemail.com (Postfix) with ESMTP id B8BAE40003 for ; Wed, 8 Dec 2021 17:18:23 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fuITD7IHr8mpH3MXdMHkerX+Vw3EPZDKI0cFHlAToWKHe3tLusmcQi2LhYxenreBCApS7eP28x/wIC+3ySj7wApk1bw6Lpq1h9Koi6uNGhAEKZAvJzKsQWpyi81IMnNxzLCuNLQ5EOz6W/PQAIGjglnAyo+DFDahPP8lHC4BWgbRLh+0iWy5IChAiDWgqiMQdUKYnx2d3h/VaCDwm+Lm5duFBjJ+cSRUDYoEQb7VPbQuSucPdWZ8qRdO2B9toblT4R26xlrernpXKPwYabzJ6EFUWxUa98pvLxVaOHjVcpjjRB0FwOU+NGmHMimizXLBVame8fDFuw86I6gZT89KRg== 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=39FFmOvJEbICLmGjehFIN4rt9ehZmkF/y1NsezPHRsA=; b=Juc6gDZEu2PmRYRGJhprsAcbUfTIauOW9Lxx8JP2yEfP81R5fAZ8pCqQ5NHFv3parduSt7AVJ6/g9FRe8H/bPjAZpaDfTJSsk2+AgZXeRq1F97QaA+RdIrmzK6mrCoDyRdHHLr077ILs6l1hszeS8O5VTTGeWoPb8hFDqmMYYc4HH7PKBdt0JBEisnwvsU05e2OOIbs1wszYU/IIFBF7e00v+iElAa6vw+yQtD7Yxd7W9mxwliUJsmbTm59cmvRqTAtzLvmcwUDvB00FRHoVVDgyQeF7CBZ9TPRSIHvyKhVVzy4U9esaC+RZ5dRA9xiqNj01DCd7PUjBQd6dGpQ5Mg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR2P264MB0228.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12; Wed, 8 Dec 2021 17:18:20 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f%2]) with mapi id 15.20.4755.022; Wed, 8 Dec 2021 17:18:20 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , Nicholas Piggin Subject: [PATCH v4 05/10] powerpc/mm: Remove CONFIG_PPC_MM_SLICES Thread-Topic: [PATCH v4 05/10] powerpc/mm: Remove CONFIG_PPC_MM_SLICES Thread-Index: AQHX7FeY8SQL1cZ4Pkif6fv54TDK0g== Date: Wed, 8 Dec 2021 17:18:19 +0000 Message-ID: References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 72913f7a-0c43-497b-c3bf-08d9ba6ebb47 x-ms-traffictypediagnostic: MR2P264MB0228:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4125; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: CfawERVPxfm9mVwYyZlT+Lu7hl66gPn7iZzyNlp13OxD/wXX23HuW8lhDf4X0kO/XgQdefkUytADIUFEFtuoenSJaxK11a65+fSGq/zlTsjaXujffhKrfJ+phgp/Z3TCvKsAT2pBdjeE3ZoU2U4qe5i5EnaCiqHL1l6CtHYPyehcgZIIncRD5zUAeYaa/z9cfl2cUBkg3b0TgclSrildyHnnGZ5uJKf7Uc6Zq3YIK4vYpN2iGHDSzIUQxyWLRfsFacwjnow4sVeN+UyYnX7Su/6SUpeZBhN16oGENzn9lZfqeJCPXuo5It3qBUzU+JWtbmBzXPGTBC5rvw1OfDYLAYLYGkk7YGpX/2gdrt2WNb4nIrldi/eKYsHznB9Cmm6s4dGlPfIaTUUrca5RP8nmV0znPfAEUAo65v4M4iq8NiClrF++FU5qlfS4lDuL0uvXrXwjIRnioYKGKmql9aq7NM4SVYg0CCX9umSOG+NIugv/Qt5mG4KI1mkRjfkS6JGXhQU8cGTKiyblmuhd4aoqsLZtAspZlrvskKFbr63PEaY88q94VJvjjbOHGY/kv3X0ubvRc97+eJs5mfl19WAm2Bdsr7SYDFsDFYu4msUaVt/8XbjGm4ZO8AD3skHSSYe7UbfbDa1DRC4RalRXDszngSekzMgOdx4PIOqKYjTHm0b4wKqBlAg23S1c17qF5QhEDbsP5Y9YXDtgtKqxMHHUeA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(2616005)(91956017)(76116006)(66946007)(122000001)(5660300002)(38100700002)(66476007)(44832011)(6512007)(64756008)(66446008)(6486002)(66556008)(8676002)(86362001)(4326008)(8936002)(54906003)(508600001)(36756003)(71200400001)(38070700005)(316002)(83380400001)(26005)(110136005)(6506007)(2906002)(186003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?1DF4nrcn3ZEtkepLAmGF5Sx?= =?iso-8859-1?q?rw7TBLXtsg2BYmzmLpoDJyIbQiyALPIoVMauQDN4aVMwtkt3FWkmMuQf84bu?= =?iso-8859-1?q?HIoaebGgRufkkdz+PHJq17tAGHvFXPozH6C7OVRPw+9s+fGX/HY4plGclV+y?= =?iso-8859-1?q?YM3qA06gVbB1KQv1gGCHpMtjgaRm1BT8yX5F3PsNSaTkS4nV09svSCjqsiSX?= =?iso-8859-1?q?vYEqHsqsPL4gn9qhklw2fL416Y9JvI2uqpeHJ+comyFf0N9+B3IqSQIqbWxD?= =?iso-8859-1?q?IraXi/XOs7kigJKTqLnP3v//T4IkG+xCFi2XaXubj2pMFfi3wVkle7lR3jt8?= =?iso-8859-1?q?u41xjN/mh/uEOj8mIY5C2A7Yn9SsDP1GIlQ3RBnBDQFB+e9GPO66oG63fmKr?= =?iso-8859-1?q?A8XS0Tn0BZVh6oAbJqhQipHouqQShtHBfYD5I0Gk03l4OYn29oD9qnr4tbSz?= =?iso-8859-1?q?1TNfnM+YR8iBraY036QI35kLV2aSb1PP0xIn07yadUOHLcdtFqCYxbt9H6Jp?= =?iso-8859-1?q?IYxUohFOcLLLrr0QNGkPU+HoJKAhGU3hOGDc9fCjQx9LXewauU6gD6uorqZ9?= =?iso-8859-1?q?8LkG5Lf9gGxD6dpjI5XelF7PcUc42mlV0XvdsmPJfPpDcVJoiNObI3nOmCCi?= =?iso-8859-1?q?EaI+SwwLTuOSH1OG8K5wA/qkN2GSOBrFzIzAMrbJs3MQYjQIv+r5EQSH5eLS?= =?iso-8859-1?q?QM3LUWybNSzMMskhBJjFxXZsCfvM9iBZunMzx0j+1eCKWQmdZe++sLhpw/R9?= =?iso-8859-1?q?dYUd7xmDVW10XKwZLsKZsY48fx5V+enOwrrYWBsrHhBnLw0R+axevZq+AEBN?= =?iso-8859-1?q?sSpEeFlnP8GtFI6SsV9Y94S4UPgbXLTevjJ9t6/r5q3mCWEcvYXP9M0ndjgZ?= =?iso-8859-1?q?TL8tBNOEKL+tgaoDUJHeC1ZkvM0YW2LATH4dcuNZp7n0mQZRdEMyJNmMHL4J?= =?iso-8859-1?q?Mh76a3qHpSQRIMpCKYHePZ2PwbXFNGzKq8Ie4mKcoBF3M0m+Pt96G1oEg+bP?= =?iso-8859-1?q?NNMeHUL8Im+3Czg4sfgI4CTwqdmj6mOnTmhnjMQMGaQxpkX6ePToeOoNG7Fl?= =?iso-8859-1?q?JIPCA+IUTyo1zR6ksW4y88GnkkUn7lhH26tL0FhFWHaU3EEOKiQEOSSnGwgT?= =?iso-8859-1?q?LpGRGvK2zq/zf5q57FQRmLRWQ6ikteriqK94+bM7DnE409t0PjUtvnD/9Fsv?= =?iso-8859-1?q?XKx47ksbfgo2W0LtA6E4umI3Anz+RS+Tl7Zte1l/YMPVNSTsacsv0lFnXTmN?= =?iso-8859-1?q?AGKWsoZ6WxAX/24v2LoWjYXOmIFIKvf6rjR7jDuW5UXwB3vKbpuiGtXlsReQ?= =?iso-8859-1?q?kHqI27yUlNyNF4MEl+r+6mD4KHg1PHY4XvvxVq9JUvDbm8dFlkhHtB2wMCWc?= =?iso-8859-1?q?9aYI/78M7ek2WbECGKEtmNlFslKPIubgBLkkeC5cgQhz4xByM///EekzQw+/?= =?iso-8859-1?q?+4+Vo8cWKRS5+V+eNCaIANatZVvi/BUaYJiIRVaOV27f9OA/gSAizwP/1xZs?= =?iso-8859-1?q?sNRTA1G6WP32+H1h+eDE6ngPO8rT1ugI9H8c1u9Q1yBVtrH8+A3JcMAbY0rg?= =?iso-8859-1?q?T3ml1izDYfTf7CXA3iGN0C2VswO7Sz/JbmeDUabS2xQ6WG6ZJTKVC8unG+O9?= =?iso-8859-1?q?vwyfPrU7LPqTelCiidYyIk71E505NxlrrneGju0yFeaxbTroQsUztAQaCn/f?= =?iso-8859-1?q?FTeK/HomgUnJvFRkiG3eF9KqfM/uH4e9oMTA9sIy0VHgi5CTJrTD9n3PWWLs?= =?iso-8859-1?q?lHBE=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 72913f7a-0c43-497b-c3bf-08d9ba6ebb47 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2021 17:18:19.9592 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: MFUOHFb3nwndN914Ddx6u7gBN/5ibTkWkDhSvRNc4HYEL+xQit3Rmu8tQz5w6GiT8rIPDaJ+2HyKiOJWheZ1c4WPjW6Anqxk5InSGM5+0Q8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR2P264MB0228 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: B8BAE40003 X-Stat-Signature: u9waqmaqwm5zdkz9h3tezp4wntreij5n Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf04.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.48 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-HE-Tag: 1638983903-484754 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: CONFIG_PPC_MM_SLICES is always selected by hash book3s/64. CONFIG_PPC_MM_SLICES is never selected by other platforms. Remove it. Signed-off-by: Christophe Leroy Reviewed-by: Nicholas Piggin --- arch/powerpc/include/asm/hugetlb.h | 2 +- arch/powerpc/include/asm/paca.h | 7 ------- arch/powerpc/kernel/paca.c | 5 ----- arch/powerpc/mm/book3s64/Makefile | 3 +-- arch/powerpc/mm/book3s64/hash_utils.c | 14 -------------- arch/powerpc/mm/hugetlbpage.c | 2 +- arch/powerpc/mm/mmap.c | 4 ++-- arch/powerpc/platforms/Kconfig.cputype | 4 ---- 8 files changed, 5 insertions(+), 36 deletions(-) diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index f18c543bc01d..86a60ba6bd2a 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h @@ -24,7 +24,7 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, unsigned long len) { - if (IS_ENABLED(CONFIG_PPC_MM_SLICES) && !radix_enabled()) + if (IS_ENABLED(CONFIG_PPC_64S_HASH_MMU) && !radix_enabled()) return slice_is_hugepage_only_range(mm, addr, len); return 0; } diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h index 295573a82c66..bd4dd02e61c8 100644 --- a/arch/powerpc/include/asm/paca.h +++ b/arch/powerpc/include/asm/paca.h @@ -152,16 +152,9 @@ struct paca_struct { struct tlb_core_data tcd; #endif /* CONFIG_PPC_BOOK3E */ -#ifdef CONFIG_PPC_BOOK3S #ifdef CONFIG_PPC_64S_HASH_MMU -#ifdef CONFIG_PPC_MM_SLICES unsigned char mm_ctx_low_slices_psize[BITS_PER_LONG / BITS_PER_BYTE]; unsigned char mm_ctx_high_slices_psize[SLICE_ARRAY_SIZE]; -#else - u16 mm_ctx_user_psize; - u16 mm_ctx_sllp; -#endif -#endif #endif /* diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c index 39da688a9455..ba593fd60124 100644 --- a/arch/powerpc/kernel/paca.c +++ b/arch/powerpc/kernel/paca.c @@ -344,15 +344,10 @@ void copy_mm_to_paca(struct mm_struct *mm) { mm_context_t *context = &mm->context; -#ifdef CONFIG_PPC_MM_SLICES VM_BUG_ON(!mm_ctx_slb_addr_limit(context)); memcpy(&get_paca()->mm_ctx_low_slices_psize, mm_ctx_low_slices(context), LOW_SLICE_ARRAY_SZ); memcpy(&get_paca()->mm_ctx_high_slices_psize, mm_ctx_high_slices(context), TASK_SLICE_ARRAY_SZ(context)); -#else /* CONFIG_PPC_MM_SLICES */ - get_paca()->mm_ctx_user_psize = context->user_psize; - get_paca()->mm_ctx_sllp = context->sllp; -#endif } #endif /* CONFIG_PPC_64S_HASH_MMU */ diff --git a/arch/powerpc/mm/book3s64/Makefile b/arch/powerpc/mm/book3s64/Makefile index af2f3e75d458..d527dc8e30a8 100644 --- a/arch/powerpc/mm/book3s64/Makefile +++ b/arch/powerpc/mm/book3s64/Makefile @@ -5,7 +5,7 @@ ccflags-y := $(NO_MINIMAL_TOC) obj-y += mmu_context.o pgtable.o trace.o ifdef CONFIG_PPC_64S_HASH_MMU CFLAGS_REMOVE_slb.o = $(CC_FLAGS_FTRACE) -obj-y += hash_pgtable.o hash_utils.o hash_tlb.o slb.o +obj-y += hash_pgtable.o hash_utils.o hash_tlb.o slb.o slice.o obj-$(CONFIG_PPC_HASH_MMU_NATIVE) += hash_native.o obj-$(CONFIG_PPC_4K_PAGES) += hash_4k.o obj-$(CONFIG_PPC_64K_PAGES) += hash_64k.o @@ -21,7 +21,6 @@ obj-$(CONFIG_PPC_RADIX_MMU) += radix_hugetlbpage.o endif obj-$(CONFIG_SPAPR_TCE_IOMMU) += iommu_api.o obj-$(CONFIG_PPC_PKEY) += pkeys.o -obj-$(CONFIG_PPC_MM_SLICES) += slice.o # Instrumenting the SLB fault path can lead to duplicate SLB entries KCOV_INSTRUMENT_slb.o := n diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c index eced266dc5e9..7ecadf5e6bf9 100644 --- a/arch/powerpc/mm/book3s64/hash_utils.c +++ b/arch/powerpc/mm/book3s64/hash_utils.c @@ -1264,7 +1264,6 @@ unsigned int hash_page_do_lazy_icache(unsigned int pp, pte_t pte, int trap) return pp; } -#ifdef CONFIG_PPC_MM_SLICES static unsigned int get_paca_psize(unsigned long addr) { unsigned char *psizes; @@ -1281,12 +1280,6 @@ static unsigned int get_paca_psize(unsigned long addr) return (psizes[index >> 1] >> (mask_index * 4)) & 0xF; } -#else -unsigned int get_paca_psize(unsigned long addr) -{ - return get_paca()->mm_ctx_user_psize; -} -#endif /* * Demote a segment to using 4k pages. @@ -1710,7 +1703,6 @@ DEFINE_INTERRUPT_HANDLER_RAW(do_hash_fault) return 0; } -#ifdef CONFIG_PPC_MM_SLICES static bool should_hash_preload(struct mm_struct *mm, unsigned long ea) { int psize = get_slice_psize(mm, ea); @@ -1727,12 +1719,6 @@ static bool should_hash_preload(struct mm_struct *mm, unsigned long ea) return true; } -#else -static bool should_hash_preload(struct mm_struct *mm, unsigned long ea) -{ - return true; -} -#endif static void hash_preload(struct mm_struct *mm, pte_t *ptep, unsigned long ea, bool is_exec, unsigned long trap) diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 0eec3b61bd13..f18b3a1d18f0 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -558,7 +558,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, return radix__hugetlb_get_unmapped_area(file, addr, len, pgoff, flags); #endif -#ifdef CONFIG_PPC_MM_SLICES +#ifdef CONFIG_PPC_64S_HASH_MMU return slice_get_unmapped_area(addr, len, flags, file_to_psize(file), 1); #endif BUG(); diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c index c475cf810aa8..9b0d6e395bc0 100644 --- a/arch/powerpc/mm/mmap.c +++ b/arch/powerpc/mm/mmap.c @@ -190,7 +190,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long pgoff, unsigned long flags) { -#ifdef CONFIG_PPC_MM_SLICES +#ifdef CONFIG_PPC_64S_HASH_MMU return slice_get_unmapped_area(addr, len, flags, mm_ctx_user_psize(¤t->mm->context), 0); #else @@ -204,7 +204,7 @@ unsigned long arch_get_unmapped_area_topdown(struct file *filp, const unsigned long pgoff, const unsigned long flags) { -#ifdef CONFIG_PPC_MM_SLICES +#ifdef CONFIG_PPC_64S_HASH_MMU return slice_get_unmapped_area(addr0, len, flags, mm_ctx_user_psize(¤t->mm->context), 1); #else diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype index 87bc1929ee5a..c775b566e7b4 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype @@ -376,7 +376,6 @@ config SPE config PPC_64S_HASH_MMU bool "Hash MMU Support" depends on PPC_BOOK3S_64 - select PPC_MM_SLICES default y help Enable support for the Power ISA Hash style MMU. This is implemented @@ -450,9 +449,6 @@ config PPC_BOOK3E_MMU def_bool y depends on FSL_BOOKE || PPC_BOOK3E -config PPC_MM_SLICES - bool - config PPC_HAVE_PMU_SUPPORT bool From patchwork Wed Dec 8 17:18:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12664913 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 5A97CC433F5 for ; Wed, 8 Dec 2021 17:20:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 902C36B0078; Wed, 8 Dec 2021 12:18:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 88FEA6B007E; Wed, 8 Dec 2021 12:18:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6AD896B007D; Wed, 8 Dec 2021 12:18:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0045.hostedemail.com [216.40.44.45]) by kanga.kvack.org (Postfix) with ESMTP id 5B33D6B0078 for ; Wed, 8 Dec 2021 12:18:34 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1889E1803A13D for ; Wed, 8 Dec 2021 17:18:24 +0000 (UTC) X-FDA: 78895285728.03.02C80AA Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120085.outbound.protection.outlook.com [40.107.12.85]) by imf01.hostedemail.com (Postfix) with ESMTP id 7443740005 for ; Wed, 8 Dec 2021 17:18:23 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FBXuS5p95SYWI+/ybJFzZxtF2TTOyqPXNzj1wtnjNXrinjlm3b1nu6FRDQalOUdG/8bUMK05Twbkwj17AlWsWKu0qnwou8zwfvItOLgMdaR6v1FzTJ02roCk1U4EM3Vee83d7gpxWqhCKN4tvwak4MjHohivcpYljtGqX/OBXl14vsaf+xVP0sge3PLO0gK13O+GgiyrLgtw9dFp4m8mej1t53MOEo6X2RuURwTUW86T3gopX4uH7it2zdbrqFyXViM8+cCt3Nep292HNEIgg4sv/eRnRsrEhnPRYrUp+JaQ1ss2JVCMzRzqHlBRwvPDt/cpm+Ws9X9oRW2wDEuD2w== 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=yUFkKM+3rEOBA7h8OB54KFRMuecm1HZK/3fT5Q8Cr/c=; b=LbOjdyTI05Ix3Bh+xaWCMCmOnywtjmXTQhQ6R/zFFI13lFqJi2s9/uJUjOZQuOd8SBxUS03zkxKPvhn2mEsqWQPnpCIMKACTHxRwuPcLmEmU8ZACY80UPi7VQ2mtuLu2wm0dsLm5jQQVinluop9aayruo+eSqwMVIZWBfSolfhHKOH94qxwlp9g43vA4eZ6qxQ06GXZaTLShA4lPWtLpGx8aPRBCpGRkyxDKEG4lvdNQSwSmI2bamVDplKepJxM/rm4SNPKu6tdMSgOrTiAlA7Gq0McMJSVgfWohKT3lGcj9e4cQ1Z1TprUuDa8zumnd4hrlXfMTuULwouKVj+rZjw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MRXP264MB0823.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:16::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11; Wed, 8 Dec 2021 17:18:20 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f%2]) with mapi id 15.20.4755.022; Wed, 8 Dec 2021 17:18:20 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" Subject: [PATCH v4 06/10] powerpc/mm: Use generic_get_unmapped_area() and call it from arch_get_unmapped_area() Thread-Topic: [PATCH v4 06/10] powerpc/mm: Use generic_get_unmapped_area() and call it from arch_get_unmapped_area() Thread-Index: AQHX7FeZYbkFB7BK6kOFRdVEM/XL8A== Date: Wed, 8 Dec 2021 17:18:20 +0000 Message-ID: <8f54a8d097c402d808147b2044365ebfda2862dd.1638976229.git.christophe.leroy@csgroup.eu> References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ba27659e-75f9-488f-1f4e-08d9ba6ebbb7 x-ms-traffictypediagnostic: MRXP264MB0823:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 4GkEdRthWLQrvEIz46IXLQOO83EFFFpxUf3jJJOPxz9LCtan3D7ONo7IuM4eumUS1L+n8IQUVnYw3KHrqKiBrSKXHpfZrvwI1rtTaN0rapDScUhxn+3Q3pjPgIvUZV5s80ZFpDH/GVX9k3G+zHN3orQyZy5W7jWJm75/i268cJl8hXOTQ0XqrQipNKhQ73Ty9Ly620d9fhSwB3SKIZ7u4hHOUKnBc0puSUu1g88Pp5OsJczswMIKptIsQeH0/KqMet4vudN+G4OHpY3VqiaksfL++F0rBYuR6z5UzSGimk4ZpxRPySrBebNveenhQbBw1IsprWw81RIF9aGvwqcoU933KqJaSCPldDBtOzWjAbfmlfFLDhZO8AWWeDtU/5YgYuCk54bWJToRlSO2mEEwXYO2jiMo+ybGnWYt3OEVnCNqn6tQJrIknqvEqvmLLE/MamWLlokM8rcHvwZ1xsiFeRsbpqGx1XpVgr4hVhx7KvuJDUWuIvQc4Qyd2r5ifL7gcpMxygUJjTWo2DxVCDdf3TqyVpLzf1mik69cge8b0CtySPo+p2PL+yhgEWdwRC9JcrBx4fGnaODwlXutfKjM1nnMwnWl8icIdkjF07Vu6osPQejYMisMumqLpEoekAZZ6+ViDSQzGnuuTxmeIr5GglQxrnuDw9La1NL+cq8Ddtp3fhMUo3U2ckBl75ogMogkReEZP4bVwky79dUTdb4l4cpsTk7yvu7Rs92zKP0+GCg= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(4326008)(316002)(83380400001)(6486002)(2906002)(36756003)(26005)(110136005)(64756008)(91956017)(66946007)(8676002)(54906003)(86362001)(44832011)(76116006)(6506007)(66476007)(66556008)(6512007)(5660300002)(508600001)(38100700002)(2616005)(66446008)(71200400001)(122000001)(186003)(8936002)(38070700005)(41533002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?xS3CNFaMBV3+aDDehC47sr2?= =?iso-8859-1?q?U5dQBZ4E6/TIb81JXOTMYWchrqtaCHhT+haKQIndRE6ckw9pF83BK1VZxcLW?= =?iso-8859-1?q?MvxX9IMASpBzMEJ4B06SL7iLKv+FPMeYiygvHxJLdJum05Rj9k0Hhc3Pil5l?= =?iso-8859-1?q?7aqyPeJxzZLEMJjYvC6udjbQ+dpZsMuJbN06B8vf0JkhuSbYtKWs+m1y9lH8?= =?iso-8859-1?q?8RA0xvOAzNih242j1vw8sAlskeBfj3RacbjhEk8TaS5q/34P9sqCK3crX/gb?= =?iso-8859-1?q?L5MbaojoNV7cGV+zT8YX3RFXBCNLPgPjz1IAmni5XukUolKxLaatNi7QdB/7?= =?iso-8859-1?q?fGRB4PEJYmeD4jAPjU7HFSZdH2f7Zq3kzE8R0q+D/m3e4fk7oqgltNVjTqzx?= =?iso-8859-1?q?HFyywHAM968sUiecNxudpeJsMdDiUWHxCavbaZbtE5sbGAqx8JIfMpfL3/0e?= =?iso-8859-1?q?L3yJcCfMLq1s4wUXCk6gGums9FzgbA3edYLQDmDsxjuU345HyLEJbq5jd78g?= =?iso-8859-1?q?5XgIGotSJY/PScTpTq7tD6Tylv2WjqO+gcFnSdsFwb2RFRog+A1mPIzOyfo2?= =?iso-8859-1?q?4dN+FXwRtHlPxEB/p4AvhHuTyGhSEJsX1LxYFA6tnrPN0eyswG6dKrI6bQeu?= =?iso-8859-1?q?sE32BvvBUcdJf1thrytildnJQmWeUGfsSNjGnL7SWBdNQH/VSeSK4pvAkhe4?= =?iso-8859-1?q?dtnizicEKI7FiGlwO8J5P7q0ZUImVk2GBqUndi/pU/widFAyxP5UE3U99HOR?= =?iso-8859-1?q?At8utkYcnEIcAIphcjJQsUMs00/oZFKKkc4rtp8mTE/QbIDRle9Ymdxaj96a?= =?iso-8859-1?q?jFoU460udeAwHElAxmFy/2AUOV6ozHPEBq3sKWGDpI/4AR6bdUXsI1Nv6rdB?= =?iso-8859-1?q?q0WInWffW2cB/FeTa/BLrX+82lXDC/6C6Pgw5xnyawL1jCByAWqeX8uv11D7?= =?iso-8859-1?q?5m843xtSlE/NB9b7AX+c916ccU/keg3JUh6nFsT7tdmKW5yj2P4Mm+vHQZB1?= =?iso-8859-1?q?h2y5DQkDPdcxYC20nC55loO+BcpkK3OE/NwWjD1VKV05NKAhEq8Q/cD14twU?= =?iso-8859-1?q?eyv5vxjVGCkHwunoAwdTtiGq5yrEUIazl6GAOlRSNiQswdU0SVUoASKfcP5t?= =?iso-8859-1?q?XN9xp6mCaLDb/IYdSoUxaXb5oINRGyMAQwF/6G+KftPqgWrFq9QZmsZQ9Xmr?= =?iso-8859-1?q?/ptx+cpIq48cDFithx9euD7TrIMH4mV3ACZBS25w86wdYQvgA6/A0H9He31n?= =?iso-8859-1?q?GkhmfDO38S4ssQRZONxbn0cMxOhULWgnDGp2d4OICyrDW56xfk55qxUhJptu?= =?iso-8859-1?q?lWF97fGt8EcvJgc+d6ar8OFY3e5FqOM/CwSeihj2wKXeLcILRN5xRDmDzOwV?= =?iso-8859-1?q?3oC1VzkYifSzzEHVJvQuZywGiDNzA473Lm9GyhrFEyWcBl59QsAov3yisFgE?= =?iso-8859-1?q?iX5oysfY2w+XJ1lf6EdhPoAsgDOoqD1ZZZKeGfLVrbe/IIA2WH6l4lUAoyV6?= =?iso-8859-1?q?LzUx/z6pTacHSTLwEXon4UhRtTsqAmdEnibpYGBp58jhmDaZK7xc/1adk+Pa?= =?iso-8859-1?q?Ct9/kEhagtVTVbLGrn2Ci0FcIiFreTIkziH7MGRsQIEpnz90BGHgT9lWXxmE?= =?iso-8859-1?q?bkmmtrKg/LaYiBvn3VYX0nc4PMQjVH1IBNuOU3SiBBBmbKsdC7NhadyE0pRn?= =?iso-8859-1?q?TTNAipFBNHFsTzrmfyIPkZXkZGSoUE6tswdgfQS3IGUBanX7U7hozheDBbp8?= =?iso-8859-1?q?GuNs=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: ba27659e-75f9-488f-1f4e-08d9ba6ebbb7 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2021 17:18:20.6701 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: uC3CSVXdWPrP9w843rQwrFCYsIXsami6Sk9waNXJJ9FwR42dSVCcrEeS7RxPOxxDe31Hg1ei8igwZ526OkM16YOVUybTeengBRdjengieis= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MRXP264MB0823 X-Stat-Signature: 761zngbuk9fhy8yoboyqz7osrygfeesk Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf01.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.85 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 7443740005 X-HE-Tag: 1638983903-701329 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: Use the generic version of arch_get_unmapped_area() which is now available at all time instead of its copy radix__arch_get_unmapped_area() Instead of setting mm->get_unmapped_area() to either arch_get_unmapped_area() or generic_get_unmapped_area(), always set it to arch_get_unmapped_area() and call generic_get_unmapped_area() from there when radix is enabled. Do the same with radix__arch_get_unmapped_area_topdown() Signed-off-by: Christophe Leroy --- arch/powerpc/mm/mmap.c | 127 ++--------------------------------------- 1 file changed, 6 insertions(+), 121 deletions(-) diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c index 9b0d6e395bc0..46781d0103d1 100644 --- a/arch/powerpc/mm/mmap.c +++ b/arch/powerpc/mm/mmap.c @@ -81,115 +81,15 @@ static inline unsigned long mmap_base(unsigned long rnd, } #ifdef HAVE_ARCH_UNMAPPED_AREA -#ifdef CONFIG_PPC_RADIX_MMU -/* - * Same function as generic code used only for radix, because we don't need to overload - * the generic one. But we will have to duplicate, because hash select - * HAVE_ARCH_UNMAPPED_AREA - */ -static unsigned long -radix__arch_get_unmapped_area(struct file *filp, unsigned long addr, - unsigned long len, unsigned long pgoff, - unsigned long flags) -{ - struct mm_struct *mm = current->mm; - struct vm_area_struct *vma; - int fixed = (flags & MAP_FIXED); - unsigned long high_limit; - struct vm_unmapped_area_info info; - - high_limit = DEFAULT_MAP_WINDOW; - if (addr >= high_limit || (fixed && (addr + len > high_limit))) - high_limit = TASK_SIZE; - - if (len > high_limit) - return -ENOMEM; - - if (fixed) { - if (addr > high_limit - len) - return -ENOMEM; - return addr; - } - - if (addr) { - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (high_limit - len >= addr && addr >= mmap_min_addr && - (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - - info.flags = 0; - info.length = len; - info.low_limit = mm->mmap_base; - info.high_limit = high_limit; - info.align_mask = 0; - - return vm_unmapped_area(&info); -} - -static unsigned long -radix__arch_get_unmapped_area_topdown(struct file *filp, - const unsigned long addr0, - const unsigned long len, - const unsigned long pgoff, - const unsigned long flags) -{ - struct vm_area_struct *vma; - struct mm_struct *mm = current->mm; - unsigned long addr = addr0; - int fixed = (flags & MAP_FIXED); - unsigned long high_limit; - struct vm_unmapped_area_info info; - - high_limit = DEFAULT_MAP_WINDOW; - if (addr >= high_limit || (fixed && (addr + len > high_limit))) - high_limit = TASK_SIZE; - - if (len > high_limit) - return -ENOMEM; - - if (fixed) { - if (addr > high_limit - len) - return -ENOMEM; - return addr; - } - - if (addr) { - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (high_limit - len >= addr && addr >= mmap_min_addr && - (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - - info.flags = VM_UNMAPPED_AREA_TOPDOWN; - info.length = len; - info.low_limit = max(PAGE_SIZE, mmap_min_addr); - info.high_limit = mm->mmap_base + (high_limit - DEFAULT_MAP_WINDOW); - info.align_mask = 0; - - addr = vm_unmapped_area(&info); - if (!(addr & ~PAGE_MASK)) - return addr; - VM_BUG_ON(addr != -ENOMEM); - - /* - * A failed mmap() very likely causes application failure, - * so fall back to the bottom-up function here. This scenario - * can happen with large stack limits and large mmap() - * allocations. - */ - return radix__arch_get_unmapped_area(filp, addr0, len, pgoff, flags); -} -#endif - unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { + if (radix_enabled()) + return generic_get_unmapped_area(filp, addr, len, pgoff, flags); + #ifdef CONFIG_PPC_64S_HASH_MMU return slice_get_unmapped_area(addr, len, flags, mm_ctx_user_psize(¤t->mm->context), 0); @@ -204,6 +104,9 @@ unsigned long arch_get_unmapped_area_topdown(struct file *filp, const unsigned long pgoff, const unsigned long flags) { + if (radix_enabled()) + return generic_get_unmapped_area_topdown(filp, addr0, len, pgoff, flags); + #ifdef CONFIG_PPC_64S_HASH_MMU return slice_get_unmapped_area(addr0, len, flags, mm_ctx_user_psize(¤t->mm->context), 1); @@ -213,21 +116,6 @@ unsigned long arch_get_unmapped_area_topdown(struct file *filp, } #endif /* HAVE_ARCH_UNMAPPED_AREA */ -static void radix__arch_pick_mmap_layout(struct mm_struct *mm, - unsigned long random_factor, - struct rlimit *rlim_stack) -{ -#ifdef CONFIG_PPC_RADIX_MMU - if (mmap_is_legacy(rlim_stack)) { - mm->mmap_base = TASK_UNMAPPED_BASE; - mm->get_unmapped_area = radix__arch_get_unmapped_area; - } else { - mm->mmap_base = mmap_base(random_factor, rlim_stack); - mm->get_unmapped_area = radix__arch_get_unmapped_area_topdown; - } -#endif -} - /* * This function, called very early during the creation of a new * process VM image, sets up which VM layout function to use: @@ -239,9 +127,6 @@ void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack) if (current->flags & PF_RANDOMIZE) random_factor = arch_mmap_rnd(); - if (radix_enabled()) - return radix__arch_pick_mmap_layout(mm, random_factor, - rlim_stack); /* * Fall back to the standard layout if the personality * bit is set, or if the expected stack growth is unlimited: From patchwork Wed Dec 8 17:18:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12664917 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 86415C433F5 for ; Wed, 8 Dec 2021 17:21:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4401E6B007D; Wed, 8 Dec 2021 12:18:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3EEB36B007E; Wed, 8 Dec 2021 12:18:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 268A16B0080; Wed, 8 Dec 2021 12:18:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0171.hostedemail.com [216.40.44.171]) by kanga.kvack.org (Postfix) with ESMTP id 130CE6B007D for ; Wed, 8 Dec 2021 12:18:35 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id C3ECD8956A for ; Wed, 8 Dec 2021 17:18:24 +0000 (UTC) X-FDA: 78895285728.17.601D59D Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120085.outbound.protection.outlook.com [40.107.12.85]) by imf01.hostedemail.com (Postfix) with ESMTP id 29F2840005 for ; Wed, 8 Dec 2021 17:18:24 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IXQ07BPQIzctfRriOILSBHTNtccHh7oJJWGsIwELrgdG8VckWzyGdyBDcKIVP9mJ+diAeP0sh8zIcpishBMK+eWmutElTY5ihBsnoyDpV5kNT8v3Hmp3lS6YPgewvLDTQz4viDgefyGa+olvFVLR1VGVRtaO8k56qf1ZBwMan+IUoSA516+LqbQSjzqkf+EHpJZSl/zlXQh/s1KIKNyw9JxMT2CXyPnB8oR4HxWkNqpTTMkQ4az8cYVSZ1gYOVJ3yCa1uKlNTxcxZPm6VyOJilHPUjkYsRw68fb0mcnAe4g1ppZO5NFvP3FpP8n2Ndpm2LOWlgBnt4psWd0BCsC29Q== 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=Ao0J4RtTmJCD5YE4NNN5icIYyoHVg3j5QWKaKWYo9c4=; b=ZxMCDJZDZK+OFK6s/tQmHWQ8daKJjvWv4/7QgTl+yjCMEw9Gi91eSN+o9rHn+u2CUVu6RsuHgd/D/VmyTSjfpFWwHlK/zDkYNVq12MGN3oSIFcBISdIH91ATw8Er6mBaO5vRYuefWiIPxmt9E8VKLWZc1mGob3pvPZKAgSjAJpf+tZnKkic0dbvS7FOwFeIk0S3ffIjquJCk4fgdD3iPYZxMSxgez2+HXyjoMEYWqlkJ1YeR7AJGere30WTK4FIDdJbiQs7ShDPKlD5Zwn+gH7MtjgmajzO+EGeVIP4Gzy52XQpFkUfQxsaOuk9hcOePPfxSwSBxjKkQKHdENn6raA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MRXP264MB0823.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:16::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11; Wed, 8 Dec 2021 17:18:21 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f%2]) with mapi id 15.20.4755.022; Wed, 8 Dec 2021 17:18:21 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" Subject: [PATCH v4 07/10] powerpc/mm: Use generic_hugetlb_get_unmapped_area() Thread-Topic: [PATCH v4 07/10] powerpc/mm: Use generic_hugetlb_get_unmapped_area() Thread-Index: AQHX7FeZBU3PIhmcjU6PaLYrRJLsxw== Date: Wed, 8 Dec 2021 17:18:21 +0000 Message-ID: References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ff5e2005-5a3c-42ce-b49c-08d9ba6ebc14 x-ms-traffictypediagnostic: MRXP264MB0823:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:246; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ExWAxiY53R56YevK/yj6EVxnp+QEMSy4RxyRNfqmyx41kIRbiqtnFs9x3k/W1Y9yYGR82v3qHfrZagHPY0m1dMo3HNhfN7jjjWIb7834EOTFbBbhGUZY4EGsknqodsXjUiw2U1LE/UH9ajQJ2F3XPBtO1RrXh/9w3NhbGBK/jlH5XZczDtruDR+miWWX+jcLw5wij+jOKUldPEMVDKHFEspb/LVtLolgWYATl39IOxgScditxLp2PqtDCB8NZTuPDnD37bzk24DhJHF6RSH/He46iy4X3Pqe6bNh61L74WbbFFqPSUS3lPtL6pw+3pO22RuG6Qg91L62DnBrBj9NpYJB2mQgNjix6Ztt670SPYwvkHxCL3PgavoRBEG/eR25/rHajE/6kYZauTOEvw5xEMKuKZFrZiEjKvqvr1Nu7Q8t8X7dmJ1ZRhY1H5HRk96ISbHn9fc+qTfC/z3+DJB2mc/ex1BlWerJY8curKspSF1nitdCdTadVsi4XacGxeNGsyDjwST98qa0z6SDBQgL8ok6ywdQJ/kOWzywmw9vQKnByRzAdW1AhBwwRqAXTmrJlXTzKzjD1RA6VVXXIfM9/FwHkitXMyNWfDLO+HSme8EAY3qWzF/cxRozaWbKHYQVd3ax4DDFFgkQ1ieEXNW8vzAnNUS8zQs1mevFObyRjT4an1asRFoWEBzVIqQCv6aSzmjGDDTPYtvVx5BczqiWh/SCEjPhS99ei5VuStU5/f4= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(4326008)(316002)(83380400001)(6486002)(2906002)(36756003)(26005)(110136005)(64756008)(91956017)(66946007)(8676002)(54906003)(86362001)(44832011)(76116006)(6506007)(66476007)(66556008)(6512007)(5660300002)(508600001)(38100700002)(2616005)(66446008)(71200400001)(122000001)(186003)(8936002)(38070700005)(41533002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?GsWeB5eHVHtNsvtUU1nfvOv?= =?iso-8859-1?q?cZ3nmAsXU4bqxKOufQmPNQU2Ojnig+okt8aJ+oDvw1gO7u8q0FlR+mYnMpcu?= =?iso-8859-1?q?6pOG5tndglA0enV+YuwYQi8cQxO4W18kHFsmMLwhnymuHbYAdauxq+hV63L+?= =?iso-8859-1?q?/triT4wGP1JTOhtmvYZJZB/zAV/IMu6gNTIrMxb771EFmL+QcS7GvLdryrGG?= =?iso-8859-1?q?fkKyEScBnh7RUoFWfth0xQ+ITwF9mazBjBLz6qAbqP4R6Fizg3ROyQeasUk1?= =?iso-8859-1?q?yNGbrtLazngFYBFT6Bh//HMmHctJ1158Z6NhX8LOwQV3SEnhD2BRY1yoMpPU?= =?iso-8859-1?q?sHyK6mbAqtXZGLwpwoUg8Tw9rFRNrCbakNFU2stridP7n7aHOpVp6ELoqXJm?= =?iso-8859-1?q?L8F6yt4jjzsDSAqh1Nbs4Hms6hAVkySwxQGGSeeRNh9n+BmnQHh9OZB3Y8Ig?= =?iso-8859-1?q?FFvOAYvBaZCciXxL6vKEfIIsggsRy18PaX1xImXuNhLABQVeFoQkH10udUJy?= =?iso-8859-1?q?svZx8p2jUmnH4MIWPl4TB0FNGs9wgnENWsD4TrDv4j1oiVDT1fnOrU4WvsEd?= =?iso-8859-1?q?a/CfkdTlN+ZTPABewLlq3o8z4XYvCADKHnxPzdjlnYe4uI7x3k/DRFG4RfC/?= =?iso-8859-1?q?i+rLOtaLg4Ibjv4teygMYuJck1kPnjGCU/ZtERBX8KN6g2CKtDHKrfyBy4kE?= =?iso-8859-1?q?V5Xpc8mGVInrxZF87AfnLBZY5SucL2DmXbUqjmetkz3XnZSuLtOj2eYCSOxO?= =?iso-8859-1?q?hAu/ZBIjXypfP7lkzp7WWjlLD/If8u+vX8+4j6Sj2F7zb1mDAQoXVl83VwkC?= =?iso-8859-1?q?UmZuEDQ2zP2v25AkQOiyELoX4HP2Xy6QFDn7sy++U1NoxsDfGqz4933zXLsT?= =?iso-8859-1?q?n7858MD/+tPkXJU6GGavfDOBwmHF8+15CFOOE663QIPC9uW3BlmHnDDm6Jri?= =?iso-8859-1?q?iOtCD4fZJ/hp82pKuvhIYovS1H1saGQc4WJHPhWshIyBeJCEGjRPBYtToB+I?= =?iso-8859-1?q?IdCr2e9euwHJQjA3+CyBpyOvrvdUsJMXmszmPOkNdCOlgqnioPKgzObvb7yK?= =?iso-8859-1?q?Bhet+n1G7vupiokrtoDwtSSDk0jdnpN0+2xDW5hYahmVCLXUeU96zNXuF0VZ?= =?iso-8859-1?q?tujVeuNemi7vDl9I+TbWdwBsb+f+8UudNqFP2Y+isWmdPp4+QTE9C2+jGRGq?= =?iso-8859-1?q?A5pRRIt7gpbEoLVodo2JAySNopO3V0t/gsouZWajjGhyEgIQqXViDEoqCEEX?= =?iso-8859-1?q?Ez4nYXTbYZeKyq757nbnNcsAQszZ8yMDlnx0yiBMPv/AhD1ougGdRIUR3l74?= =?iso-8859-1?q?P/fbWV33I/4P8TsVMFUFIG77RUyqler3VQi8u0JJOjavWpjd+anLjTiZHpMb?= =?iso-8859-1?q?osfV2wQu42+Sd9GdZNkp3Pi0hauAgcQ2F1LKHKij2nSV16FvAEq+Ykr2r+b+?= =?iso-8859-1?q?NyeuuK4XDaNV1xMebrs+eSBzLEXmsUzfvL8AelMCn3RmioR/tElXvmphUT/z?= =?iso-8859-1?q?JoFwyKQ/p4o7PsfBZ9O2sAi0rVeUQGy6xdG3WAuaXSmbIz70dCyhuWdJ1ALH?= =?iso-8859-1?q?NqRrEo3ebbCmf5YanKDNQKb1LeCjbqvWFy52dKEGBcryuwOEQCSHHyKp+SUa?= =?iso-8859-1?q?AIuh+awsLj4NY3m5TeZ/e2mf7O1PkoDL4nGgHd0nhpFEwgjgq+CuyksVS8EV?= =?iso-8859-1?q?1Yo6/98+Vj6KuYBTInoN9eM9TcYMxRE0C3hoUOTOTouQR36ZCmgCO9CIcLSI?= =?iso-8859-1?q?1RR0=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: ff5e2005-5a3c-42ce-b49c-08d9ba6ebc14 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2021 17:18:21.3621 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: hl8L5xWVcyA90pSVLxWuQAxMzFUVIlh52aZ07+ZOmmbamyJylFl5J9EI3/qLtvy0MMrZ/CuEMwURzcybiyJ1ufU+G8Y1k/FngaydwX5iWag= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MRXP264MB0823 X-Stat-Signature: khtpsg1ouqnheb7bso3m5sh5cx3diaza Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf01.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.85 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 29F2840005 X-HE-Tag: 1638983904-761389 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: Use the generic version of arch_hugetlb_get_unmapped_area() which is now available at all time. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/64/hugetlb.h | 4 -- arch/powerpc/mm/book3s64/radix_hugetlbpage.c | 55 -------------------- arch/powerpc/mm/hugetlbpage.c | 4 +- 3 files changed, 1 insertion(+), 62 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/hugetlb.h b/arch/powerpc/include/asm/book3s/64/hugetlb.h index 12e150e615b7..b37a28f62cf6 100644 --- a/arch/powerpc/include/asm/book3s/64/hugetlb.h +++ b/arch/powerpc/include/asm/book3s/64/hugetlb.h @@ -8,10 +8,6 @@ */ void radix__flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr); void radix__local_flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr); -extern unsigned long -radix__hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - unsigned long len, unsigned long pgoff, - unsigned long flags); extern void radix__huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, diff --git a/arch/powerpc/mm/book3s64/radix_hugetlbpage.c b/arch/powerpc/mm/book3s64/radix_hugetlbpage.c index 23d3e08911d3..d2fb776febb4 100644 --- a/arch/powerpc/mm/book3s64/radix_hugetlbpage.c +++ b/arch/powerpc/mm/book3s64/radix_hugetlbpage.c @@ -41,61 +41,6 @@ void radix__flush_hugetlb_tlb_range(struct vm_area_struct *vma, unsigned long st radix__flush_tlb_range_psize(vma->vm_mm, start, end, psize); } -/* - * A vairant of hugetlb_get_unmapped_area doing topdown search - * FIXME!! should we do as x86 does or non hugetlb area does ? - * ie, use topdown or not based on mmap_is_legacy check ? - */ -unsigned long -radix__hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - unsigned long len, unsigned long pgoff, - unsigned long flags) -{ - struct mm_struct *mm = current->mm; - struct vm_area_struct *vma; - struct hstate *h = hstate_file(file); - int fixed = (flags & MAP_FIXED); - unsigned long high_limit; - struct vm_unmapped_area_info info; - - high_limit = DEFAULT_MAP_WINDOW; - if (addr >= high_limit || (fixed && (addr + len > high_limit))) - high_limit = TASK_SIZE; - - if (len & ~huge_page_mask(h)) - return -EINVAL; - if (len > high_limit) - return -ENOMEM; - - if (fixed) { - if (addr > high_limit - len) - return -ENOMEM; - if (prepare_hugepage_range(file, addr, len)) - return -EINVAL; - return addr; - } - - if (addr) { - addr = ALIGN(addr, huge_page_size(h)); - vma = find_vma(mm, addr); - if (high_limit - len >= addr && addr >= mmap_min_addr && - (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - /* - * We are always doing an topdown search here. Slice code - * does that too. - */ - info.flags = VM_UNMAPPED_AREA_TOPDOWN; - info.length = len; - info.low_limit = max(PAGE_SIZE, mmap_min_addr); - info.high_limit = mm->mmap_base + (high_limit - DEFAULT_MAP_WINDOW); - info.align_mask = PAGE_MASK & ~huge_page_mask(h); - info.align_offset = 0; - - return vm_unmapped_area(&info); -} - void radix__huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t old_pte, pte_t pte) diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index f18b3a1d18f0..bfd7f4af1e58 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -553,11 +553,9 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { -#ifdef CONFIG_PPC_RADIX_MMU if (radix_enabled()) - return radix__hugetlb_get_unmapped_area(file, addr, len, + return generic_hugetlb_get_unmapped_area(file, addr, len, pgoff, flags); -#endif #ifdef CONFIG_PPC_64S_HASH_MMU return slice_get_unmapped_area(addr, len, flags, file_to_psize(file), 1); #endif From patchwork Wed Dec 8 17:18:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12664919 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 D3DE4C433EF for ; Wed, 8 Dec 2021 17:22:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 41B606B007E; Wed, 8 Dec 2021 12:18:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C7C26B0080; Wed, 8 Dec 2021 12:18:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21B6D6B0081; Wed, 8 Dec 2021 12:18:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0150.hostedemail.com [216.40.44.150]) by kanga.kvack.org (Postfix) with ESMTP id 0E83E6B007E for ; Wed, 8 Dec 2021 12:18:36 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id C9400180AA98F for ; Wed, 8 Dec 2021 17:18:25 +0000 (UTC) X-FDA: 78895285770.12.A7F61D9 Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120085.outbound.protection.outlook.com [40.107.12.85]) by imf01.hostedemail.com (Postfix) with ESMTP id 2009B40009 for ; Wed, 8 Dec 2021 17:18:24 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bagqc6I5u3rSF3lMqjMqlVWhOntWMPeXKyfsgWuTDSRbKB8IDZBOpPDo9NpEMF66MtAh5EIMlHV2zPfN4asYTa7GufOhG1D0MnglJp3OljGvIfSBGIwjaWMNZsVO2kfe7+jBYVEwaPRpMTPam/jZexViN81jwJvoB4uPAHe0Bt0uhRujSAm7dXDSKu1dWXcYxc0Zdv61myzYYneCI7GILbw9RdmAGqEZVzWvyqwCfwVYdG5NiFL4ICzouWzQO262ccyE3GPblSqfUDOj/uAgVsjQXKUPFvZo4tY2HKUB4Leg34FdZ9K5pMVGVXEmk53yI3/cX8cVoZVJlbHuXzg5cg== 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=FdCjHKP9l9OBJ5gDlZQo8deltmcwCmBmFWj0cSPtgCE=; b=HLKYz883fMmLSc4NFf5M8qRBeEmMYcuDc7mWmHJQE5mdNoFvOcLdSPT8djd1AWhm7rGhHMWa84WpBSwtj+xHZcXjCu7Npwv4f7JvyIuXQtYvHQnb38LGX7Qomi1SSJ0Vqh8/LjZJg81eJ/X/ftpxCZTfx/aYPh87UaOaVaMrQBL55vBzpw/XxX60/5c7N42dMUNW6WyKfgROIDTiU3aUsp82p5Tp4ysJIP6uTowqgEAhqhPjJmHgFrRVQdUWAxYUbiq7GXClBSVUxBEM2z9X/RvMdgxtSD79iga5SmMQJD7AI9yfqOzk9njXznJ7yaWwQPmsmMsezIGNIwrC3H3AJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MRXP264MB0823.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:16::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11; Wed, 8 Dec 2021 17:18:22 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f%2]) with mapi id 15.20.4755.022; Wed, 8 Dec 2021 17:18:22 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" Subject: [PATCH v4 08/10] powerpc/mm: Move get_unmapped_area functions to slice.c Thread-Topic: [PATCH v4 08/10] powerpc/mm: Move get_unmapped_area functions to slice.c Thread-Index: AQHX7FeZb+/3TX1n7EW9KYtAkSYZWw== Date: Wed, 8 Dec 2021 17:18:21 +0000 Message-ID: References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b3ae390d-0861-45db-02d3-08d9ba6ebc7c x-ms-traffictypediagnostic: MRXP264MB0823:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ENUghyS1DmrofjT/CTeoKkLPf8F+whxyMAUn3lGq5qqIyeZgSyT6RmWRlYoVca4jAOEJc0wr/kqjv3ehpCYLPfbiCID8eldnpJpWsvbwtQsRhmkwVKyV6LH+iV+Hgvp87t5mGCR2NTtMbHvHDQ+cLMf/+fhoeq9LjO7lt5Q5XBTROy/QEMz9wynBuef9ZF9le2PSaZ2l6b3y+PLCUrkCZEOUkXz8gTas1R1YFinoDYk4TXcbR2nKUR7pY+j6mYRg1QPO9m1+9SbC0+JfX+g7qby183sAqMsLFL4tL1iGnXebBkPGXM8ykRh5k91g9y7I2ZfwWe17rgagnssIsv2rus69VhRoclYm6YcJWJ0Z5Rs1LRxvziHzWiMg2GYjdSC9vE+m62w//duNFvuJQGzLxGE8tYmfxKgilEImjhFpRB5uFffto7e9sAi+CpJZaPTFxoVcTjF5uCL2mIvkcNZc4p8PGqRdCTFMvtZhLQli4iiiwmdr2Y/EB/8lHyg5FiT631ssnZYb4RqpHeSQykrbqNV+E2GbZv004aJzGyftx36k1CgOJq7nFZQLcalYlqLanAmNVjpEaVGLfQ6sEmQjNP1TJce2LHeIphYyDi9IPTZs2zr6tXMAXtMBgZAxK5fLTTR9f+2Dw+yU9l7tLFqoY68P4iOAoIjAvdx04tIqTehYe3mH2fxrJdiUS1dEkwNdK2NHmc9NH/rP3j43s61pCg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(4326008)(316002)(83380400001)(6486002)(2906002)(36756003)(26005)(110136005)(64756008)(91956017)(66946007)(8676002)(54906003)(86362001)(44832011)(76116006)(6506007)(66476007)(66556008)(6512007)(5660300002)(508600001)(38100700002)(2616005)(66446008)(71200400001)(122000001)(186003)(8936002)(38070700005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?/scOSMs6fldDoeHWFuInGPQ?= =?iso-8859-1?q?Fb8mFx3JumMfg8Zx0MC6d48flYER8dQ0LndrukgiNWvGlP4SJ8ZRyg/ihHpz?= =?iso-8859-1?q?9rZ8qetYREPn8smUlDdEYw/IouogmsJJ8XQB5o7ygN4yj/8ylpTBjdZM62OO?= =?iso-8859-1?q?Ko76Z2rPKc3dalC6b7Jc6zEEEvDuUyfRHc/ElgE5eojYxFHY05vZO6xBdtj4?= =?iso-8859-1?q?MPCHfduzA0dl3cCZbextH1eJ71wHkxWpZRBVroLLhH6ie2hM69SGgaLPImRh?= =?iso-8859-1?q?aldN21cgZWPb/RpIlnfDgnPVraVzmvf+rt255YfbEJH4i0vW1511GMW46v8f?= =?iso-8859-1?q?XWRyitTTc16CoOPSe+UnS86WZCKnuIZkn+wM9xfHTkrMtLBq8GzM6+SwOHo3?= =?iso-8859-1?q?aTV36x49eN/n1zyqFdaxpeJtNI7rLl1H2yUZtf+7bXHS5yMwcM0P9P6RaNmE?= =?iso-8859-1?q?sj6WuQYPPJDt3g0TGPdy8JEvaV3aNI3Px7h/DBy4QnnplpoCihlncrYzc8Ej?= =?iso-8859-1?q?tOfpp/Qc2XiyIlClmuTSIIiK2CLcEjtTyay29c6SuB5PKDuDuxE687p1ACnD?= =?iso-8859-1?q?IcPV8tlxs/+vijIAe543ealbQx8cn7I08YJ3AZXzwowW+G279W+QFBu0VOwZ?= =?iso-8859-1?q?2QNFbQtBivjwazLVOKf+t3DeRxcJSeoUODAW+0Ai3RJ0Y+PiTIH3XGKV4C13?= =?iso-8859-1?q?/ammYx/hRU556WfITV4G+IpokfHo8D53ArbgAwMo9dWlIlaOoD10tVCaUA5b?= =?iso-8859-1?q?gkzI9gW43GH/53hJM6XglKRLMOo7e/M4gvXXh+P8K8Wj+/IZxyzuWPXqJha+?= =?iso-8859-1?q?UxvxCIw723E5MdYu0B/KnnhFSeWFquPrihN9M9VutFfSad9yMFpHvR39mR07?= =?iso-8859-1?q?J+ncYOQAkpob5eGKNnZhqm6H2H1fkqB9Nmk2eD3nGSxy0npsehxkTb5xbpLo?= =?iso-8859-1?q?ftTfRXqpGJ9Wn/2ghV8sg8S7omhMbKBu2y9yR4XZh2jZyK0GEtjzSxP8XdyR?= =?iso-8859-1?q?hFBWA0hXuacUkQTRh6P23BTE8qAp2qSzdtD1ozH12Mt3DXRe7dTXsIU1zY2Y?= =?iso-8859-1?q?ECFXO2SI3R+oei2Wda2s4MjXih/be2V2YDdvt9BJVE24UGchtmSNBN3cSKJB?= =?iso-8859-1?q?sjBOl/TmQZtD3C1AQ5BimiDFUVBbeHxHy4g7lEYXim/XMItrz1INuVGE/MRf?= =?iso-8859-1?q?FQ9y4HQS5dDU0UuIrsDkieyuK1NQl3Kd+kVU5TxZBKroUsnfr3CQcfROpJfw?= =?iso-8859-1?q?HIPDBlcaw96BMTnjlijP1HEWY5FaLf6MBnH9f8+YrPYWdiky3mTPUa132fxT?= =?iso-8859-1?q?VNozKqkoIXdr1gqWG57Lj5AVTB45hJvlY+RxUviUIHMwP4Z0Idj5qYLlgR01?= =?iso-8859-1?q?e+30yhtOn6CdZdTZbe1wUqIqi6NEYAQPzCVyhLE7aKhlsbRhJKFJRQPxclzu?= =?iso-8859-1?q?zJ9hL1KoeTRn6411zoTHMtKQHxBGwAtwtzGDfNhcdt6yEFol8H224IckYKOj?= =?iso-8859-1?q?HjgCZooZYGrnTy88pIe78UE7r6RQZjC6Wa8+cLlStWZxJV7Q1EffsldZ7NRo?= =?iso-8859-1?q?NjerOJDlM0Zt3fgaHz4GazEIdIle5SiDlbwXXiIxpmqK7ACEFBoLvv+bNnTQ?= =?iso-8859-1?q?2G9H/JTEGoOxQpr2kcyie3mX4H6NPWZlvlpdRd38QFCDhQcp4ekNtMsmOb2z?= =?iso-8859-1?q?1m1twfLtxuuzcqcYOqvzqVGjd3lql+3GbiXfugoUas4fLcG723v8Tg1TvTiC?= =?iso-8859-1?q?Rxac=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: b3ae390d-0861-45db-02d3-08d9ba6ebc7c X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2021 17:18:21.9823 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ha/Nl7FLp3/Hr4FN/njRChDUEPjhm3n1UMzMv0atpK3hFiUtVSvVQBDLx4Z6WQ/2cxmBpH2Xrs8nKWc5mB6N3FMHuUfxHQ7nk5KmOz6mMJo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MRXP264MB0823 X-Stat-Signature: e8afbqs9gwomhsasnj64w98yfdo9jrhe Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf01.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.85 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 2009B40009 X-HE-Tag: 1638983904-143945 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: hugetlb_get_unmapped_area() is now identical to the generic version if only RADIX is enabled, so move it to slice.c and let it fallback on the generic one when HASH MMU is not compiled in. Do the same with arch_get_unmapped_area() and arch_get_unmapped_area_topdown(). Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/64/mmu.h | 6 ---- arch/powerpc/include/asm/book3s/64/slice.h | 6 ++++ arch/powerpc/mm/book3s64/slice.c | 42 ++++++++++++++++++++++ arch/powerpc/mm/hugetlbpage.c | 21 ----------- arch/powerpc/mm/mmap.c | 36 ------------------- 5 files changed, 48 insertions(+), 63 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/mmu.h b/arch/powerpc/include/asm/book3s/64/mmu.h index 7fee46e50377..310ca3597d58 100644 --- a/arch/powerpc/include/asm/book3s/64/mmu.h +++ b/arch/powerpc/include/asm/book3s/64/mmu.h @@ -4,12 +4,6 @@ #include -#ifdef CONFIG_HUGETLB_PAGE -#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA -#endif -#define HAVE_ARCH_UNMAPPED_AREA -#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN - #ifndef __ASSEMBLY__ /* * Page size definition diff --git a/arch/powerpc/include/asm/book3s/64/slice.h b/arch/powerpc/include/asm/book3s/64/slice.h index 5b0f7105bc8b..b8eb4ad271b9 100644 --- a/arch/powerpc/include/asm/book3s/64/slice.h +++ b/arch/powerpc/include/asm/book3s/64/slice.h @@ -4,6 +4,12 @@ #ifndef __ASSEMBLY__ +#ifdef CONFIG_HUGETLB_PAGE +#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA +#endif +#define HAVE_ARCH_UNMAPPED_AREA +#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN + #define SLICE_LOW_SHIFT 28 #define SLICE_LOW_TOP (0x100000000ul) #define SLICE_NUM_LOW (SLICE_LOW_TOP >> SLICE_LOW_SHIFT) diff --git a/arch/powerpc/mm/book3s64/slice.c b/arch/powerpc/mm/book3s64/slice.c index e4382713746d..03681042b807 100644 --- a/arch/powerpc/mm/book3s64/slice.c +++ b/arch/powerpc/mm/book3s64/slice.c @@ -639,6 +639,32 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len, } EXPORT_SYMBOL_GPL(slice_get_unmapped_area); +unsigned long arch_get_unmapped_area(struct file *filp, + unsigned long addr, + unsigned long len, + unsigned long pgoff, + unsigned long flags) +{ + if (radix_enabled()) + return generic_get_unmapped_area(filp, addr, len, pgoff, flags); + + return slice_get_unmapped_area(addr, len, flags, + mm_ctx_user_psize(¤t->mm->context), 0); +} + +unsigned long arch_get_unmapped_area_topdown(struct file *filp, + const unsigned long addr0, + const unsigned long len, + const unsigned long pgoff, + const unsigned long flags) +{ + if (radix_enabled()) + return generic_get_unmapped_area_topdown(filp, addr0, len, pgoff, flags); + + return slice_get_unmapped_area(addr0, len, flags, + mm_ctx_user_psize(¤t->mm->context), 1); +} + unsigned int notrace get_slice_psize(struct mm_struct *mm, unsigned long addr) { unsigned char *psizes; @@ -766,4 +792,20 @@ unsigned long vma_mmu_pagesize(struct vm_area_struct *vma) return 1UL << mmu_psize_to_shift(get_slice_psize(vma->vm_mm, vma->vm_start)); } + +static int file_to_psize(struct file *file) +{ + struct hstate *hstate = hstate_file(file); + return shift_to_mmu_psize(huge_page_shift(hstate)); +} + +unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags) +{ + if (radix_enabled()) + return generic_hugetlb_get_unmapped_area(file, addr, len, pgoff, flags); + + return slice_get_unmapped_area(addr, len, flags, file_to_psize(file), 1); +} #endif diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index bfd7f4af1e58..eb9de09e49a3 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -542,27 +542,6 @@ struct page *follow_huge_pd(struct vm_area_struct *vma, return page; } -#ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA -static inline int file_to_psize(struct file *file) -{ - struct hstate *hstate = hstate_file(file); - return shift_to_mmu_psize(huge_page_shift(hstate)); -} - -unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - unsigned long len, unsigned long pgoff, - unsigned long flags) -{ - if (radix_enabled()) - return generic_hugetlb_get_unmapped_area(file, addr, len, - pgoff, flags); -#ifdef CONFIG_PPC_64S_HASH_MMU - return slice_get_unmapped_area(addr, len, flags, file_to_psize(file), 1); -#endif - BUG(); -} -#endif - bool __init arch_hugetlb_valid_size(unsigned long size) { int shift = __ffs(size); diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c index 46781d0103d1..5972d619d274 100644 --- a/arch/powerpc/mm/mmap.c +++ b/arch/powerpc/mm/mmap.c @@ -80,42 +80,6 @@ static inline unsigned long mmap_base(unsigned long rnd, return PAGE_ALIGN(DEFAULT_MAP_WINDOW - gap - rnd); } -#ifdef HAVE_ARCH_UNMAPPED_AREA -unsigned long arch_get_unmapped_area(struct file *filp, - unsigned long addr, - unsigned long len, - unsigned long pgoff, - unsigned long flags) -{ - if (radix_enabled()) - return generic_get_unmapped_area(filp, addr, len, pgoff, flags); - -#ifdef CONFIG_PPC_64S_HASH_MMU - return slice_get_unmapped_area(addr, len, flags, - mm_ctx_user_psize(¤t->mm->context), 0); -#else - BUG(); -#endif -} - -unsigned long arch_get_unmapped_area_topdown(struct file *filp, - const unsigned long addr0, - const unsigned long len, - const unsigned long pgoff, - const unsigned long flags) -{ - if (radix_enabled()) - return generic_get_unmapped_area_topdown(filp, addr0, len, pgoff, flags); - -#ifdef CONFIG_PPC_64S_HASH_MMU - return slice_get_unmapped_area(addr0, len, flags, - mm_ctx_user_psize(¤t->mm->context), 1); -#else - BUG(); -#endif -} -#endif /* HAVE_ARCH_UNMAPPED_AREA */ - /* * This function, called very early during the creation of a new * process VM image, sets up which VM layout function to use: From patchwork Wed Dec 8 17:18:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12664921 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 D0843C433EF for ; Wed, 8 Dec 2021 17:22:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E785F6B0080; Wed, 8 Dec 2021 12:18:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E28AB6B0081; Wed, 8 Dec 2021 12:18:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C7B3B6B0082; Wed, 8 Dec 2021 12:18:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0086.hostedemail.com [216.40.44.86]) by kanga.kvack.org (Postfix) with ESMTP id B54336B0080 for ; Wed, 8 Dec 2021 12:18:36 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 76C6E8992A for ; Wed, 8 Dec 2021 17:18:26 +0000 (UTC) X-FDA: 78895285812.27.79E752C Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120085.outbound.protection.outlook.com [40.107.12.85]) by imf01.hostedemail.com (Postfix) with ESMTP id CF29A40006 for ; Wed, 8 Dec 2021 17:18:25 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HQE/yi/CLqNTAie+pOdeKBykmjhtujN+GH5+8RuvavMmjXvcKzhf8Iup2vl8P14XKfykmYV45BFhuQRrQoeZpGwwl2unKYUe6BlT+UxtJugS03cLvMwUwvhlVD6WA7QDnJnWs7yHjdJ6JH+o+0BGlyS0HplMw8bhFgZ+hOBsYlNw7j9BzDdoibd+Vfg4MJNoQoSMIM5j1yjOsPZWsSOq5exXJaCYbyk8ZFM0RqHRftrz94YyaSqx8X6KH1QCsu7I5teVpBbf7S6QKGJwacGWCpYdOEE56TeQ/OzxtHiigP3B6Gnd0yuugTTyPhYesls8u60LN2H2odC70OZZ457wlw== 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=lf6GokKuoZoWQvmpjyaXDKy1bgTlLEdqEkRamvuWwIs=; b=Fn03L9wbRpx0K9VJqGa5XAI0SimcQS2wNpSR0xK8JaZsEKoj7lIS/HY+IHKIZpU7F7DzoPN2xpWq9bBEXNRk1o6Sb3VJeU8gZeKHlCy0wAPLb1AtJCVnavzOgBKWfXqIcTrR87qFECSkpRBtRafRfXdBfi4+LnjW3fnXny49ohiRZHQDdvYNEN+PU0yTJrVu2AYC7OoN+jZvzTM4vLScxw/Q3w6GdklXnxonVAI1Hm4Siu1WzZW00sNT86n09E4NVLbsY+M+ZWBmPBDZaS1jXcFlvtKgXtQnzZW7APofkiHwuC6/hE9tk+3821YFjMoAJx8ru6zAwNIlCn+VNhWRAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MRXP264MB0823.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:16::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11; Wed, 8 Dec 2021 17:18:22 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f%2]) with mapi id 15.20.4755.022; Wed, 8 Dec 2021 17:18:22 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" Subject: [PATCH v4 09/10] powerpc/mm: Convert to default topdown mmap layout Thread-Topic: [PATCH v4 09/10] powerpc/mm: Convert to default topdown mmap layout Thread-Index: AQHX7FeaDIjAZ/GjkUuXVuFYrIE56w== Date: Wed, 8 Dec 2021 17:18:22 +0000 Message-ID: References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2e9cbbe9-67da-468d-7bea-08d9ba6ebcf4 x-ms-traffictypediagnostic: MRXP264MB0823:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:862; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: w3+fDyUkoCVZoLlOatmNJHMzX4qBit4GfxYMzarSNt7/VVq+6rSaWTn1RgmVJQNk2gxikfNqshKWDb3KdeaoIlDcgmwCfcuBp/xZCWbExYsNxZe4lGfnqbayuX1dMeiNyJidgXcIPc7T2TdpRgPjyLwA4G56eTlxy7uG1Eo/eSXtuggTvmz9NbHZZwtYTl/WWMGTENnTHMiaTG5vZI9pLQLZclLgMiv08ngt0g4uLA/mDHRZRfStRxbVKpI5a2HeGCQ2z1y/a9lOiBmQwYIwI0HPK4pXJNB50r/0THpvOXMs/XCyI2KQYr4iV39aARCj1/Qt9ZUt5gCupSkjRp9v8PnJSDt7GP8nOgLgbUcuMsJjTPU9B4ZSZ4Sl/5fUqrAmtb+sYOxZBovBR63ng+Z8gx/m8IIt320P5Xvrn6+ul41jgy6q/m15T1mGo9lKtB7Yd/cXIvvZFCVY22GTq6VlDp8Qu5J6hU2vKZ9MS1hYAehsAhrQViQOC4RUlc8+qyZSTbmGjV1M6RXn/HX6YS1O9eXhnMzBf8TsHXdf4i5ANHmNcPKg5Ore+minhyBIqRzoM/mhVPNwf6R7zVGLFbEm7Dls37yV7BdLW79b4Hq/y565qwmt17tIWiQW17RBiosyPpUJEEUD/IqauT0hrDM1Y0FkNB2MkKQrUR/HWcetlM1sG7W0vQ/Q5HDzLNc2PYTNt9Hif/+SBf/4H0Ue07l7Tw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(4326008)(316002)(83380400001)(6486002)(2906002)(36756003)(26005)(110136005)(64756008)(91956017)(66946007)(8676002)(54906003)(86362001)(44832011)(76116006)(6506007)(66476007)(66556008)(6512007)(5660300002)(508600001)(38100700002)(2616005)(66446008)(71200400001)(122000001)(186003)(8936002)(38070700005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?toYYV23H63V5qvt0j63R0H8?= =?iso-8859-1?q?AzPipbgQ1BPJsbAQ++/GKrUBbi8iyYGnWelfKr6x46pqI66SEDIEAatQY2uU?= =?iso-8859-1?q?N4KT1vZymUNW/Aku5GrNy5xIQPeeEpFnQe2OnhuO/HMGKkhfOQKnkjF8mJOh?= =?iso-8859-1?q?z7LLhm6eAYY17bda+SItzxm90gE8GlGv7CwhzjzI3X/DAvXXn6qRHcFomQ3I?= =?iso-8859-1?q?rj6padcWj7NazCbYD2BDPQfFQQXnPTRd7iDprVSv+yAlmYgh56ZBhlaN3C/X?= =?iso-8859-1?q?Uuvc03n83wqcpur/0695BiDd3WtLQfzQaJRXaemr0jRKHtz/5/ocAnU0Z4ty?= =?iso-8859-1?q?1jUwKiUcH2kW0gK7mI9EDz4NzBXjv+o2DjJ4Ai5HTacG3mqCCxrviSExWfp4?= =?iso-8859-1?q?dJWlVST7T6lScl4M5ECoHcfWmxJW7dF5MxbBSvLDOODzh15UlNnrdTz71CUU?= =?iso-8859-1?q?JRCtrtbThbf3LUljwMDYYrObM9XlaTztMmyK0nZeWJLkmkpLN2w63Tse8bdS?= =?iso-8859-1?q?I0E0uZlN/BUAMY0w9NOFws2mmvqmcOnW2aeAeu2O6lqjSjY9vI3DqqdB8N6d?= =?iso-8859-1?q?lEthUZhWowR5Km94A9QR4hwPrKn3s2IHbBWHZcTOoolwt6yHm7242m27QFtZ?= =?iso-8859-1?q?UVo3E2cwlbiDp30POSxWpqIDum+Bf1A9TYLxFfDQLc5fTTTDHhCHxMQRagsl?= =?iso-8859-1?q?VGfFJ0UT3YogTyNQ3am7vFXv4ELpJvHaLcJkHVhBJBV7d1nEn57MQ2frcI56?= =?iso-8859-1?q?7iwVQTipEJayjI6qjxXNaQOAO/n2aWdAg0zf5oXAWO5sCEnJydgp1IchVOxd?= =?iso-8859-1?q?dpveAOw0LpVQkKgv6yfP5o0vU24dtZlJHQzNIJ6rcJPOzMsrbWwJguWLIWc2?= =?iso-8859-1?q?g7KJQEePtvGvNWcAS9mL/gP+8qdDtv4DPI5+mPPnntYky6qhMHvtTiZHNAhZ?= =?iso-8859-1?q?lpJOGe32Uuzi8NUNU5qlhQ1BYxWpieaC4WrfPvQsLaPzg5461vZ+QkIM37sw?= =?iso-8859-1?q?sAj6UQM00fD/Ve3Je9BA3H0bR2KAkasgoFid/lWyDW2CGO/My7dBz/7NIDhL?= =?iso-8859-1?q?QDgJhkq2NOBSaGOq4gEyjTB5cQunSyu0frWxPj+G3PKCJGXoHYZpUACyARFG?= =?iso-8859-1?q?EJDwj5cF2FWzGfoJVrxXJkY5sQ02JCqmO+122BVaACXAtcz7fVKTtMAG3bbJ?= =?iso-8859-1?q?ErUE+7onsi1iERfM8ArpiwprjP5sBMuLBBN4QfowP1XJ5SQzAk7D9g2W4Bba?= =?iso-8859-1?q?qpOeZvTqpko9WCPTo1Y+whwMgyukbYJyDKiws/eKtkuQe5VAwYUKGw7NE6m/?= =?iso-8859-1?q?T8W0HwKFyoUInbM54QzascMDQ7c0nEXflce4K6r2oGbm+VT8FglUCFvT0Xck?= =?iso-8859-1?q?zVLICFMO2p2T8fPZLInYPk4HBysM0IHCEqpl7ica/E4Iy/q0G5ASVavX9UZE?= =?iso-8859-1?q?lH4iVQy9qWxZLfNOXM2raxownfLOIS8i5yeMX7Ak5QtfYPFOBxPG8Xvulrsb?= =?iso-8859-1?q?65EV+PYxP8Eyi0giMh+XYxzvmb7GjqkJwKkHQefjVvZt4qAUhGbv1lf9VGTs?= =?iso-8859-1?q?TGk24Ys0VxQAh7e1JXEta5C/qY/Y+0HnFIlnDmBt7T92EjV2IkWPqfVbVpgx?= =?iso-8859-1?q?B0JTYpfhZvsqiIYGfbAXB7GFuDgng1cMJfc40JX8R++4lfZKcMt48abmuRZn?= =?iso-8859-1?q?uckxfsu0qalX3annXrqFNymRCtY0n2IwSY0scYlFnQwk8Z+YzKhgJWtetckE?= =?iso-8859-1?q?3pRU=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 2e9cbbe9-67da-468d-7bea-08d9ba6ebcf4 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2021 17:18:22.8007 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: l4lJQDaEQyWkmYDCsureuUNhSkJtkLZPMmWwhFZwIWeTgjQqmFGB1SrEu8p/sUfcj5aW8OyAfZ2xEXKEIYiUHupbbIVx9b7qrQTW97+jDeo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MRXP264MB0823 X-Stat-Signature: 9rt7mzef3febpohoprxwxwro65u9impe Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf01.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.85 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: CF29A40006 X-HE-Tag: 1638983905-901376 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: Select CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT and remove arch/powerpc/mm/mmap.c This change provides standard randomisation of mmaps. See commit 8b8addf891de ("x86/mm/32: Enable full randomization on i386 and X86_32") for all the benefits of mmap randomisation. Comparison between powerpc implementation and the generic one: - mmap_is_legacy() is identical. - arch_mmap_rnd() does exactly the same allthough it's written slightly differently. - MIN_GAP and MAX_GAP are identical. - mmap_base() does the same but uses STACK_RND_MASK which provides the same values as stack_maxrandom_size(). - arch_pick_mmap_layout() is almost identical. The only difference is that it also adds the random factor to mm->mmap_base in legacy mode. That last point is what provides the standard randomisation of mmaps. Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 2 +- arch/powerpc/include/asm/processor.h | 2 - arch/powerpc/mm/Makefile | 2 +- arch/powerpc/mm/mmap.c | 105 --------------------------- 4 files changed, 2 insertions(+), 109 deletions(-) delete mode 100644 arch/powerpc/mm/mmap.c diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 0631c9241af3..b4ae3d8bde46 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -122,7 +122,6 @@ config PPC select ARCH_HAS_DEBUG_WX if STRICT_KERNEL_RWX select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_DMA_MAP_DIRECT if PPC_PSERIES - select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_FORTIFY_SOURCE select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_HUGEPD if HUGETLB_PAGE @@ -158,6 +157,7 @@ config PPC select ARCH_USE_MEMTEST select ARCH_USE_QUEUED_RWLOCKS if PPC_QUEUED_SPINLOCKS select ARCH_USE_QUEUED_SPINLOCKS if PPC_QUEUED_SPINLOCKS + select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT select ARCH_WANT_IPC_PARSE_VERSION select ARCH_WANT_IRQS_OFF_ACTIVATE_MM select ARCH_WANT_LD_ORPHAN_WARN diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index 2c8686d9e964..873adaab20c8 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h @@ -392,8 +392,6 @@ static inline void prefetchw(const void *x) #define spin_lock_prefetch(x) prefetchw(x) -#define HAVE_ARCH_PICK_MMAP_LAYOUT - /* asm stubs */ extern unsigned long isa300_idle_stop_noloss(unsigned long psscr_val); extern unsigned long isa300_idle_stop_mayloss(unsigned long psscr_val); diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile index d4c20484dad9..503a6e249940 100644 --- a/arch/powerpc/mm/Makefile +++ b/arch/powerpc/mm/Makefile @@ -5,7 +5,7 @@ ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC) -obj-y := fault.o mem.o pgtable.o mmap.o maccess.o pageattr.o \ +obj-y := fault.o mem.o pgtable.o maccess.o pageattr.o \ init_$(BITS).o pgtable_$(BITS).o \ pgtable-frag.o ioremap.o ioremap_$(BITS).o \ init-common.o mmu_context.o drmem.o \ diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c deleted file mode 100644 index 5972d619d274..000000000000 --- a/arch/powerpc/mm/mmap.c +++ /dev/null @@ -1,105 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * flexible mmap layout support - * - * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina. - * All Rights Reserved. - * - * Started by Ingo Molnar - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Top of mmap area (just below the process stack). - * - * Leave at least a ~128 MB hole. - */ -#define MIN_GAP (128*1024*1024) -#define MAX_GAP (TASK_SIZE/6*5) - -static inline int mmap_is_legacy(struct rlimit *rlim_stack) -{ - if (current->personality & ADDR_COMPAT_LAYOUT) - return 1; - - if (rlim_stack->rlim_cur == RLIM_INFINITY) - return 1; - - return sysctl_legacy_va_layout; -} - -unsigned long arch_mmap_rnd(void) -{ - unsigned long shift, rnd; - - shift = mmap_rnd_bits; -#ifdef CONFIG_COMPAT - if (is_32bit_task()) - shift = mmap_rnd_compat_bits; -#endif - rnd = get_random_long() % (1ul << shift); - - return rnd << PAGE_SHIFT; -} - -static inline unsigned long stack_maxrandom_size(void) -{ - if (!(current->flags & PF_RANDOMIZE)) - return 0; - - /* 8MB for 32bit, 1GB for 64bit */ - if (is_32bit_task()) - return (1<<23); - else - return (1<<30); -} - -static inline unsigned long mmap_base(unsigned long rnd, - struct rlimit *rlim_stack) -{ - unsigned long gap = rlim_stack->rlim_cur; - unsigned long pad = stack_maxrandom_size() + stack_guard_gap; - - /* Values close to RLIM_INFINITY can overflow. */ - if (gap + pad > gap) - gap += pad; - - if (gap < MIN_GAP) - gap = MIN_GAP; - else if (gap > MAX_GAP) - gap = MAX_GAP; - - return PAGE_ALIGN(DEFAULT_MAP_WINDOW - gap - rnd); -} - -/* - * This function, called very early during the creation of a new - * process VM image, sets up which VM layout function to use: - */ -void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack) -{ - unsigned long random_factor = 0UL; - - if (current->flags & PF_RANDOMIZE) - random_factor = arch_mmap_rnd(); - - /* - * Fall back to the standard layout if the personality - * bit is set, or if the expected stack growth is unlimited: - */ - if (mmap_is_legacy(rlim_stack)) { - mm->mmap_base = TASK_UNMAPPED_BASE; - mm->get_unmapped_area = arch_get_unmapped_area; - } else { - mm->mmap_base = mmap_base(random_factor, rlim_stack); - mm->get_unmapped_area = arch_get_unmapped_area_topdown; - } -} From patchwork Wed Dec 8 17:18:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12664923 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 BC877C433EF for ; Wed, 8 Dec 2021 17:23:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 21D7B6B0081; Wed, 8 Dec 2021 12:18:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CC396B0082; Wed, 8 Dec 2021 12:18:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01F426B0083; Wed, 8 Dec 2021 12:18:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0090.hostedemail.com [216.40.44.90]) by kanga.kvack.org (Postfix) with ESMTP id E39E76B0081 for ; Wed, 8 Dec 2021 12:18:37 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 26F2F88CD3 for ; Wed, 8 Dec 2021 17:18:27 +0000 (UTC) X-FDA: 78895285854.17.4E6AFDF Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120085.outbound.protection.outlook.com [40.107.12.85]) by imf01.hostedemail.com (Postfix) with ESMTP id 8A1BC40002 for ; Wed, 8 Dec 2021 17:18:26 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eiZE8ftOBXxsSnxDh+qS2PcHhjoXQopdzZnblcNLb9uKi5sQtvMffCsXmRUMSg/hTM3fKRrEQutm9HPZWc5xpBOHpbeiwxT2tY37qOs+C57S59xsSHr1NmrCzX/pM1k0zExlxhzRh8iCFG2ZYTroGOR2/WhwNgRjxXEBhs2BPtLTxUGSWpi7XD56AP+RH8AcTGqHzGCKWoS3BgwAyNskNhYsah7EdXhzmvZmyPVRtC/Dm7SshOIAp9fczUqc2VX/iWJR00rAzVRk9t1TQSYsCaoHt1RfyowNcYpA3nN7ypO0xKYFSzuvFHi5PxA4GulsbcJQZtSnzzGUUEd3HfyF0w== 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=mwyareCaN3ZlSh2+BwwdNQ1qMDia3Q7S45Cfyrw+tSI=; b=YF1ow86oKAgDqt+Jgs/jZ5/KaiB7AMFEyMPMQpsHLdwcwQzYx/fxL4LCfkI2xsljcEiagserEGjd+vSAaBVadFD1ERVDjrZnhxYq8s04D6dZjXCEG7xgywzMFXo5s9TIH0Y3y1wbHTsbO8WqxFyF8PuUSHsB0vpFfvlsC3cZTQnb2w2+VZMt1VqxRpDtnmmSYVZL0qDtJ83NcUMF/I2OTfMEAz/NlLAAJOHt3f6UCddMln4kcQwxt0Gret7akPFlCs7M0HSPjjVtLohafVAXMd/MUFlhNr7fIbd5PCmT2U4EndlMS9sMMOjEuRyut76Ee/DPD4vAaH6ucmM48+Gdzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MRXP264MB0823.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:16::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11; Wed, 8 Dec 2021 17:18:23 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f%2]) with mapi id 15.20.4755.022; Wed, 8 Dec 2021 17:18:23 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" Subject: [PATCH v4 10/10] powerpc/mm: Properly randomise mmap with slices Thread-Topic: [PATCH v4 10/10] powerpc/mm: Properly randomise mmap with slices Thread-Index: AQHX7Fea0peO1pudxEe4GqD87shvlw== Date: Wed, 8 Dec 2021 17:18:23 +0000 Message-ID: <4249d95311ec93b0a9d421ca56d69612fb1e5811.1638976229.git.christophe.leroy@csgroup.eu> References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 25e52a4a-c6a3-4185-e955-08d9ba6ebd39 x-ms-traffictypediagnostic: MRXP264MB0823:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: lzZX7QebEXDdh9sbFiSLsMtViHHRZyuzmmraxPn14LX7E5/nwrCbd8mJ8PGk9p87L1P99dGLnZ1ksPCzqXSp/6Be2576RjnuQibka4fkV4FNFcSDbB0MU4PRj0hBGmMM2FpoUaytnYqjB7kRljJ3KOaZ5FeFgWSvfV6v7VJ6fG20QGVBziPgtKcyjQNR8JC8lf+eoolBiVmLoAZGTYYsoILhjLU3XifBKKBXxmtsR0qmgV+ta5A9rG2IL8Xqa2BQthbgQgsn1OZwNUGiMHCkmfSZlp0ExRS4mYn7A20ve+yRlS8WV5B9S3i+l4OsQzG/RE4WsBqP43afoNdG3Yt8ZiZfYsCkMNNyEG1dFSbAZxKJVjzmtjNY3S8CgCPcp4Tgc0M/kyOYUV8tugI+oulVfaIOoccdSPn+v3+u7QzLEr2m/3spFDopAak6/fp69Xl638KjlVaIpbPROfDKhsotoJHgLrzUR9M37jfkkp4GG7jYmhtr54Xuc6gqUagCNnQ7iYdc3uDq+amjJtPLHfw0D0nDgtgOA6yORm/imzYePiW64zxnq2EQFQY9JarGBQlRyIumujirAuc0TYVeFvYp8N2m0K0hUhiSUP5FYEI033fMWZPduY3R9WsnKRatTl4SrvvLCp2EEx4olQaI9/N3WTRuahDVn65tKl9WSD09gcuwwbLX7UYchkAEpr1Bv+kkvxK8F8ywmWzXKWp+KG1XvA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(4326008)(316002)(83380400001)(6486002)(2906002)(36756003)(26005)(110136005)(64756008)(91956017)(66946007)(8676002)(54906003)(86362001)(44832011)(76116006)(6506007)(66476007)(66556008)(6512007)(5660300002)(508600001)(38100700002)(2616005)(66446008)(71200400001)(122000001)(186003)(8936002)(38070700005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?j56JBr4ekIZvDjBGiD8vnEL?= =?iso-8859-1?q?wDxOgQ8KAn43eVuzSzeimAxdDIaiMWHiVSmTWXs6kvr5Hp851I7ff8wq7Guu?= =?iso-8859-1?q?+H99+yTPOzv+iW3WqpZb89tpnaEyGexpwru+9sm1k0bR00qCpRx8IeQwk+nz?= =?iso-8859-1?q?4gXI3NbHhOHQe3YPGbnoihmiD/ml2fYiTsWmQCDYeuFCFvhffTxtP2tYbKq4?= =?iso-8859-1?q?PfaM3c+nR8U5A0wzfXlHJZ0EewgHjmyXNbhWN+shOxVoUw2LVRtlVSWskMOD?= =?iso-8859-1?q?R443E+HtlhKAa18pqFyulPQnRpl3/f9UAJXqPqM9T7WdfOqV/hTaVC7Iirlp?= =?iso-8859-1?q?ipWdni5ou++Ax1jrRn48WeC2O1ZOR8ObtV4onuUTcNqz/E+L4v7nprZmQQGq?= =?iso-8859-1?q?2KStKTi2sCnv8r/aNNMNBax+1MTAdwZPWlVb7OiyDgzfVyAAU6cqIAuddgeS?= =?iso-8859-1?q?29OAR/H23pcfDzvokeF4mW8aoPOsM5tSvxfuoJyVyCbrJS0umLytouJ90Zru?= =?iso-8859-1?q?lf690muIqydWqOhN2z5mJ7bZTRmcgHfxpjfnFUbzD6+dyzeKLIgvQWjQhiOv?= =?iso-8859-1?q?BTeyZbqqNlfOX5w2Ea5QVqNuoN5Sjh/0nJnpgXsVkMEQUI7p/sfEAsrT6jnl?= =?iso-8859-1?q?ijeWMSA08ROfXuj+aE+PwWUYielOoYIOx4bQicENdHlOYfZL1WAuhA5nmHRR?= =?iso-8859-1?q?+AxfxvPJexbZDoUW1pI4R8Qxxi2FxXRpzQSeeRHQ5P0SEFwT/M+zljPb59g2?= =?iso-8859-1?q?jnc1e5vRWX4aDzFhv3gBHiWdEoO6xXxhg8e9gGVlYs40FVd1x9THqTQuaNwd?= =?iso-8859-1?q?mrMsqEqZCduzAV5lMHMOHmFlxLS2mKkjuBQ0FNciAhy3J3S1HUgQtP48FAA6?= =?iso-8859-1?q?/mpjcCrDEDf5Kwvn5znnt0AMMN1cvGnNg9BklMBDyKjOsAtKNozMpirKwWRb?= =?iso-8859-1?q?1wTjSJ+AkbE10wY4qCP1+8/A2MkHGpl7BBiotSWMvCD6HcabJnHu3l9gMtcz?= =?iso-8859-1?q?mDjQZs9aZugNrG1vA+sHJSQkDZOzC75RnGzehbEoFIii4VWGPXsDuRUKfazi?= =?iso-8859-1?q?8eUOsH0xrzz1OVdCGdk9NRUsVfVDk+R9X9jhALtmnn1b9GZhJYnWWwwqitHD?= =?iso-8859-1?q?frFlpALfVfGpAMkRdT8E8uXRUyKO8Ioa21YoVPgypzvQbJzwIYj7YWxAo6yT?= =?iso-8859-1?q?wNh9SP8HwZ7GGKgG+YvkwCxoUQCXJGUuiSTfTKxBwRWRGOfsYxBuJKYXOK0U?= =?iso-8859-1?q?zQTCcv0+1z5zMjTixq02GtFn0SE0QtqbIxZU/tGnAgpYzNp43zYR3lnhdMyF?= =?iso-8859-1?q?YuWW5G1dXal2mVzfn7k4HC1z+svwDgEMgn+lV2Uv4yWoXiWJ2Y5iZ9OeeXOf?= =?iso-8859-1?q?wR/JNe41cn2qsrKhvb90A3ddEsorjILCwde+6RmG75XyPYmk5VE2aPcDYrC2?= =?iso-8859-1?q?LHrZ2N1o1Y3WlcCoDe96S20CT1Ctk0FmEkRDEct38bZKqFVY3zDzaiZMZ5Mi?= =?iso-8859-1?q?Xmkp8Yy0hhwPHR/MlnJlFy1pNacyJhyQY6/7hKaIRDy6KLi3HG7DMaUm5wUe?= =?iso-8859-1?q?AsR6jLv9YdZkT9nJ+3m9KC3SgrhydJqECDwdQINyGv4Q7h1k3eCgnafZXgQx?= =?iso-8859-1?q?1Pc2PRFFk+lXZ2YI6OezH962Xgt73VK2dAL6en5QvOnqfjE7NFufxOnIqxZu?= =?iso-8859-1?q?T18sB2PA6dSepiWEohAgdSBY8DmILTSrGiTjkdOx898TQ5/OguTnrDdq2Q2d?= =?iso-8859-1?q?ZSOs=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 25e52a4a-c6a3-4185-e955-08d9ba6ebd39 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2021 17:18:23.3045 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: xrmZbvib/nPauh6MNCf5h/i6IV6TryjEpzQV2pNldufeprO/+fb686MLlSvw6xDNNo/artxugnM6xp+jzPsFcTgf9xzkcnDNbHZ+BKkLUis= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MRXP264MB0823 X-Stat-Signature: e5k6dmti6wzyeu7pqip6t3s44rodbckn Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf01.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.85 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 8A1BC40002 X-HE-Tag: 1638983906-888131 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: Now that powerpc switched to default topdown mmap layout, mm->mmap_base is properly randomised. However slice_find_area_bottomup() doesn't use mm->mmap_base but uses the fixed TASK_UNMAPPED_BASE instead. slice_find_area_bottomup() being used as a fallback to slice_find_area_topdown(), it can't use mm->mmap_base directly. Instead of always using TASK_UNMAPPED_BASE as base address, leave it to the caller. When called from slice_find_area_topdown() TASK_UNMAPPED_BASE is used. Otherwise mm->mmap_base is used. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/book3s64/slice.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/mm/book3s64/slice.c b/arch/powerpc/mm/book3s64/slice.c index 03681042b807..c0b58afb9a47 100644 --- a/arch/powerpc/mm/book3s64/slice.c +++ b/arch/powerpc/mm/book3s64/slice.c @@ -276,20 +276,18 @@ static bool slice_scan_available(unsigned long addr, } static unsigned long slice_find_area_bottomup(struct mm_struct *mm, - unsigned long len, + unsigned long addr, unsigned long len, const struct slice_mask *available, int psize, unsigned long high_limit) { int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT); - unsigned long addr, found, next_end; + unsigned long found, next_end; struct vm_unmapped_area_info info; info.flags = 0; info.length = len; info.align_mask = PAGE_MASK & ((1ul << pshift) - 1); info.align_offset = 0; - - addr = TASK_UNMAPPED_BASE; /* * Check till the allow max value for this mmap request */ @@ -322,12 +320,12 @@ static unsigned long slice_find_area_bottomup(struct mm_struct *mm, } static unsigned long slice_find_area_topdown(struct mm_struct *mm, - unsigned long len, + unsigned long addr, unsigned long len, const struct slice_mask *available, int psize, unsigned long high_limit) { int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT); - unsigned long addr, found, prev; + unsigned long found, prev; struct vm_unmapped_area_info info; unsigned long min_addr = max(PAGE_SIZE, mmap_min_addr); @@ -335,8 +333,6 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm, info.length = len; info.align_mask = PAGE_MASK & ((1ul << pshift) - 1); info.align_offset = 0; - - addr = mm->mmap_base; /* * If we are trying to allocate above DEFAULT_MAP_WINDOW * Add the different to the mmap_base. @@ -377,7 +373,7 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm, * can happen with large stack limits and large mmap() * allocations. */ - return slice_find_area_bottomup(mm, len, available, psize, high_limit); + return slice_find_area_bottomup(mm, TASK_UNMAPPED_BASE, len, available, psize, high_limit); } @@ -386,9 +382,9 @@ static unsigned long slice_find_area(struct mm_struct *mm, unsigned long len, int topdown, unsigned long high_limit) { if (topdown) - return slice_find_area_topdown(mm, len, mask, psize, high_limit); + return slice_find_area_topdown(mm, mm->mmap_base, len, mask, psize, high_limit); else - return slice_find_area_bottomup(mm, len, mask, psize, high_limit); + return slice_find_area_bottomup(mm, mm->mmap_base, len, mask, psize, high_limit); } static inline void slice_copy_mask(struct slice_mask *dst,