From patchwork Wed Dec 15 06:45:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12677563 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 41EC3C433EF for ; Wed, 15 Dec 2021 06:45:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 85C296B0071; Wed, 15 Dec 2021 01:45:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 80BFA6B0073; Wed, 15 Dec 2021 01:45:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6AC736B0074; Wed, 15 Dec 2021 01:45:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0074.hostedemail.com [216.40.44.74]) by kanga.kvack.org (Postfix) with ESMTP id 5B91B6B0071 for ; Wed, 15 Dec 2021 01:45:26 -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 1614C8849F for ; Wed, 15 Dec 2021 06:45:16 +0000 (UTC) X-FDA: 78919091832.17.C187623 Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90052.outbound.protection.outlook.com [40.107.9.52]) by imf06.hostedemail.com (Postfix) with ESMTP id 431CA180006 for ; Wed, 15 Dec 2021 06:45:13 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AUHeP1gEvZEgjrlh5EUkLoSwaiHBdnjn8wIziQWxy7mNsFpFDaGxvGYYf0E/kmO3GOobur3GXC/aZ+7UIKSimiAwXc19fQ9jhoDJye/U33/J87GC19gGzzxOHAHleECnfI2jknXVrodVFkgG5xmqA2Mg6bxAGcxwQsqyPB9WArtb3BU4yYlO+uiaqnssr6q6m3lOED7z6iQvV4GIbhQP0eD750tEls1olsb/xmEHkCTXv+/NrxgSeHbpETQgozP9bTW1YDxciTr/hmO+IgdRExZwi331MU6+qxqi9pPGA8WvQgB05B/z9flCrtBozq8umqpF2H/vZPXbchgc06Yx6Q== 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=YBu/rNZbVR5tsc/OSVit3IKOiXeebF/e/ouhfG4ijHsF46Aza5Tk8L+m7wLxr4LHNUJg6texK6uyQ3Gd7NA7eDcmt+NFx+Rz7gVtISNUK/OUcLdgCz8GGWgBIbC6mDZV3M2v73IdL8RZKuM9tRDSHZL2w+Yj7YH73izqtdDaGkRIL7aIPN2poKn72RnArcYg2tA5hJ2APEpBkxlWIZpIS8DhFW9A2d7EUz+9V2RnPSFjWVwWFAkvarckJhrexsLcM7OFw2g64PEFf4pz5YCLpPwUjn89syTs/qJ1QPt1NSXR/cRc2MXKpMLQ+ZJrj25A0m3nPOdou8OAZ6T6X3Z28A== 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 MR1P264MB2147.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:11::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 06:45:11 +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.4778.018; Wed, 15 Dec 2021 06:45:11 +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" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v5 01/11] mm: Allow arch specific arch_randomize_brk() with CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT Thread-Topic: [PATCH v5 01/11] mm: Allow arch specific arch_randomize_brk() with CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT Thread-Index: AQHX8X9O5i5ZFBctQkOLkg7QNFqn7g== Date: Wed, 15 Dec 2021 06:45:11 +0000 Message-ID: <961336afce7a10ecc4e68021246772ee239dbc84.1639550392.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: 9802936d-ce33-4d4e-9e80-08d9bf967153 x-ms-traffictypediagnostic: MR1P264MB2147: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: vgZMCLDyaBr5fAUJrqG7mHoFcsTqwsG69NZeV7AgWsafI1eneMg3TtQEd7Sje1YJtP8euJKncXHGpz1PTgpTl8vebx5j4O7XmChijr1SpTpXbad6oYDkN/1rRaMuFHjiy2ieghKn7wRspU7JXFwNGE1NBBBy1dI8+XSS0GLYRapEvtqGBDn3NoC/xW+FQpxPc2UGATyqNY5bZSfObaALXmxwAOzT/7DNC2hpytLbKcuTQubvJy25WPsf2OVtAfEAXJJBb3utxsnnk2/GyH/A5050K8jwdtseSSCQGwzykEVV6Dd3SM20GpotV/t7UKvOZM+/x09ltd4sd1FmRHqAHNJM0QfeMlU7EemYYsQFPNzlr16CQzHJQCGQrkAqtMz052hnVODvBXPd+gkvUI9pXjfNAZE+YB84hlHF0URcKtMNwQ2cdZ2ph9eYzlxrSfaKC7j6r+smr0oRzTyytqrWlSyyLyPLcOTk0mROV3//StebX6uH9UUbMmj3pf6qixq/CIymZfE/v/kxE8qayxD1r/Z0Y4ijTVUSuXjVqLBt7B3hXv0fwiIQQaaKqRpCcRdf1NjD++UtVm/4Rqp0j/F39+QYGzVJjcnrCiwPL+BJuP7BE7FpQjlAZeJPlI5FqgXqv3DoRs6e02AIB7FlHVs+yt9ry/dmmEfQXEmu0BH1S3OneTQgosDpmR+OBbiCh5YD6jJ2Jwc/zzfmWo32xKNmpw== 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)(110136005)(36756003)(6486002)(2906002)(86362001)(5660300002)(508600001)(26005)(186003)(38100700002)(8936002)(44832011)(54906003)(316002)(66556008)(66446008)(66476007)(64756008)(6506007)(76116006)(91956017)(8676002)(66946007)(4326008)(2616005)(4744005)(122000001)(83380400001)(6512007)(71200400001)(38070700005)(7416002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?oR2v3J4xwyotNZVkC5299Rp?= =?iso-8859-1?q?izXG6DXXGn5dY0nBZwaUfG8P5kMEWT04mzcf/9/Tj427PTS6ig07zUM1mG83?= =?iso-8859-1?q?ScaBYCj6MBKNfiZ/kRz2DLNw6QbX/qWd1AqKs2exPx/1+Mv49Siz6PLKCC7D?= =?iso-8859-1?q?6isOCX7L0OB5P51dwtyOMc1QCZbgxUEkzNRbsstqtRpSfS4NUBpHtsHmcHQh?= =?iso-8859-1?q?9Dun8/Cg+tPd1FxYEetgpiFiC0lMINUA7hBhjHmb5Yt86XPJOiclNK++F3ya?= =?iso-8859-1?q?uwHERQumadHjFFSMz3gMn5VHh8L0+klMZK4ZgIhSIIu6FF8noY4RJh4ukU3Q?= =?iso-8859-1?q?ElQY+Nx6V0J9rOh1qNA5PcH6ns0j3AT9zTQPCD/YpJdHNT8FgxZehJY13E8I?= =?iso-8859-1?q?/f3MiQ33XIKuYxw29eRxlJ9H7ELVyTwGC3ZpE0EsPx/CY5m8mKM1TJF6gbMz?= =?iso-8859-1?q?g0KRvmfVhMDWa1CULffVJmoprhia+Vfo+VWfaK0/6TozA23A7qYBp8O5pPR5?= =?iso-8859-1?q?AybFitwH4v++x2TLlokoSURyySVxr3fvo5ZIH3VU67E4MiRKpfbAB6zGerUB?= =?iso-8859-1?q?OoldyRW7fbvYLM5DgipJ8S4qbzKlMBLoWKcoTtH0PgZeMnPShsWLRQWDc30R?= =?iso-8859-1?q?i1Ics9dbwAFvJKwYvbuMkVv1Nanfncm/4b9TOsDRAO875x4v3/YJZgh0qgxi?= =?iso-8859-1?q?1xodWuj27Ur34ud7CWJU6lHt+vA6b4a6iYExkytMBoF7kzW85Krjw9ehmcEn?= =?iso-8859-1?q?kQA8oUUbEzMemn3FN+hamsvrFtaxdQD4SrFjxJLFqLei3K3mt/e5smpCcl8M?= =?iso-8859-1?q?LSYLFiDxHx8lKHexgMV7LkmDkogpIJDP2aWD9Ct0P5It+rif8DFwJsB/epy0?= =?iso-8859-1?q?2CBsF3lATzw0iydZyNEDmbVb0SNseUx+3EOGQP3bn4IFAzv3v9jnGvdEZzyt?= =?iso-8859-1?q?C1xKK2xT18D1CkV97fBxUt5p7oQGq1Uq71lSGaZUipTrY4zrf4hpiqKsEmqh?= =?iso-8859-1?q?Md4UzmokxENVr9mmlyrnOyqIrSVmvAkDGFADHEnvGzUj9ADCShSySsce9G7m?= =?iso-8859-1?q?2+PFbCs2Tq9F9KhiXmm016H6oyqjetUP80pYyiieh54AcxFEN2nwdMEGaZ0i?= =?iso-8859-1?q?zd17E7+s0oFn6vYdXr4+uP/mcBTxOXbtQuaAogdc09zEucWZGk9SdaCP33j3?= =?iso-8859-1?q?mhVQ194+STxFA++wLc4yf2Mr0d6BWG5BEMWhd/dK0lUiPVGkMOaYf3DWqknS?= =?iso-8859-1?q?7QO7h/iszB1rIVqRAgnTi+x9VAF5R22GcnaoelivWXBC9gZiZEXjkzD92uvd?= =?iso-8859-1?q?khHb7Ta2oApAgr9q8Evx7b1Ewg7eUTjF4SkF24/lZri8xOZEfHXIxidAWIiu?= =?iso-8859-1?q?kFJvAhTa9hrDa5i50EIDvDWEgyShhQd2HK/ivOlTbjUXpNLh6ahNjJWCUbF1?= =?iso-8859-1?q?CSDUc+mMSbYjHLW5a0dOCChU+7oSrmIQ5FnAQtqKILYPb3zUmMbxkrVL0c7a?= =?iso-8859-1?q?PbmIWtEyvo5k4cQa6aSCptwrcdCMThiorXdrJFELzOVehzUhbB79rQQ5j/tH?= =?iso-8859-1?q?tXN/9OuF1MEYSDNrGqaUeHMiF01UA3vv9cjWsN4kGdmm+HVeTBw3oSateGk8?= =?iso-8859-1?q?CFeMj1eMI1Fjt9eUEn1+u/231pTDXYZuq02hiG6BKxLF8blcaJN2keyRJN4q?= =?iso-8859-1?q?bBVZnuAFIzihuyHZSadM0sdzlOyWqmYAo6hE3oeeu5njX3FP4sGqmJY7+4IC?= =?iso-8859-1?q?uGuA=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: 9802936d-ce33-4d4e-9e80-08d9bf967153 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 06:45:11.2739 (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: ntzYLw0v9+dVumhMfq5NO7Yf2/Bz7N8g++LaODTIdgpVsGOsB3O+sZ9XdoqRtbeZAPY4tcRzYp5pEsrxOkc2kJgWTQg80q7QrJuaCW70lb4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB2147 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 431CA180006 X-Stat-Signature: tnpttksxyue1yojhtekh45w55bt9gt57 Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.9.52 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1639550713-316256 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 15 06:45:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12677569 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 75A9DC433F5 for ; Wed, 15 Dec 2021 06:47:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 21BDF6B0075; Wed, 15 Dec 2021 01:45:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FCE86B0078; Wed, 15 Dec 2021 01:45:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 06B0B6B007B; Wed, 15 Dec 2021 01:45:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0164.hostedemail.com [216.40.44.164]) by kanga.kvack.org (Postfix) with ESMTP id EC6716B0075 for ; Wed, 15 Dec 2021 01:45:27 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id A67FE181AC9C6 for ; Wed, 15 Dec 2021 06:45:17 +0000 (UTC) X-FDA: 78919091874.13.EAE81E4 Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90052.outbound.protection.outlook.com [40.107.9.52]) by imf06.hostedemail.com (Postfix) with ESMTP id 408CD180005 for ; Wed, 15 Dec 2021 06:45:16 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L26RWQ+lQWj4Uf6msk2qFfZ1efxYSq1bJwBJcxe2/9pPL6S4K6kSczaZesZL+mWEPgTMgXHKwfEh7d9XL/deUnIHGVpUXztiFBc3UhEAi9SWp21QUj3RVqlJvABb1jB8b0o7/D3uO+9WSiHv0Vb69BWgKhxI+D8VsvWTi32byMYBzUK2NkbbyDmgnBWGDEBpQj5Rx4/wCFyh3R/YjI+Myes3mnoxu/BmbetbSNSucqw32mfQB+KeDuPiwCaZ96yqtDIkhm3Vnb2vNnGU9DpbdbxfV74wWCaNgzGeLP0rwTIzrhTVUkcc/XXtV38I/ViNSe3zt67aL9YedeoZ+I2OGw== 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=KuKZ8Pp5OoKCaatHC4wZ7EyUM5TYF66Dvkuh8U4yTxw=; b=KWYJKaLMIi+Tr8qVHZilElbLcrcJdFvThP0bc3kcyTJUno0ndLrkqX3hEgv7Q0RfqIR8VC83PVOtP4zJF07Ertmg/xJVWcO/oStPf39UZ7JFgL68//de/WMht+Q4Dxh70HsizGTyJTCj/DT/QyywgyvAJgQyUH3jQKkpr82xvEbIBeBnCAOj5EY89s8mzMA5vKD19HetsZB295ICSDLlrmqCjIVYqgdJFvytqMb50haAR0Am0H6OFsJiIehnZznhb/cPOAhJbAHeKj+hZJU0sQjfT3FgG9tGtyrN6tfUY2ZGmCOKH0lw46lZFgfQZMzo5OpvR0CT/3jDFs4wwGlPbg== 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 MR1P264MB2147.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:11::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 06:45:11 +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.4778.018; Wed, 15 Dec 2021 06:45:11 +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" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" , Nicholas Piggin Subject: [PATCH v5 02/11] mm, hugetlbfs: Allow an arch to always use generic versions of get_unmapped_area functions Thread-Topic: [PATCH v5 02/11] mm, hugetlbfs: Allow an arch to always use generic versions of get_unmapped_area functions Thread-Index: AQHX8X9OFivBvoz9ekm2yhHkjqMGSA== Date: Wed, 15 Dec 2021 06:45:11 +0000 Message-ID: <50d176dcf3942894a8dcbc42b7b767b065df9af0.1639550392.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: 890d07ad-38aa-498e-e067-08d9bf96716f x-ms-traffictypediagnostic: MR1P264MB2147:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: JuLIPca/In4EmZzAm9LN26YXx0hCc+rrT7QWQfWK5ICRyHg0u8TcuC4iBFZ+Pv/9I/y4s53EFYqYdiEqLyUoJOR6g8u013ThutLoI1v+orSk4Xy0yhG5lSigtAWlOHnrxhPl4a6ekc1iz/98EOFMoxmzhrFDr5MUNXMvwPmH7No+Le9w4UhRzL2WWIXqNMWLA+RgoZ5rJt/8Sj0+Zhcn/Y6iq7HWJKPU/H7Vno2ZEycKPNUPgxV0i9wbrTN2GsWgqTOhTxCLrb5xCbQSMJJ/kaHn2LTNmLLzjj4YUQRTR/rf6WSmb//U1d7VoUHifvQhTYI4UH40AvLl3cpvS6Pagc9xFJ8FCR9pCoj9r42ivDD1AVbaDjXb9vn1EAkTkFrXFjXdT7BV5JatVKgFZ0HCu8TrWWYo86RkJXHCqm7DKycYgHGJ0CjwqclbB2ATcDHodUd+V4nV3mDpgcX6fMfcPnN+Xa5hdfPwh6InrSCRS/ew7Lr50N6VORIyF9uHRmAp09QMwhdxaYq/lY1mKspzNZVydNrNh2NKFyj0y2ob8/jH4e8zTvnDptUrT+QoCv/Cr8mJxrYesv6FYgeqG79JItg50QbR7mSTQsXCPMdLGfo98DMTKzcMRu6T75ke3mz66MDS2Yzrehf6ExYoCWJYKtfFu0o0Ls4bI8DuKwqWVLiohhkmGsdO7uxbSYMLDsgTbHdTlVZTwxs2MQt2lrYS/XzGtqREeW8SIhKYut/5xQY= 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)(110136005)(36756003)(6486002)(2906002)(86362001)(5660300002)(508600001)(26005)(186003)(38100700002)(8936002)(44832011)(54906003)(316002)(66556008)(66446008)(66476007)(64756008)(6506007)(76116006)(91956017)(8676002)(66946007)(4326008)(2616005)(122000001)(83380400001)(6512007)(71200400001)(38070700005)(7416002)(41533002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?9WpF00yis3ZLCq3rB3Sd8Js?= =?iso-8859-1?q?aXgR5VFp5U6svB/ofSrDDJpsHWe+WxoRIm0C/LTeEfsw4sCI+8+r4QezgxJ3?= =?iso-8859-1?q?a5WxzO7u0LQUgLONX4H6V8/YMSQtpch2Vyb+cwVVjBKMQI3ukY5b6dK/XkD2?= =?iso-8859-1?q?djlUZg/DGYr8j7XTglcUQIws4zDT5kdSqEjdR+KC/fsmsSUIqBMRpmKLbo73?= =?iso-8859-1?q?ucuUkG6CLyLHLMkiExtv/RL9md8uVmO5XPS5A84LSfCQp8vzP0Rb4TsteIaa?= =?iso-8859-1?q?LoA/YOXXP8fz8rTxrXrPUFFzWgZtMrgJpubT+c513z7oAQQahCD3v7An2FxJ?= =?iso-8859-1?q?zNi1oKudNaHsifVCzybhWS2B6aIq+KNn2RkOOYZdAzksg0/IioNyeBkalxvz?= =?iso-8859-1?q?XROdT0ecTXOn2gbxf85RaArXIE06k/juDz4mfox2OISTjfSCqiO96a8zP5dL?= =?iso-8859-1?q?jTElcDd0dNamaA7Gv7cG/hiJ96GfNS5+YFAf66UMbV1BCA56Pwpw/qXB9s30?= =?iso-8859-1?q?jKVMBlYZUAdPJ8uKtCtZsJvoAYhK6dlgrvRy5CD0uMGch5kBowST1bfc1nT6?= =?iso-8859-1?q?9WHG3CgSNX7zriAwaKZw8indy+aDtEtFBFI2cYjZtsgkUiryr1Jon9Z/bvKE?= =?iso-8859-1?q?7rQzPb5O+JCdwwDry1yxuBgChDeg9hKviDkNEfahkP6bGoZ2wK7KVFY/DKum?= =?iso-8859-1?q?yFtUmiRVdghjAXEZS8PPX+rhQspVbMxTfq8aXct9KvezTHDx4s24YTV0iC2q?= =?iso-8859-1?q?0C765CxrPIR9XBkyztlsCmDDpoz+vk3HvGfxJIreFPFRpbHkU9vJ+zQ1U5xh?= =?iso-8859-1?q?7XUfXc3iheqU2a/pU3AEKyOSxkoAZU3gj04shQvLd2LWBAu4ODDQel40Vbiz?= =?iso-8859-1?q?r+MlxMUK4ze2z3aJZLIYb0tRU4UfO+xre4LiR/HRDhtJl+4OTzpRb5aJ/SIC?= =?iso-8859-1?q?IsYi7zhVH0ewGFPHbqEcXUDKv5vjvxyfAnJG5OXLfZ+V3Y/Id0z/0vx1Hwhi?= =?iso-8859-1?q?1VL7VGwFbwFDQFXb6WXojif+98xAkifwsSZAWr74FuOr3D1PrVYBGh65Tybv?= =?iso-8859-1?q?tORH41xzY9p/zgpGPeFZuZ9tl4zmIe0VONHiwvIlE68eFq3YPE7bE4waMqCQ?= =?iso-8859-1?q?r6PN1zJ9shozRP8PcA3TRrdtCT7/hwvO3S6Djy+syWLJKk9nceITRWwqHN4l?= =?iso-8859-1?q?TzHH9uIsHOSr1EKgdrienNrL6557J2L6W3qu1veF8Oc2Ov6MSN9dbTybrwvG?= =?iso-8859-1?q?IUxHUMR28YjiiUPRgklJciV5EmP/gZCAPL0dxN95+6plNNx8PFwnAcVRFwzv?= =?iso-8859-1?q?z41aFpUCUhcuWu/lXX9pazXQ3LYuo7ZHsbZPPCGbvn0apMYI+SG8guR9Tb8E?= =?iso-8859-1?q?MbSFQk0yNXN39WKZuOsSe9LzkV/Nqzz+w3WDK7htwbFZLBkzpYXHX0Yz1q84?= =?iso-8859-1?q?v4I7TJUh50P/uLFhLB0Hmh7HqJjTHa4r22a0rleSwupACSwj8k1JUjSLD+Ua?= =?iso-8859-1?q?hpvhF2YYHmPZgT3yL2+d1iIVmUHo+O5smGqlwfwR5pBfhkVJMl2fKLSK0Pfx?= =?iso-8859-1?q?iGdSzPMsLWaahxWpJRzsIrqd+Bhqal6nouNPbUXAoG0m5eRYM7L0MwrxjAvL?= =?iso-8859-1?q?TPirN5J2zAhFttUL+OcPA/3l6uo3FTP6z4rA3do7HAtDUyInvHxkWmLdIKKC?= =?iso-8859-1?q?NEh+D52fHsh7mnTF9fHzAKunZtigG28ZM9xgBPKZk5efZXeksoaQJqbLBpor?= =?iso-8859-1?q?SPTU=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: 890d07ad-38aa-498e-e067-08d9bf96716f X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 06:45:11.5387 (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: 7GtL1reS3uDvvkTRL5y04udJbcv6GijHyRkvexwyJPsR0Jlqe69MnRxHaBIhnIxJvvdedDuD3kH8tEwmdoMeTYnmM6Wg5vOa9fy0J1WWVLI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB2147 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 408CD180005 X-Stat-Signature: izhwim5eyhqsck93odkqsbdu37cm7mfo Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.9.52 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1639550716-422252 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: Unlike most architectures, powerpc can only define at runtime if it is going to use the generic arch_get_unmapped_area() or not. Today, powerpc has a copy of the generic arch_get_unmapped_area() because when selection HAVE_ARCH_UNMAPPED_AREA the generic arch_get_unmapped_area() is not available. Rename it generic_get_unmapped_area() and make it independent of HAVE_ARCH_UNMAPPED_AREA. Do the same for arch_get_unmapped_area_topdown() versus HAVE_ARCH_UNMAPPED_AREA_TOPDOWN. Do the same for hugetlb_get_unmapped_area() versus HAVE_ARCH_HUGETLB_UNMAPPED_AREA. Signed-off-by: Christophe Leroy Reviewed-by: Nicholas Piggin --- fs/hugetlbfs/inode.c | 17 +++++++++++++---- include/linux/hugetlb.h | 5 +++++ include/linux/sched/mm.h | 9 +++++++++ mm/mmap.c | 31 ++++++++++++++++++++++++------- 4 files changed, 51 insertions(+), 11 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 49d2e686be74..c7cde4e5924d 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -195,7 +195,6 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) * Called under mmap_write_lock(mm). */ -#ifndef HAVE_ARCH_HUGETLB_UNMAPPED_AREA static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) @@ -244,9 +243,10 @@ hugetlb_get_unmapped_area_topdown(struct file *file, unsigned long addr, return addr; } -static unsigned long -hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - unsigned long len, unsigned long pgoff, unsigned long flags) +unsigned long +generic_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; @@ -282,6 +282,15 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, return hugetlb_get_unmapped_area_bottomup(file, addr, len, pgoff, flags); } + +#ifndef HAVE_ARCH_HUGETLB_UNMAPPED_AREA +static unsigned long +hugetlb_get_unmapped_area(struct file *file, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags) +{ + return generic_hugetlb_get_unmapped_area(file, addr, len, pgoff, flags); +} #endif static size_t diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 00351ccb49a3..df899d1937ff 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -513,6 +513,11 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, unsigned long flags); #endif /* HAVE_ARCH_HUGETLB_UNMAPPED_AREA */ +unsigned long +generic_hugetlb_get_unmapped_area(struct file *file, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags); + /* * huegtlb page specific state flags. These flags are located in page.private * of the hugetlb head page. Functions created via the below macros should be diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h index aca874d33fe6..2584f7c13f69 100644 --- a/include/linux/sched/mm.h +++ b/include/linux/sched/mm.h @@ -144,6 +144,15 @@ extern unsigned long arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags); + +unsigned long +generic_get_unmapped_area(struct file *filp, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags); +unsigned long +generic_get_unmapped_area_topdown(struct file *filp, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags); #else static inline void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack) {} diff --git a/mm/mmap.c b/mm/mmap.c index bfb0ea164a90..7ac6a07ff382 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2131,10 +2131,10 @@ unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info) * * This function "knows" that -ENOMEM has the bits set. */ -#ifndef 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) +generic_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, *prev; @@ -2164,17 +2164,25 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, info.align_offset = 0; return vm_unmapped_area(&info); } + +#ifndef 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) +{ + return generic_get_unmapped_area(filp, addr, len, pgoff, flags); +} #endif /* * This mmap-allocator allocates new areas top-down from below the * stack's low limit (the base): */ -#ifndef HAVE_ARCH_UNMAPPED_AREA_TOPDOWN unsigned long -arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, - unsigned long len, unsigned long pgoff, - unsigned long flags) +generic_get_unmapped_area_topdown(struct file *filp, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags) { struct vm_area_struct *vma, *prev; struct mm_struct *mm = current->mm; @@ -2222,6 +2230,15 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, return addr; } + +#ifndef HAVE_ARCH_UNMAPPED_AREA_TOPDOWN +unsigned long +arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags) +{ + return generic_get_unmapped_area_topdown(filp, addr, len, pgoff, flags); +} #endif unsigned long From patchwork Wed Dec 15 06:45:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12677571 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 22AD8C433F5 for ; Wed, 15 Dec 2021 06:47:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DFD6A6B0078; Wed, 15 Dec 2021 01:45:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D62C86B007B; Wed, 15 Dec 2021 01:45:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BDCA76B007E; Wed, 15 Dec 2021 01:45:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0077.hostedemail.com [216.40.44.77]) by kanga.kvack.org (Postfix) with ESMTP id AE4826B0078 for ; Wed, 15 Dec 2021 01:45:28 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5E15288CFA for ; Wed, 15 Dec 2021 06:45:18 +0000 (UTC) X-FDA: 78919091916.25.A98BF26 Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90052.outbound.protection.outlook.com [40.107.9.52]) by imf06.hostedemail.com (Postfix) with ESMTP id E1F2F180005 for ; Wed, 15 Dec 2021 06:45:16 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q6XPFFXkn4esYJms9++Ae3K35reubOxu5damKv86UG7G0+hmqns2UBPWkjjDik73I7WH9cIrbcrDd+3LMPMxb0WZLxRlvxqJ1CiY5jl6sbYaUMhfIsFq7pC2HByiJ4vFztykDkBrlPImtmEzrPxYcsOM3RdWU5hwkLE90B0qID1qV4LfeCzvyz1PSu5ozWAmNEfLfns84fvzvLCaHX+P/13V1KRecmJxUXLD6mzX5QNgEmGUkeZiVFT8DSsPXkLOswPO+wZKbLrcxkXqrwGJ+MikSxPQmU0bocayOb+ygPs86vLU/sbFpvH5aWpbchK0n80u8XRsmzjgx6TpKJuNMQ== 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=Tfg0sMAM8fxxdC6eQ8XeK/4lMWH8vFXyGKrZdrW9Uug=; b=Y+4mfNngXHyo4WSOk8m9ZxUx8RX/+HfYW8mW1mtcOt3js28zfuyKZdQ6uDX4l0lrms51uAFVoopHtb+UDe14lv+DID5qxPG4AiymM2AC/k0VJRYbPpqv2UTV6gEaLiihJJuuVwC1A0B9EculCDsxM2wmCgmpa3DapwoIy2swz66NztEhm256L4g8f1pkR9mQIRNXQS9CuqbUfSEZkXVOec4O6iujFHSwA6Ak2aSsh6+sh6Ia2h0FdVwSydEDqFdsx8YIAnVcIXOuNpT1E+OSHwdL0xzbd+AQ08M3a0tst5eikKI3KQ2h/4zYocPCcCQ/GvRnID6KThDpbwr9jY7ZYw== 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 MR1P264MB2147.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:11::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 06:45:12 +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.4778.018; Wed, 15 Dec 2021 06:45:12 +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" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v5 03/11] mm: Add len and flags parameters to arch_get_mmap_end() Thread-Topic: [PATCH v5 03/11] mm: Add len and flags parameters to arch_get_mmap_end() Thread-Index: AQHX8X9OeEFvyNlKhUOga6+NHQS3mg== Date: Wed, 15 Dec 2021 06:45:11 +0000 Message-ID: <38f7d0c0e67c8bed3b2f4326339a8ee18fb7daca.1639550392.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: 98336235-f06f-41fa-6ffa-08d9bf96718c x-ms-traffictypediagnostic: MR1P264MB2147:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3173; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: jbDjX/8XxNQscKX66rOK7W9/b+8JTjQUP8fJdKK2bgRUu7aj3Gu2WM1O2Z2Nj3EyCCSIw4z2vArFdjYf/ajeAnxEg0IGSRNSraPoxXZxNDC8tnuuwBvrpC4u7wYTrv6K5XuP8relaOQY0Cj7yv3xoSB3iO887Ik8u+adFjj70UDD/MfF7IB3xP7oLBmWZ/lg8jntQYU8/Zrz8tH7AqcPKVs4E7GxVP0BbUDMs4aRN6HoENl1BwHvnwVWvOGV2Y2L9x0hPi2meoU4Obl/4L+cSue13Lf3b1PkzVC0LxQJhOs9kNl2g6x3VzNxYdF1vI/ggiq8lUZwVWavSLL/H3l/o//X2JcQBOSU3O1TuPVWMCVOcIzHCOpP8R7quF+sHC/Fz13sXeTzpe7cPju/4WHzQJb9Ym1HNgJECllbUWB6z7At0p4n1L/8DDtGWbLFWTTshQcb2Xo7dgo56ZfN81YEH/RA8/pA9tifJkjTvTPdZWRx4uREBRQQslR3dwEcZjoIqTG0S5pguqIvSYsTW7ldJQjUFsUOqAtappi70wrdbpo+zDW3Sd7ZPTNL48k10QrMcTp9RRHIYGeLdy4GSJv2vTL4WVeoWSBdTXXXKnME9j5XVkgQkdmEQtrBK4wej0Ijau0+qi/Ct8sTzOMb22CUVjCCKH9DXqP5SwHAhcaPlLCJbxCjJP9JM/G9bm/fbmkgojTNKYbJDAvupdn0o26vZg== 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)(110136005)(36756003)(6486002)(2906002)(86362001)(5660300002)(508600001)(26005)(186003)(38100700002)(8936002)(44832011)(54906003)(316002)(66556008)(66446008)(66476007)(64756008)(6506007)(76116006)(91956017)(8676002)(66946007)(4326008)(2616005)(122000001)(83380400001)(6512007)(71200400001)(38070700005)(7416002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?GNTY9sBA5lGs4puKtE6ddAP?= =?iso-8859-1?q?QXN5pTys1pNbuxysICUQ6pxx6zb6QeI8KqCG7Y6IVGflsR0MABOq/2JBSbiV?= =?iso-8859-1?q?/GfA+8xXP5CGarzROZKAz1cvEXYtUuZZiOAzM21Etd4rmphnMsziyErl+TDI?= =?iso-8859-1?q?2qfThN8N8TJ7bWL+ctBSCE/4wIzz06mLHAc7Lvko1RLQZDO5DsFb9fw/saIC?= =?iso-8859-1?q?EvjqH7Rf857Mr1YbLt+h+yhQID5chs3sxUsgjqwVeIrUt0YjsK/tlIdZUsoe?= =?iso-8859-1?q?nUJuUAhbH47vmb9FIU/o3PqpYlqggaycYFK+RdJ+tclHXj/L8MUQxsL7F/AX?= =?iso-8859-1?q?NrvrJd11/No3WZYPbcyZH4m7oGFhTedkEYmPL9OtOOmUOnyW26mKE+GI+WYD?= =?iso-8859-1?q?981ciECzxmhHcMxRnyoJhmfKgEwyCki6BNINE5GWrFEfBBomX8ZL5JyU3lks?= =?iso-8859-1?q?Aqda9keCkkscIO2jgxnNG1Im95z3lw85BFqA0zyw9kdsAF/5wgTHeAuL6Of0?= =?iso-8859-1?q?Es4q+YQJB3BHInYZi4IByjPiQsIT0zkv8+Un112aLg8k0MiBObeNrpo24Qyc?= =?iso-8859-1?q?YH/Vu44o7ECffa1R4rgGihhaPNs8jw6Ov6UR/3YnXKunf/6q6VjlEs04NvfO?= =?iso-8859-1?q?8zkTDQK9yKZPveflQ1pCRMKnuu/3vuYdKl2hIRkAlAi3goOTjNNK4f+FBndL?= =?iso-8859-1?q?iTKxGKj/QxDnDIlUDz/KJLXkG/H5zlJqx7G9c4uccVo2TxMLyhlZQeyCcf+p?= =?iso-8859-1?q?pItKDKaUnHPEk8eTVKsPBnyThlpLvuNWVG2uaIC9uHx0K9MMmJRNGKXTORaz?= =?iso-8859-1?q?qo1p0qCiqo3vTlJq4ME1zTY67p9j43p9+FQSb3mBO5QS+j6htrH6+Z+FooBL?= =?iso-8859-1?q?1CwlTR/EXqJUWPUoUNLZ9pNOS2Et50JFw/Nsm7WQE1a8eLnuv+2/tPjMQqgZ?= =?iso-8859-1?q?Uvuiz4cZHLkX8E1KfFXknWTEMnl2yWKfQlgLtRsflRiXaKS49gqk8zUblCXe?= =?iso-8859-1?q?QB7PF2XwbfQGrLY68YFKTlB/EvmZoVbKsgELMIKda74KNhiU5/3Stc29K2im?= =?iso-8859-1?q?11oDMXr81cYid9L5pjlA+6SW0thXOwDO1R7Wro0+77mNdX7PbNl4ibEZhoj2?= =?iso-8859-1?q?07I6vpCO/FRL5k0tBjm6SgZpcc6emFP0W/mhU4bsdU2pO80xlU76eVpzlNxu?= =?iso-8859-1?q?fAvCOAzyA3yPAtR/2XfVGQUH9bXaVTeRJZYk31pqAATC5a3YA62EGASIXLVN?= =?iso-8859-1?q?N6g6ZI4sYkX7H+9NFVtDNJBH4D+PLklLTgL9eLLerXz9N2yi9HNV4W4FxBob?= =?iso-8859-1?q?TAHWgkOM0a+hvUpFKp/pbuMq3rU417mvPevNvyB4ZK79OL7U4gFGrClFjXSh?= =?iso-8859-1?q?JwHPSfMAlaXx1NCpMg3waoE26cLyBd1YYCVV/U9T74MgCZtJfgV2Z4gDsvl6?= =?iso-8859-1?q?KtHyW3AU8bH7O+sLJts+VWzMc2yv5+T3/YFcIKBAojEr1lyjpoDfaxZ2fMHr?= =?iso-8859-1?q?XjHibQ931IF1tLJ8774qq4arDPf6ZyBgTHwuUn+k9V0ZYsakYs2wNo6wtvHP?= =?iso-8859-1?q?VHnI0nZ46BW36iclFHIOyaLpVCZYK4WlQXqoSTE37nbANy16QrOcH+trx9G8?= =?iso-8859-1?q?2puGdAFN+lMgLlOtox3uIBD6mu74ZsoOzvQC8f2Q0DIs984b6GWrcgUaDFVb?= =?iso-8859-1?q?2M6VtaFh3+th3qkDzak2L0FkCPr1EsvM/IVqHmy5FF9vh09vT1yDZ5qzVQ1h?= =?iso-8859-1?q?FjIM=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: 98336235-f06f-41fa-6ffa-08d9bf96718c X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 06:45:11.7846 (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: cy3fnxGmn7nkI312x1S6rHS+dFqzIX8V+PpHPkV4u2cLe5K1NvpIasM4L9cSbg+ao8aa7gzCPZEbgrd0v0NcP406VF/mMVrJOPQ3WgDCDzA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB2147 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: E1F2F180005 X-Stat-Signature: 6eqja3mspmxe93dn9ca1c7qsbufz3u6i Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.9.52 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1639550716-144596 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: Powerpc needs flags and len to make decision on arch_get_mmap_end(). So add them as parameters to arch_get_mmap_end(). Signed-off-by: Christophe Leroy Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/processor.h | 4 ++-- mm/mmap.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 6f41b65f9962..88c696350ace 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -91,8 +91,8 @@ #endif /* CONFIG_COMPAT */ #ifndef CONFIG_ARM64_FORCE_52BIT -#define arch_get_mmap_end(addr) ((addr > DEFAULT_MAP_WINDOW) ? TASK_SIZE :\ - DEFAULT_MAP_WINDOW) +#define arch_get_mmap_end(addr, len, flags) ((addr > DEFAULT_MAP_WINDOW) ? TASK_SIZE :\ + DEFAULT_MAP_WINDOW) #define arch_get_mmap_base(addr, base) ((addr > DEFAULT_MAP_WINDOW) ? \ base + TASK_SIZE - DEFAULT_MAP_WINDOW :\ diff --git a/mm/mmap.c b/mm/mmap.c index 7ac6a07ff382..ad48f7af7511 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2113,7 +2113,7 @@ unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info) } #ifndef arch_get_mmap_end -#define arch_get_mmap_end(addr) (TASK_SIZE) +#define arch_get_mmap_end(addr, len, flags) (TASK_SIZE) #endif #ifndef arch_get_mmap_base @@ -2139,7 +2139,7 @@ generic_get_unmapped_area(struct file *filp, unsigned long addr, struct mm_struct *mm = current->mm; struct vm_area_struct *vma, *prev; struct vm_unmapped_area_info info; - const unsigned long mmap_end = arch_get_mmap_end(addr); + const unsigned long mmap_end = arch_get_mmap_end(addr, len, flags); if (len > mmap_end - mmap_min_addr) return -ENOMEM; @@ -2187,7 +2187,7 @@ generic_get_unmapped_area_topdown(struct file *filp, unsigned long addr, struct vm_area_struct *vma, *prev; struct mm_struct *mm = current->mm; struct vm_unmapped_area_info info; - const unsigned long mmap_end = arch_get_mmap_end(addr); + const unsigned long mmap_end = arch_get_mmap_end(addr, len, flags); /* requested length too big for entire address space */ if (len > mmap_end - mmap_min_addr) From patchwork Wed Dec 15 06:45:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12677579 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 314D4C433EF for ; Wed, 15 Dec 2021 06:49:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F3A686B0080; Wed, 15 Dec 2021 01:45:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EE9EE6B0081; Wed, 15 Dec 2021 01:45:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8A136B0082; Wed, 15 Dec 2021 01:45:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0047.hostedemail.com [216.40.44.47]) by kanga.kvack.org (Postfix) with ESMTP id C887F6B0080 for ; Wed, 15 Dec 2021 01:45:29 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 95D6F88CFF for ; Wed, 15 Dec 2021 06:45:19 +0000 (UTC) X-FDA: 78919091958.19.2777EA5 Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90073.outbound.protection.outlook.com [40.107.9.73]) by imf25.hostedemail.com (Postfix) with ESMTP id 0C784A0015 for ; Wed, 15 Dec 2021 06:45:14 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lnG97ZFN33XVoAaJu0/GnQ6P0E3o55fCFVeYjFbRrQlDyOj7L5YEo+bHelwyoiz1IgG9fIonYK1F0SQffQXHTKx5Ixoust7SNS011T/2p1jArTAr8UaAd6obLMnqjlAeWXy5E6tx3U+8Ej0M6h5dikg50wMM9w/emUkhynlPkwgXu2jIPoPCi6mLy5Qm1nK4j291vgmcE/pj3O4YgZyR0MKXhsAvx+oq2YxqYdiF7jxyCAGJURRF/YMbm7Rao2YuORXwrUT3uyZg0oWmRSXUshQOfK6ZreY9UdaCbwENLAOB5i4VTPo1PVsKPxOlusrc32++iVML4oPZ9VFLi0tr/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=RiZMm9KXXy+vu3WhUEQeEWc13H9a8TPaQVYGQB2pazk=; b=OSwqm10CFywLCPWz8IJaoCZFYx4OZ+Dft3P+TBbZ4U3RZPPIfrfrG/kL40mg3qWRv/limHK8sBUtxdtg67X68XkQmS+EH0kBKEdG1aEOFwxMnJQFha5tdbdrWI0SnLR7+mYKEsgKdvPnDY/uimBObH6Hhvg0uo7sq0uE3pcvxva8M3oWAZi3VDUiQuqKf9Gigy5+chgmpfOrF/Ww0f/pKoDewQIWlAFspVR2lEbdo2YWDTWINPOkl59vA1RkzBeiaCFJGph95SqS+vBKHh9Ymv4IRQ2tirxUuWM8JMWYRXGcChpQRHNJSiUnK7Q3owN0+nnymN+/YQlCHoJoSvcsRQ== 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 MR1P264MB2147.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:11::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 06:45:12 +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.4778.018; Wed, 15 Dec 2021 06:45:12 +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" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" , Nicholas Piggin Subject: [PATCH v5 04/11] powerpc/mm: Move vma_mmu_pagesize() Thread-Topic: [PATCH v5 04/11] powerpc/mm: Move vma_mmu_pagesize() Thread-Index: AQHX8X9PPZdDlwkiyU+pusM+LAK9oQ== Date: Wed, 15 Dec 2021 06:45:12 +0000 Message-ID: <99531e3a7cfc8a08d5ef4b1e8cbe21f117b4cb97.1639550392.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: acbc4297-c40c-4d53-036b-08d9bf9671ba x-ms-traffictypediagnostic: MR1P264MB2147: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: 0MxmKVBkX2CB39rdUdVzzRvcnTeSCri+stNqCeqHWg4OJNzYI5Y4z5lRgj6HeUSywaUNpRvrZod0n+n4TO8wMSMEmdOQJDMu6Iz8RMb0PXcg5888uBrSV+5zmSBNIDkyDZ4pRyUzeL9aF+J9WrFa6fTiJytALV9WQ2LIU6vQsHTpDjNSND/jHuo2rpSOpnwoE1n7bxNk/9R6bLg/eYkqYR5cXkek3YthlrbsXtIu4IFKukuCpfGV1X69bPhAnN5GREn/bsQQyp+RU6wa6tnl7jVJ5QoiTIUZKV3E7A8SWvYTjGy/yfKXje4ZMmPnVEvo86PpQIo82aGHexl9SL8JANAS2sYWf93pay+dKG/WhjnIGU/5gY4x8TbseXUfTXeJ5cZBROv2Q5Uvjdg1qYPyNrhS4Ow7/2mJ0kxEy2J4qr4UTTwlzaAj+0JABmKYl7gQVKy5ZfxELKMndMi4tIWan5IkvwGibQw9VD3+Jst2eQUlxt5XZbtxz8JBRc05J6dhgZ1vg0WLB95VsTeTcDve4ZBomn519VJUyK7tfkpn2nK6v+ZDnYEXbYYvuWKqC+9h0mPQEVYkjqAhoWM9EzXw7Mk63dE+a4WTs2yyKzi8+TPCpkDF2ncsA2szO3A2zJg6EqDhfD4T3jPLY96ozrQQIq6GsMz11bMIhkqcG54gbXHFIsXeZ/I3ShWbp/fB6QYGqsYpR1mHSuxXdQ6Nu5veOQ== 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)(110136005)(36756003)(6486002)(2906002)(86362001)(5660300002)(508600001)(26005)(186003)(38100700002)(8936002)(44832011)(54906003)(316002)(66556008)(66446008)(66476007)(64756008)(6506007)(76116006)(91956017)(8676002)(66946007)(4326008)(2616005)(122000001)(83380400001)(6512007)(71200400001)(38070700005)(7416002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?OM5tnpvsMMCBZ1kXSgMjKwA?= =?iso-8859-1?q?Gi7jmsvrDzqSPpWLqdn5uG+FCp5hCnoAsQD/ZFXq4RVgVVv9bKpwj4OIFmH6?= =?iso-8859-1?q?7pLvAa56sXt2IJddWOlWraCcRgWtyU2JN21Im2hfJB6yQYWY8a87xrj8+5k5?= =?iso-8859-1?q?KPs5DpQki6zxSC9Llj7g6hpziD6O4O+yNhy/V9Iet0M6dkchFEjgUxspOj/l?= =?iso-8859-1?q?gyD4G0iKqCsBlGc6PCgXLlm+37GXBFoHZAdH7tOkAR222JWj6cyFarxQyiLs?= =?iso-8859-1?q?pKfGcjDIgV4ohEfc+kVWvZs4nAvejmYfQ5bjTH6tYfTwBKdgAz6AM1pH6D5Y?= =?iso-8859-1?q?+KsT3vuJ91vHBBq2hHjUAg1XRrsunzwGXi1LFLnEmv3ZzPToWJ9DYfvUKgP9?= =?iso-8859-1?q?CAtpDjQo6j9L07B4xkUQ1bB7o+zJBVgaaCTjL9olUqJJDZ0oPBtAYQvUEHCu?= =?iso-8859-1?q?EKKJ85aIr+OZ519wKKPi0D2OYcvuH/udXeSvajOqg6xAm1B0GSon64HW8eze?= =?iso-8859-1?q?4n7zW0lIaYvJnXCB9ETlbEjTKKJv/jEfL6leOLckRGEa3ODrSaYhL8V16Wjz?= =?iso-8859-1?q?sv6AAk969P9C0ZOCPgrWCc8HRxk6SC9Af/vNOSL/y3dxdBDL2XtTgsX1XPzL?= =?iso-8859-1?q?0MNqRxBNMMMIHhLZ90CiTCjx+jO1nj0RrNVQfYeqWm5lHFxDAxhTLrH63Qk9?= =?iso-8859-1?q?8I4WaMBAqgq8fc/w20p+WOujClt1zmdDiqUPTxDr4P8VygxY6xQZiw+H9mX9?= =?iso-8859-1?q?4QvcW6+OlVfUMQZVilxm1jzA8IrgrYEXmP7iEzRnVyGACsaJAuKIqoGNM6LB?= =?iso-8859-1?q?nmBAUSgYk3PCaMScj+3cUgxLXINn+RAXxY8OiJG3p89XaXHDDswEtaSzWvTI?= =?iso-8859-1?q?sXpN9GCwx2vGAVYwnKDlpSpsD+/ApKnSt735ceQ/eW65IbnQrSQPwgMI/erw?= =?iso-8859-1?q?sNMSoTMiPUaKuDnpqQSH+b0JBvoW458TxVEBtCs/e1NCy6EszI6TOHr7jD+/?= =?iso-8859-1?q?uVFsGMisBncpaD9u+su4itkeBkx0TNsFYGx6gCwI1toYHZ5fd0L6CmKThcZJ?= =?iso-8859-1?q?C4KhEy5pICdJHm/5vb4pZZkVSBMr0qOLGbI9lw02tfDjb7K7jhjnpFMQkMtR?= =?iso-8859-1?q?FcsGoBUniD7GPOBwkv+PbiiEgjFyscaz6jG+rEvf9DXIVSSCzo6YmC4WHLlU?= =?iso-8859-1?q?FuMM162jdG83WLRpO9P4V8rWzec0oJYsImEH0lK9YgMaA8aMI9v46LCwBzng?= =?iso-8859-1?q?MGLxzJblL24UGFeNJXVe6njat03bL90J6N9USDcdR27jZ/G8xSS0dXVuyiGR?= =?iso-8859-1?q?TVVgGNRLlTzt8OMe4BBK3mdCQ87MfxJjeGfI4bFEEDPxSqHHyB6p4S7Z0J0a?= =?iso-8859-1?q?MtY3otIwLiHNqrjdiEnvwKJyaPWZk7NHYm7kUK851rf6n2SixyHzmAa2y8qm?= =?iso-8859-1?q?4j7bfngXKJ8AvU6Ri39XBkb5AwuIpj0PgjdZs6fZRlbLoJ6dMEGg17pWRBlm?= =?iso-8859-1?q?VbGo1/Sb6KWm7wosfHWgJOfpQxlmqYZ+X3/w6+Wdn/dFMQNHmixJwtYz7BQ9?= =?iso-8859-1?q?zkb7Wqxazu3R8as6f2Uy5IHaTz4p+Guj3XIvzI6berLAW/66cMuy/Snx7m9+?= =?iso-8859-1?q?AbJSJhW0EKXQ4BmZ4LE7R2khipPe8z8aisUDJZIsTYDvASZ0aHS3wuDN7NOY?= =?iso-8859-1?q?SHS/DcHcJ8qL0fqwfkRwlrbs3j3OJvJDxwtffgVVzeNgJ4+ZBPDLRvdK9MVi?= =?iso-8859-1?q?6e9c=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: acbc4297-c40c-4d53-036b-08d9bf9671ba X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 06:45:12.0863 (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: 7lKGYy6atF0oKkjPphVfvj7GRgpwLaRYxMUzD3VZ0fBNA+tTdeclqMt/dvXyrhzAYVA17Un05c5VFZJ148+Up45fOL+BvCM/jx19LkXfiXk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB2147 Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf25.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.9.73 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 0C784A0015 X-Stat-Signature: rcbyqenk4wqxrsxetew8sz539q4y94x3 X-HE-Tag: 1639550714-344938 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 15 06:45:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12677577 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 EC4B7C433EF for ; Wed, 15 Dec 2021 06:49:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA6B86B007E; Wed, 15 Dec 2021 01:45:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A555C6B0080; Wed, 15 Dec 2021 01:45:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8ACEF6B0082; Wed, 15 Dec 2021 01:45:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0221.hostedemail.com [216.40.44.221]) by kanga.kvack.org (Postfix) with ESMTP id 6AD2F6B007E for ; Wed, 15 Dec 2021 01:45:29 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 2BD6B180B3E00 for ; Wed, 15 Dec 2021 06:45:19 +0000 (UTC) X-FDA: 78919091958.16.130D2A5 Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90052.outbound.protection.outlook.com [40.107.9.52]) by imf06.hostedemail.com (Postfix) with ESMTP id B06C4180005 for ; Wed, 15 Dec 2021 06:45:17 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ldt/Gfn1MZ74aC5mq67T7ENCKRr3VB9TGiKluuSMBGmlzo8m/yDhrES/gmaLbgLSbZegCbD+W1hMxOvSFN0hoeMUUipCzFm1MRPXvFQMcFLBTVVoUp1SdBhTlnymBYQKXQngHbg43L7qvn7JrnNdyIlsE3yFusZ24MAlE/kq2jAq/hXb+kRswaQD04fbeCpwczOaDZIATDRPLFm9N9oOEWAwqi9SGwIW1RHZSE0u+gO2pwNa7hOZckqixkrKTJXN3cGWshgmGyhDdbVDbl3iZXydyXmSbeEwzG9F739Xb7Y4W82vySv7opARtEuLWJpzGXfHBz7YK+ljD/Q8i31wpA== 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=CArDeLULztxuAoRxJlx6kMSba5WQB8jbxAXjvqV96CGkEjSNyWM1c5O1qFxwTqdc7KHXWLHF7GNyAH0pjbKEpPCClAjqWwnpeUutuRoueWQ2LUywVfLvINmMvCgjuHou1R4XXVk9WBoCN/FHL1gsJ4RN0YmGfCysrPcPbQq/01ltYgvxT9TYWVex7/sUdLYnlLFzkIf6vpjpYO9Hvezukefl4o1ysbJBIViOv9a6okHRVd84+Lwx8P+e67fOhy6GJQL2LIiL5kKMHnO7qGlggPcokg6BT0r0OXM1p0kJaKeiKMcsoAmF0wJAnT5ldBIcW95X5xnni84bw032szIIzg== 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 MR1P264MB2147.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:11::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 06:45:12 +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.4778.018; Wed, 15 Dec 2021 06:45:12 +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" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" , Nicholas Piggin Subject: [PATCH v5 05/11] powerpc/mm: Make slice specific to book3s/64 Thread-Topic: [PATCH v5 05/11] powerpc/mm: Make slice specific to book3s/64 Thread-Index: AQHX8X9PRt5u0RL0BUiKOx05nfM3rw== Date: Wed, 15 Dec 2021 06:45:12 +0000 Message-ID: <13f6dcb4275ddf89e6c36d3d95e9a9b280f711c0.1639550392.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: 7432c0e8-3987-48f9-4f17-08d9bf9671d9 x-ms-traffictypediagnostic: MR1P264MB2147: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: C0D140RxNxv9vEMYD0l9lD2QamBGdlruft64HzxrSb3jFOTx++H95DkgSer7wxGmHBXe7M57ElnNHa1y21WabuOtPDFUiTOhlH60mo86fc3VLJrR+2SIXCCU6b6dl6tGTCs7boMRoxxLR/D/SCloHTnKv68VX51/xYpZDtlblR7IMvA7+0TMK8y6Re9C49xFJ2gCmyKGzubBl1/5Xda/J313DJ6JqZjsNtmEdd3WRUcOR8xyL6ql0EG2OMAw1W+NNuHpBrL5hkkElqz2WhHCLzAlrceGPsN5J1lyAmCcjsGa4voXKM6/k02AZigIbrNdBnjd8kE43yJcWooxAVc/YYH6eHIgboFdo062i201a0ZMGBDxXgikmc/Xe5o+fpbiLch4N+47ly6QVOIBvObS4ww12W0SU3AHq1iFoYsCUNwdrRlHgl3CBT5F7yMId31LNFNPnkSSr2NUwrysEiNw9pQ1hJ5xcn9PF6RAkPzYy3ruvxdVTXqSM0q/Eu4+RrThGQP46DQhfJZiTGczOLJyy+IDT0MKlZJodkxAvbNWkCbl/81mD6brVIlIA1uOaCRAlkg7QLV+xffDfCjRdRrFvXyG8ELGAwh+GUVzDIxUYncJpX+CwcL5RKawuKmFEuVODU4KHNa3LulqfAaaqfxdV7oRuJMvpM2Pcqrcgo0UrG9Zyj2x1kWh2cRMVc1ZQXYtOYNDQ+hB0v1gechwzMhrG1nC1zhSDfB2+ZWQlWXFp9Q= 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)(110136005)(36756003)(6486002)(2906002)(86362001)(5660300002)(508600001)(26005)(186003)(38100700002)(8936002)(44832011)(54906003)(316002)(66556008)(66446008)(66476007)(64756008)(6506007)(76116006)(91956017)(8676002)(66946007)(4326008)(2616005)(122000001)(83380400001)(6512007)(71200400001)(38070700005)(7416002)(32563001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?Ggc9YDUQpmwYlBq4DdNUKyM?= =?iso-8859-1?q?PuRUd1so9NxS8ZlAMAgUDcnUKItz8Utm4UqCqmqVe5kJNMf98rQKbqH5/Zgk?= =?iso-8859-1?q?/awNzRhzmY4E3gq6KWYMT3tVbLQq9/vxI4VOqwF5G3FJ8d+JSan0ej2aV5c1?= =?iso-8859-1?q?OVfJayim8J+eYuX0uiTJDQo2ZA6jvzM1dmN4BK0IZjo45rTQzYA2YQ2Rm4WT?= =?iso-8859-1?q?bVrpwEYVoYvqzcK+Hl3D5vucmjqbz7jwGOFj4b0FbaR50W+zgRma/vb2ocaO?= =?iso-8859-1?q?25N30ZPyOcpA/m8TQZDCznQod97dyLppSfgFZeVsAxybu9NzDr8kPYSCVIHW?= =?iso-8859-1?q?8n9npHNEWmZQQOhmfDSoCEXHrwnVLr8PGSz8ZEgw49Z9G+V8usclHdIb0ihm?= =?iso-8859-1?q?Zz4GFOtvvdx8FSEMK/5hwz5wIP4j/0r/+LB7jZ9zQL0PqY9CPoVRYIVAhGOH?= =?iso-8859-1?q?cdnR33jOnsRaM65sRiIJgWIgu7Nju6u71ISUcSKJa0Kr3+5eL/Mn8c7vu11O?= =?iso-8859-1?q?ALvr81VYbFjw04OdHONQwMpSF2JbkpHuO7tEgq8D14A9JnrimaH6jl9Xdh8n?= =?iso-8859-1?q?ltmvdAZukvf4VoZzbOY+HpKAIiIkdtzpTs/vAGs1/YLW/FvGx5J7WN/1tN7W?= =?iso-8859-1?q?7rh9Y/afPRW/uzYgbMreYeTxu4hcB2OGwOoGAZb58/Ucs3Fua3U9UmzlR51f?= =?iso-8859-1?q?ToL4lF4YNVuyPPQ41K5jXsz7P3Hm6t5yF5O/DrH2nD4DGoXt6lI1cgnQBjZ5?= =?iso-8859-1?q?ieTt5SMXBPEc202lzsVZOMw/WyLCnReK6xF2LI0SO6b3UfatdhzPDazlRG0H?= =?iso-8859-1?q?cBitC/LPOA3XsZ8FnDYJ7JahDfWqu1iD5ruE0N2xThT+r1REarZCBJWQ+Fvr?= =?iso-8859-1?q?HN+5Uz8QIEM7+SPsiootyaqg9/PYvLE+ulzapl2ALQqLg3JRnL62tthGkzU4?= =?iso-8859-1?q?X9PunaMWNyCxFEoz8ObQ+6zEa4qSmKufukBPyGIvWRPLSHVvmUDC5O3S1wpj?= =?iso-8859-1?q?hATyoJvhy729zkBnzXl2YuqjEy6SB6oSzbsaqM+a3AsqfejRMbDPHgrzbAIL?= =?iso-8859-1?q?xgvfrMtnYYXC/BE4b9HA7AOBe8IgnuF8l41pMpJ4ooaRVLGKpABAxfH+Hu9s?= =?iso-8859-1?q?qec8/95e/vsx4XeNPIkpyqy7WLohaTCsK+UdPJ47w0e0t9/bE1non8hDKW8+?= =?iso-8859-1?q?Q7+FwgfckFxyY/cQTfY5fsjcOxHIAsNZ6m4lUJdAeFEwseSEiQinZjvsnSp2?= =?iso-8859-1?q?csSXA7LMW459J1TkhEd+9enWVM1A1Qedg5YFfKlghp0rz6+21sXXa+1xmDYF?= =?iso-8859-1?q?ZRqiNqvg7EbrlwotiTP1K3PDImPFQdSeddDt6X1KLOigFfwg7rT9h/QPLTHv?= =?iso-8859-1?q?2H7S2letdDbq3XyN45yU0jsZyemTiZu3BLfV3F+mx5ouYPw28FLvAkN5Txyc?= =?iso-8859-1?q?/lk17U2lYUjX2udd+Tc5QGlmChJ4CmqjmpQWgZWFvYuMuTLZIRUhAy3M9Fkg?= =?iso-8859-1?q?OXp1gEy+fXG1bm9qzgp7xOw9J4x/RuRcN5rlBpzzaEBaPqtVjbtlJ6Q8ZQhE?= =?iso-8859-1?q?GkCumIXO4r7VQCF1Qo4cSD6l+i01cP5iohCC14QFcOnwL4VUFDJQur6t9kpt?= =?iso-8859-1?q?llsP+aMJLr5g6wur67dC3DhR8asg2zWmq1m2ccThlWvHPhyZdOI7xtu2JFpN?= =?iso-8859-1?q?ohq63d4qYfE+Oy1JqbFdSLbpiq2aSrKVdP/fdGIT0s4tFbXbaR9MZ0zLWJMW?= =?iso-8859-1?q?DPuY=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: 7432c0e8-3987-48f9-4f17-08d9bf9671d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 06:45:12.3731 (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: olJfMpzZv/aIc45blCa9ACsrr3QnY9kGsEY5Chs4SeSkFJUWorz93I9r2Z4yYEmrRPD2lfvLRgV6p+oFcvll644jRhs/voRRnxpwoyp0rtU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB2147 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: B06C4180005 X-Stat-Signature: egrjebmrk7gmqom4cmp7qeiyhodc96sj Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.9.52 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1639550717-202589 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 15 06:45:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12677581 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 3DC86C433EF for ; Wed, 15 Dec 2021 06:50:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 48C046B0081; Wed, 15 Dec 2021 01:45:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 43AF26B0082; Wed, 15 Dec 2021 01:45:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2DBEB6B0083; Wed, 15 Dec 2021 01:45:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0019.hostedemail.com [216.40.44.19]) by kanga.kvack.org (Postfix) with ESMTP id 1593A6B0082 for ; Wed, 15 Dec 2021 01:45:30 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C522E82499B9 for ; Wed, 15 Dec 2021 06:45:19 +0000 (UTC) X-FDA: 78919091958.29.9354F44 Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90052.outbound.protection.outlook.com [40.107.9.52]) by imf06.hostedemail.com (Postfix) with ESMTP id 76A63180005 for ; Wed, 15 Dec 2021 06:45:18 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V73aBlTq7b+bc7IpoxE9/GN7WtyO22DjpezcPGHl0r7EJ8W/LwHMW/9nOkvbJcInVs8CWfCamBoENeR5nTf/AWAe8oaC8cAkDVMntG13dJBk92SD2VIJHSwGDtlHUC8kcY7kQi91cZRe2iZb3hkI9kjbz+m05WGHpl1XAHyvnyw0/y4Yrkxq5/z55Ji/jsjbTON2z8qBezAFh+LgzuLfbYFkNXlOjd0jO/U5q60fD5dvKOXNs15eMA5sdV6PQhKKw3yMaj4C2ZJrTS8Npx2FItMzp4aLzpUgCaCvbVCenNQLN1TE+RjgydtskQ1PjtANTmz+tM2dfWgiBUZ+L3J+gA== 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=cQrNauodU090zIm3u7BiKaEfnqKUaWOcg4GBwtenQ1UsL4ZpbZs7R/oh/YbLTZ1hry3emPX9iCWuW0OhCk2sABKEzYPds1aMizw5zKrDTtO4HO+YUmAMDfkYfk8cdXWhkscmyF37LOx4ML6V8du4ikPrRzdK0FbnK+2WoNOkLONY5XzAnssk/cgadPkY4WY2RAuN618yOzbNJNxJIF712GYqC9IQTwuMTFhW8K2pfCNZR1vLsWXBOSpFM22nyj0R13Hc0OcLwoKBXbkGytJz1t0PCT6ug06Ah3ToaoQeFFMl7aRTQNwaPjtUxYEkKXQVScPV44mWIL3jwDSVw4SIuw== 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 MR1P264MB2147.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:11::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 06:45:12 +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.4778.018; Wed, 15 Dec 2021 06:45:12 +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" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" , Nicholas Piggin Subject: [PATCH v5 06/11] powerpc/mm: Remove CONFIG_PPC_MM_SLICES Thread-Topic: [PATCH v5 06/11] powerpc/mm: Remove CONFIG_PPC_MM_SLICES Thread-Index: AQHX8X9PxLw9vB0ed0+/1Dy1MbNFwQ== Date: Wed, 15 Dec 2021 06:45:12 +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: a84e2282-d11d-46e5-56d3-08d9bf9671fb x-ms-traffictypediagnostic: MR1P264MB2147: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: hjamjGD+4NueG/LWuUtPQZEda+3CiUl3X6cZeYMWJ90hwBeZ5+w3zrXC65eRF6KySLUYzPIg4bCTYrPUy6zarTA1P7BWFNWtcsQJJ3BLF5zuMdui41r+6ZUuff7AJ/3Roh4S+Q+TxMO9nilUYJhfTdqUnHzHGij10zKXM08oQgHgS0lqpFO8EhTzPe/NLh5DeF8vyKBYw7Te98VxXaLsRrfrq1scK6w37GrxCEclTdf3qdzPAa6OBGG8A7A6GSCicn+aqedPeLNmm1WWC+k+fh8L1mN6cyaF7BZFqdgla8pvPoEBwt7q62q8hwuPP1nsN/8NElbcOjCQ3P/Jvx6b32sjaLdvUsr1e+IYIqEn88TboEXlzlAZm0NbX4+B4qt7nEKLLLV+DU4Hl2ecUB7eTm1nhMqtrU6/55Y4Y4ztWbde2EkqgjYGAj/d/yXrbhi78EtJ+Ip1Pad9pGMkHNyAeoVo55RrmojZZ93CFGTm+fQNDoDmDgUzRfFdD5vRi+X0fefzj8KJtebKilmloLDhKPw8lb2pA/L2gnVTBxZ9sQp0FXKOHdL2VBkfvEvPdDTjLTKrAapuBskIzrS+VH9Ag1CxWfZ6XLcqoYNZAFOyasmpH0Ze8Mnu0y8bUuch9cvRRhDQTRw/B3uwTwbbEnRHVltHsxQDxlKFrrMGGRFtwZ7ECIYKXkjQ+WfXV7d96X0PT5076k3LA733I5ynYrUlQQ== 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)(110136005)(36756003)(6486002)(2906002)(86362001)(5660300002)(508600001)(26005)(186003)(38100700002)(8936002)(44832011)(54906003)(316002)(66556008)(66446008)(66476007)(64756008)(6506007)(76116006)(91956017)(8676002)(66946007)(4326008)(2616005)(122000001)(83380400001)(6512007)(71200400001)(38070700005)(7416002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?/fEFe63vnux9OnFYyxbKfhT?= =?iso-8859-1?q?bZQPcKGkV9g8ANjwO9qO3RxGWqHHTD7po4CzVly6j/s1zxm1Xw1eJ6lsSNMU?= =?iso-8859-1?q?qNZTrHEx4PKItdgX1teE68kOE/CJBX1hE1CMmmwycsRs0u8/xdZlM5wXQL+T?= =?iso-8859-1?q?6+tkxcJIr4PwZKYfRiwSY/KZdazFzZAKKziW8hgD+BHaC3jDdQPZBqtOmdSQ?= =?iso-8859-1?q?pdzvFGZ5U9xzTT50k+y+SA6ORDVjT8iseHKQFqACSU8stJVERu6dyo3TN0JI?= =?iso-8859-1?q?NH+on7fZACwYv2DBo2lIFe8Y+b47kLh3JDLnQSVllzqKPS96hDo5FT0rrQOF?= =?iso-8859-1?q?OtcXV0KkCL/ttWMu+Lwrv7x3zbl7Vmr9X5lmABKQcAnAYHOyjOGjsuej6zIs?= =?iso-8859-1?q?v9PjFRfFzIlNCLZBbRpr9HJIfeDXuGqq26XAlk0TLUJ2H4gQfjYUuDpx6KOf?= =?iso-8859-1?q?vhi8tMie7lMX5Sz34lU8LFlHuLHi2rePrL3SDEDFR1AkX9xXmRHDlsHJnCz/?= =?iso-8859-1?q?vRwrB6gO3/1C8AE6DKmaUGUgLYl0Xad68uUJsNV5pi7Pcnnv6DMRjvUqfTnm?= =?iso-8859-1?q?yYvqofemtzcxepEStYR6pfQLypf9tKiDmCl/dbVqacI2w/swgKiZxVqSdn7M?= =?iso-8859-1?q?djoOeIznniKM3Px+D0i1vg5/8svmyh+EcnKL8cWLaE0pBwrFFiaSrsZIDS6h?= =?iso-8859-1?q?DAEUUIfYMc/yfG612G1RDaOQ8tKBeOGX7Q1hg351BevM1Tb4l6PoYrYtAMhV?= =?iso-8859-1?q?9/F5Pi0Lh2FGskYuRymQ8agx8V9mghwAwv64GawbWQ2gfUvNKmMjOV2CWmZ3?= =?iso-8859-1?q?oirOfI9FwPyiAYdwrDnMeBpSRQCF5sbfAfrlQEJOTq8nGZELcXiDaKNQ75JJ?= =?iso-8859-1?q?gFLqdJD2wcep7g2hH7pUkqs/MDvcFL/lRey8A7ocvmnj43kZLObW5aTd8gzs?= =?iso-8859-1?q?Wt1/t0fgKMsZezQGEjTD+Y0J0p9WbVGQMCdblqTsqYrGrVuLDOeXz70Myuj6?= =?iso-8859-1?q?65GmoZGimelbd43m5/QfwO0URtY9J+TylsxT846Sv05+ywpqRcGERohwWXXp?= =?iso-8859-1?q?XM/0MN6jCxpQoibx/oTWzJ8z8hJeKmU7KYI4WmNIrgf63/Md//mRoidjHcI0?= =?iso-8859-1?q?yUFCuFFxnIEIs15y2qzkXakt1aKVSOD2wK+3Csd92G89wFaxB0nyrm3gBsGr?= =?iso-8859-1?q?jS6yParql3x0HVJIaO0lLGmWTaFSFk4qYWUT3Jr+5NTfEipQDei53t1k2wMp?= =?iso-8859-1?q?HovBAarVqVDl+GOmQ6R4fOfhnrf4rcOEYNi4yMo3irOxkOZyKtvsZvzqh1Ix?= =?iso-8859-1?q?SRbOmF1M5U9LLJSRKSRBq0d9CvLzE02J0yeLi0CcxWM2lmvKli96hGvSs8Ho?= =?iso-8859-1?q?qXipCgD8qly0Cqliacgm3CVh1uO2LkgXjsnGSfBCcDZMVvwumFqDBA3dBs13?= =?iso-8859-1?q?VWLQD+WSnCRbX44AUXNLZNo4l+o5RrOwe8j7d6L2F+3KtILZZBxCTcLJsVUY?= =?iso-8859-1?q?i4q28RS3Lk/6iwk5ECm/dIEES+Gi0bQJ7vmdENbitFLYCvWWiC7ep2bWpYnA?= =?iso-8859-1?q?RtIiCO+qkEzoQNg6ZcI4BktL2ZXvm5++G+oRHGiL85yDVcWADx8ALhHxOQbx?= =?iso-8859-1?q?DiBPbcUb0rBa7dTCnKuhWdjJIAEIWZt8nwidP76tDFgTBXYCsZfpUxcdla/p?= =?iso-8859-1?q?2elnG/UCfsvO9Zi3OtPqUdvygA+m7rFnKwdvtOuy4Uxi5qIPKBZ/Mud4d6LS?= =?iso-8859-1?q?YGDM=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: a84e2282-d11d-46e5-56d3-08d9bf9671fb X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 06:45:12.5861 (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: xNwG/Bflk/9+ucCyEy8n7S62/nhgxpRNTp018NZe2jznN9V8FRag3ZK8c62DSjmYt1nZqTAGfaJla9/uE0QQLm/ruPwf7u3pZYHoj/OYQC4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB2147 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 76A63180005 X-Stat-Signature: 6wpz9xdi6uhfazhxipde7iiaa8byh6cy Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.9.52 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1639550718-243647 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 15 06:45:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12677583 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 3D780C433EF for ; Wed, 15 Dec 2021 06:50:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A58506B0082; Wed, 15 Dec 2021 01:45:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A07AC6B0083; Wed, 15 Dec 2021 01:45:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 881A16B0085; Wed, 15 Dec 2021 01:45:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0065.hostedemail.com [216.40.44.65]) by kanga.kvack.org (Postfix) with ESMTP id 786B66B0082 for ; Wed, 15 Dec 2021 01:45:30 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 277DF181AC9CC for ; Wed, 15 Dec 2021 06:45:20 +0000 (UTC) X-FDA: 78919092000.10.6A2ACB4 Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90073.outbound.protection.outlook.com [40.107.9.73]) by imf25.hostedemail.com (Postfix) with ESMTP id 81915A0015 for ; Wed, 15 Dec 2021 06:45:15 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e2o4ckaurMbW74O74keXiO5Q5ngRRUqhxRjP/hEYL/hrsM4ipKXfQqpShReA+rQ/SK7RHPoJ0m25wOx8nGUdidsCG+scqnlCLe63FqUn3BMVs7t/gnmWzqXuPAo9xthv0VW/zubuRWqvYKStWhu/BUk0bDaFpZpcR1hKyw776zw2WtAiA6XRmROu9aNmX6nvn3WqJiZto97Yy2jOlHlwoi8R9lGMYrn7CLnyGHL2H4zFEpt8hU9k62qfXwD8JwtbBdow9sV8p6wLNOaWQx+0+FVFknmJ11juu6Xjup2GOhwgRrWYAejgP9+VrezfLnyyZuHGJDQl6L9cDi4q05IQVQ== 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=aOPlIfLv9B1QrXE92w0DRqSm9EvE4h7iahy364wlTRA=; b=kDTDvsprhHKu4YgeXO8ajrnY6ov/rMJyUWfs1c5IpiV1jkVsGfyoaLyDWjrh2eA7BWZpy4nbb7Xx8KssjJ6HY3F/cSBWs1t3n3xJ90IHECk/W/8+So/PESNh9ChTwp8DU3rraPhxUEk7r+6x87H9F4Nq4sKQZ2rKPsyoTZYSpwwlYPzRJM1d9Xq1LGDtcmKmg2TUk8Y7vfJiLEUdkgmRJkJA1mV5m9mFv0hLTOUmLBQPmf7GbM9FcOumqrfTWZA27+3XvzxlWyA//kykDGA2Hyb7F/Jcvx/sor6AqgNIEblmv5EWsDAB7Z+98fb/ABoc1hhlTGK9SKMfuPvB9WPcIw== 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 MR1P264MB2147.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:11::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 06:45:13 +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.4778.018; Wed, 15 Dec 2021 06:45:13 +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" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v5 07/11] powerpc/mm: Use generic_get_unmapped_area() and call it from arch_get_unmapped_area() Thread-Topic: [PATCH v5 07/11] powerpc/mm: Use generic_get_unmapped_area() and call it from arch_get_unmapped_area() Thread-Index: AQHX8X9P18+NgiQ6yEyIrb9PAUSKDA== Date: Wed, 15 Dec 2021 06:45:12 +0000 Message-ID: <686895764befff16e9dbc2989e8f8eb2284b38d6.1639550392.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: 9967f536-27a8-45f6-4e4c-08d9bf96721c x-ms-traffictypediagnostic: MR1P264MB2147:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 6u4XPbBzX8aUCgKc9PVkAvqwA9yW+BYVCMNZ0ZJAnjmhpFffDra7oGo1i4/g9nF34c5azhXiyZbnSEPBqxqmGD+uXLcikmXtSFrPV7VlwGajY4hhZ72kN58/U6O0cwqWmVtRfVan9pI/Zg+y0ae3ocvUMb2G1ejmwTqNqPJ3aGeAg5SCYrVqJb146glAOrxwBeorESWUSOKTRB7TS9UbmwBgU5JIsDfFCXMOOHJEaflhS9n/CZEwLrJj8q6+e7uhaLZaOaRurZeyBYhPMYjnlCSCDVz5/RrfmquCwHhhTs/pIuD8yxanBcMinTRuNTm2rUnWLjTTl8cmZ/xk8DdisoMrolnnZAE7XF7zdYHs+JkyjgcnRkSO5KXGbekl0piqVkvnh8ZMrLZJiny6vO0MBp1wvjeFocwUH89ynkqkeFCIhlyIOJbib7po9avvLpUD3Y9pQJbJO9DThDI/rS54qYU4BesKFiCQR4WG3zMtQknG+IUkkmPvXevTOCxgyegFZNLxmVBvhjiZd9npsqzlR6IU25Co+xDRIrn46kAOkFt4BKO9Ldz0JBG4fzcjWqmUFxSyvvqmrbAZO+6hqrtA5aAMe2JtSHn+OlBLc9AArs2NBc3cX27DrUxyvFlBt8MB+Taau0Ab17nm1ZQ38WStuiABpqmSqRcgFBe7uti9UxkNuCQL4QvWpM7fUjp4CNfGBNmwRjEEPs0NRziL83VzuyLM1+VtVZjpE9t1kSd5r+Y= 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)(110136005)(36756003)(6486002)(2906002)(86362001)(5660300002)(508600001)(26005)(186003)(38100700002)(8936002)(44832011)(54906003)(316002)(66556008)(66446008)(66476007)(64756008)(6506007)(76116006)(91956017)(8676002)(66946007)(4326008)(2616005)(122000001)(83380400001)(6512007)(71200400001)(38070700005)(7416002)(41533002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?DA0cfbH0+ItJxq8aub4etUk?= =?iso-8859-1?q?jJiMT/05mSVg4Y0AZ8kTqn9BlrRK7B53emHgb0qUIxid9SlJ6L8UdrcagbrC?= =?iso-8859-1?q?3AZxHCFM5iTBejUaqyiNEMuNdOv4kVW1qP3L117nSiLZhOtNwYuXWUclVJzM?= =?iso-8859-1?q?m5cweExT2vtvHn6eaZNwiTMjQKc4J6Z9EP5WVOf6hFj8ENvsuOeiMh3v6Rpd?= =?iso-8859-1?q?T/tLdLlXOlUhdwjvIekg09Qq1JEKqP7Jwx85YVsDzgxNP8fOP9bQCgNHM1aq?= =?iso-8859-1?q?fGP62Akw8BHGb/Su6frRQLtLSLHUfAJ3s5W5qqs9EuJlrirXjpqBT1amrwkW?= =?iso-8859-1?q?OF4cAIQwYYfeLNKiNDcT4dsrdKZjwA5DQ0UHkJrEAup+cfqmY1S4RxCjKwl7?= =?iso-8859-1?q?UWUij64O99XDDZtqMMQ62KtSyTfoUZwZYHzGXl0PzDBfN6zGoxct9v7a2EJm?= =?iso-8859-1?q?pLbzyvu4OMiiimHONC6hrrvSGVOrTBO9z20lH5spEAiKYG1HU+rcx7N1vzZI?= =?iso-8859-1?q?+N+ity+LwoNFhAkwArBmlwjFA9BI8cD9QiKtD57OK3fqzGE3Q/HN1F+BgAYQ?= =?iso-8859-1?q?qdFqfmpYqAFz8Z1AxZ/P20oNaO8pzhS05pqwmh3/SSm9ENiq3SSKuqwTzzBX?= =?iso-8859-1?q?FulWlIcBkFKMiY9SypL7640TVT8UG1/22SMKJZNJpnmzSNnpeUYkRpGUZNTq?= =?iso-8859-1?q?dLVcd593ZtVq22m+zdlpAP7PD87dJYcgOUvZRr2d4oK2RNct+GltlOKtnHZ3?= =?iso-8859-1?q?K2tnGFpat+GCR/57BscICyakdvEL5wuQLLhEq9UHkG+SWQBGGN4RPSrx0r+E?= =?iso-8859-1?q?fsJne/TUv/k6GSVYUXocJ81aDDmTlitkwOlpTh3gp5YrkVynK7xsuHWmtpzY?= =?iso-8859-1?q?eEB9XaXwvSgYEVA5u/5AkdIiOfV7CH7btYh/VnZECKTHeNe3on5yaEkgmMKH?= =?iso-8859-1?q?NcQIOkoD5FNOj5BoTcCbtN3qlo35gZT5VUDUryHcC1Hh+ZF1P0U+UPRH0pFK?= =?iso-8859-1?q?KaVRKeNFAXTo/XtuYr2STPWmX6KHS8/NsDFhIh1evGa1VxQx8kXlQ7tc/OK/?= =?iso-8859-1?q?T4AC8+8cmWLTrqGsuvID2y/F8p2LIGG0uO74i3N2UoTzofWJsSEM05dqQD3x?= =?iso-8859-1?q?FyjjUrERJYzFRilP38N0y59HdreOSLsuTj6kXdLD5CZZ1Eznuc8ps8QJE1+h?= =?iso-8859-1?q?YM19TBnwExU3Q44LdS2omZRXVb2kJUUy1CKU8oejyPkoZVrESefucPdyRq9p?= =?iso-8859-1?q?z+1gd7hVRtDhBeThfbQGgks680mlh512/eaKPqV+M0l8a38MwKk7SNRP3RJ6?= =?iso-8859-1?q?9C2kcTSaLM97fFUcPAQg0zB6riF4Ljr5qiLhGdjBhLSMzi5J1nO5Apc3YYk0?= =?iso-8859-1?q?p2Gst2vWcpZgKgyk9aNlB1hMrYw6LrwXD0e8iFDruVR4JIa7nkzUH6iiTuyD?= =?iso-8859-1?q?ap+y96MSPryNBiecBs84WeHX0UwjWPNvkXiKGopXAMUFtohK+WJrjuwsX45/?= =?iso-8859-1?q?16aqOn2wLLiCtBGQCyaLGP61qW+LUSjevcGO1YbxuaDiJ9OdN1baBxn8BMxE?= =?iso-8859-1?q?3fXRS1Y4XXrWbQQy7KOy+RGuaoIN4xAg68pezZz+ecrIP0sLCr+eG1dNXb4J?= =?iso-8859-1?q?gjIdc/6MdyB3sX4qYuo7cA+CTykkIIbgWfPaEQD78OhbgyXtp6r9rUMkdXpN?= =?iso-8859-1?q?U/TYq0XRiJ7lzWjMA6020yIUS64os51WeIk/HMru8WHVMK/ojQlLawrF8OJA?= =?iso-8859-1?q?dG/s=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: 9967f536-27a8-45f6-4e4c-08d9bf96721c X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 06:45:12.8689 (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: R4ELGewbwqWRZ8H9s3QtHbVdVl1zrK2nEUfpejx7i+279dNxE3p5ytjzZ2jFaD58RvGEY0ZJlGTFuIJcKYXPPPU1rXfUUKQ+0TsmOUb+gKE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB2147 Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf25.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.9.73 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 81915A0015 X-Stat-Signature: a6ngxqs7yi1f48r19h77gyiecrtme9di X-HE-Tag: 1639550715-343495 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() To allow that for PPC64, add arch_get_mmap_base() and arch_get_mmap_end() macros. 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 Reported-by: kernel test robot --- arch/powerpc/include/asm/task_size_64.h | 8 ++ arch/powerpc/mm/mmap.c | 127 ++---------------------- 2 files changed, 14 insertions(+), 121 deletions(-) diff --git a/arch/powerpc/include/asm/task_size_64.h b/arch/powerpc/include/asm/task_size_64.h index c993482237ed..bdc87cde670c 100644 --- a/arch/powerpc/include/asm/task_size_64.h +++ b/arch/powerpc/include/asm/task_size_64.h @@ -76,4 +76,12 @@ #define STACK_TOP_MAX TASK_SIZE_USER64 #define STACK_TOP (is_32bit_task() ? STACK_TOP_USER32 : STACK_TOP_USER64) +#define arch_get_mmap_base(addr, base) \ + (((addr) > DEFAULT_MAP_WINDOW) ? (base) + TASK_SIZE - DEFAULT_MAP_WINDOW : (base)) + +#define arch_get_mmap_end(addr, len, flags) \ + (((addr) > DEFAULT_MAP_WINDOW) || \ + ((flags) & MAP_FIXED) && ((addr) + (len) > DEFAULT_MAP_WINDOW) ? TASK_SIZE : \ + DEFAULT_MAP_WINDOW) + #endif /* _ASM_POWERPC_TASK_SIZE_64_H */ 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 15 06:45:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12677585 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 CACC1C433EF for ; Wed, 15 Dec 2021 06:51:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F3A166B0083; Wed, 15 Dec 2021 01:45:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EE9966B0085; Wed, 15 Dec 2021 01:45:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D65F26B0087; Wed, 15 Dec 2021 01:45:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0002.hostedemail.com [216.40.44.2]) by kanga.kvack.org (Postfix) with ESMTP id BD2A86B0085 for ; Wed, 15 Dec 2021 01:45:30 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 7D7B3180BA54E for ; Wed, 15 Dec 2021 06:45:20 +0000 (UTC) X-FDA: 78919092000.09.7B2A073 Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90052.outbound.protection.outlook.com [40.107.9.52]) by imf06.hostedemail.com (Postfix) with ESMTP id 2FEF3180005 for ; Wed, 15 Dec 2021 06:45:19 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dxhXpEo0KVuhbn/gco8LAuRDr6AxRT/b0RzP/dYMSi45GppTv6izyOctZCcPH4WKSFMzjp8jyHgQpyhFmwUJzdc7f1tVb7MCBIjZ0tI0FiTx6SWwVY0lbN/e0s0ECZv3N32C+ihOOtc9v9YQer1tSLh/1bGRhWbRxr5SEJNvPjWtRn0QaEtO4mphoSQO7pf6Q9660/o/JjV2XYikjp2tsR8XZNRRxPJ37QYEWCEKf5X12VUMzTGIFn2vLB4r7MqgQFue9hoO1dpj8UtADzlK8y5hhP9UDJ9IY7k114x9hdMcTwj+Fe2WW4eJWXcOQIdLbMSNvEfjJnwXk9Mi9G1Qdg== 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=Yfgrin3/elY+QYD9BZJWO5398zlmvBk2smLqz93p2ShmdqUuYXajPn9X7UcZxn89ujQs07VIjZ0+CINGzcXffQsh6nVh7QGe12ozqxaeW+GdfKFLO0VNeZbd+U9G3+yo639JrjQv3bOlq+N/Q/w0w0j4BvU1uioGIsxCDRoJyNFVBFg7kHNZFoiQ0kEn7p7gLN8edtbB1cJS84pXRfhNtPKqDEldDQ2rxqD/2gDnMfHo/Kj02Gn8jONgpArJOyq+58v2aJu+xCYXErEgUZeHlQUGVB4qJq8fdu0ASRknF5MO6oFR1IHcHSScaAwUiiGrowa1dMS4Sr54HRizEAZD/A== 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 MR1P264MB2147.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:11::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 06:45:13 +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.4778.018; Wed, 15 Dec 2021 06:45:13 +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" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v5 08/11] powerpc/mm: Use generic_hugetlb_get_unmapped_area() Thread-Topic: [PATCH v5 08/11] powerpc/mm: Use generic_hugetlb_get_unmapped_area() Thread-Index: AQHX8X9PFl6iCMIDuUSKEdqOR1hcJw== Date: Wed, 15 Dec 2021 06:45:13 +0000 Message-ID: <7e151023284051a14ab088b9ed284efbac0048ef.1639550392.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: ff287c5d-3e08-4498-ae14-08d9bf96724d x-ms-traffictypediagnostic: MR1P264MB2147: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: ycXG95SEtS/UWrhfk0SOHzD/JukAaQ+jaP8zblcg8MtnLyMl6Mm9UIEP5egiuroSDsT0u4FNCDGkt61Kd3nul2wQ/QgwgDjlMZEYixhsVVB3NGru0cPBZxjNsGgb8MxqhM40NTiNHEmPbJq07bdScCh0/xVvl/YGluTxb2DaqpJdibZ0CNUQd+M7oOySKAzBgutIjs2ecBRVH/p+RxNMlAl4thaam4nsCJfUVu1fzf93fABUtXfmBFs4KVpa3C8hX8Bw2RVAD6lXKuysp2pv6UfieE3TItchpRTf3oriyK55H5dY1Yp9oS65idZp61cJk5lW5wHwnqIpBiQNvpxUsxfksJ+3AnabyG/meaeqIBihAJ+w2LCKgjuzw/cUECL8qVJcr6RaEoSt3RCxUD7QnjRw0qzlumajQvHy2uoovF7rEqRWSStzSlbKJ8izoED3f4w9Io49Zl5iaL04Lt4+NKmAhGIATCoE/Hg8Xy+kxatRTFG065qFxWHZTAGeZhIJ/vr8u1IcD9w4TYg5zScGm7zsv3gWuxRIZQBuq8sLnJWpbhJ0dwHfa6sdmEXPl8STOr4El2lIOsAHptYTaqnrqC19mWgAI+zEUGFh6szJs3gVrN/omZDRnqFvd8dCcqGTAD/ljKedCZdJRqV+J1Pw2SqSRQjssPjj70T1G9h7LCDwJIuXlkQk5OsSe1WZfT7Fm5EdaAr62Q33gBSQ7udb5bBmkgEwxkp/I3Ch1cYZarA= 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)(110136005)(36756003)(6486002)(2906002)(86362001)(5660300002)(508600001)(26005)(186003)(38100700002)(8936002)(44832011)(54906003)(316002)(66556008)(66446008)(66476007)(64756008)(6506007)(76116006)(91956017)(8676002)(66946007)(4326008)(2616005)(122000001)(83380400001)(6512007)(71200400001)(38070700005)(7416002)(41533002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?ywyzsHPr5oUQA3yBp06ga4v?= =?iso-8859-1?q?qgsRkulorVfLzvHs29P8R/RTglk/cPJIycP2dJCJd6m21GuR81qQy7gUc6I+?= =?iso-8859-1?q?E0DcwOExHDDSwcKGfEMao1azAIFhj5cuJv+n6LsSKlWlQ0FMfF0LPx30XYBP?= =?iso-8859-1?q?1t9EhJMiWIrWKLc3EucHuwBeL67Nj7FsyTWq635gXFhCVZsBERnCSUmZxW8H?= =?iso-8859-1?q?773VzlvZOHdjKE0XNkbOmqZLl/7CSfJ4diaovDI710ptGxvRV4+utJbKxoJ7?= =?iso-8859-1?q?gg4mZ2X8lzgIRhOtpN44ZPtEf1GKUf0t56qqrlKvgBu2jdnE55H1GfjGt3th?= =?iso-8859-1?q?re5cDShg2RhQdcibdoOCTUgIzdyXuuPpVcO19sJ1F1MAN/vN7pu4walb0XGs?= =?iso-8859-1?q?Lh0nUQJAxqh6y+BuGLBkUETBAIsPyIK4p+s2rD3YtxhGuJoKJTwsvS7CBBKN?= =?iso-8859-1?q?W0pvDJOxMqMHcGwKvXCoohIRvv7G5ZrfM+PxcSmGJIT13EbOS4gfIRiBNAV+?= =?iso-8859-1?q?hlLcg/NLrpTvKAyK5UcpGcjfEKnJgYCoiqahrB6F7+V7iQrT4rEnxDN6G3Ln?= =?iso-8859-1?q?zTk5wkyxXEfNrYgJCFla/RN1moJAha0oroA1duyR+BBeU6dTREgAR/+L8Pxa?= =?iso-8859-1?q?SI/1b0o4oy2pp1mi1nRlXBfGl+rHiNMXJ1h+IvNoqI2yR67rL3dsuR3HfGGG?= =?iso-8859-1?q?HwVpiLanmENpOIDgvzm3SKGglM3RgWYuVfT2Ow+AZrViLMZXAz9vIdg1aFCK?= =?iso-8859-1?q?o2LwbBhWmVAFsm+laLTDKX02kNIrAfs5g5+xozIv38ffa9bEunei1KPJt8wc?= =?iso-8859-1?q?VQCxu/kpSv1VzqDCwuduwA4pCo3PVFYtGNGDXQ3bNwqNOQMJamdZ7n+t7sx1?= =?iso-8859-1?q?9482LAFVnGJjh+GHjzrWg0s0Uj4aj6xbTuwaUbAk7hQ+5uUbEky4/7ec7hCR?= =?iso-8859-1?q?+qXXJyMx9mWMjij3QcXZIoWvxOPjnslZRO0LJOE2Myx3EppL6eFXRrt/z6RF?= =?iso-8859-1?q?qofZmfR5Vp2kHAjxUQbL2lIv+bZZLfIW5xXjX6pMfpiA/TK/puvS6fsDaocx?= =?iso-8859-1?q?2vyy8aaiOpcHe8GwxY4UYfcL+ispuoJmBWwiS1IZ/Pgv83CR+N2qlCRjj+kI?= =?iso-8859-1?q?T7N1fQVIwQMcMAedR0L7Up2ISgXM9H0w572Fwct13j/upCVFMWn90R++Tq3A?= =?iso-8859-1?q?KFcxcRsFnK6MKUzWzhjX3eULE9okosfQ12TdcjcvXin9V+VCpP5Mz82Q7ime?= =?iso-8859-1?q?RukrVTaQ9BJuRPyeY10Aqxc7ahD14tn/lA27i3m+a1WkHCciPeex89ZOdKMp?= =?iso-8859-1?q?+KV2vfcG0ReHJZ83ynsbVFOWw6Iga0ag3MjSwTKKvnJVy2lEiix/lCZlzgLy?= =?iso-8859-1?q?k39j5ZANNN85TPZ0EVwAGkLiVmZ0+2jzpIMAzUV6a+Vv0XAbg3MU+K92rdxa?= =?iso-8859-1?q?3tXZ5Hkb7eAsD4cZXOlE5BWALf7CmX6vJ1cJmbqnDT/4LroYQImxjNm0T1mR?= =?iso-8859-1?q?yqDwGD4FzMEEJ1dysgWztusbmAgQMzgKGO9GeZ2h0JEi0tx5Ay91rhVc/LPZ?= =?iso-8859-1?q?lOOQpEyxRMLidqUGx/IPp7arH7XotNKN+EIbH202q1kxWn3/J625U8OiJa6T?= =?iso-8859-1?q?zV5bmNO/H3LinFOm/aGvGNsWu+NmgtH5HIwFR9S99cYQ1mo8+8t0aenwDJNg?= =?iso-8859-1?q?s7OdaGDksT3n5C24FPPAbZK9B5z1V441vahaWAGs2tFEFrNRubxVTVVDQ8XF?= =?iso-8859-1?q?GWFU=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: ff287c5d-3e08-4498-ae14-08d9bf96724d X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 06:45:13.2164 (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: tIZuM52tXLRnTk/v8R/6VENKgzPJvbO89NcG6xD8PqcuY1lEcR7egXq6PWmjh1or0vd+7O34kCq6yUY0aFrgfC5nG8g7idwLtz73lJn6Q2g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB2147 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 2FEF3180005 X-Stat-Signature: ju6ogguyikunursasafq85o9w4hxquup Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.9.52 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1639550719-407891 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 15 06:45:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12677573 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 66E99C433F5 for ; Wed, 15 Dec 2021 06:48:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0D43D6B007B; Wed, 15 Dec 2021 01:45:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 06C4C6B0080; Wed, 15 Dec 2021 01:45:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CA0506B007D; Wed, 15 Dec 2021 01:45:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay037.a.hostedemail.com [64.99.140.37]) by kanga.kvack.org (Postfix) with ESMTP id B06FD6B007B for ; Wed, 15 Dec 2021 01:45:28 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 39B8F22077 for ; Wed, 15 Dec 2021 06:45:18 +0000 (UTC) X-FDA: 78919091916.02.1789FF6 Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120051.outbound.protection.outlook.com [40.107.12.51]) by imf24.hostedemail.com (Postfix) with ESMTP id 1573418000E for ; Wed, 15 Dec 2021 06:45:14 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qdh1OFQ/hFEVvIs7Pbz3bsXCk4DHECsZ9puS+lymWDgCMjhvem3rKHy9MAhbWsccM8HeONg9DXmbt7x0grYxYPBQkUGb2bZ9nhfAyJPCqChlukAmO8sPiB0J+7G0kd15nxiPu39oeZ2VCxdDTJs8Roh50009ukH8oNModDhcZzpLqWeQ6LGxOtc3mSXTBx3PGU+mGsiK+hRg6hJeAA/BcrQw3iDivG6Z9zHwzZiTjHOsRVRM1n5j2vBdiCDoX7wMLG7eGPVRIhcz6PPXp4CFWWIEr+woibBFr8N8D1zuYf3B2x1+rASa9USyvcI6Szl75WeSzGkmnVnoELeKPeIGkw== 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=cJDKGo+c42Z348GOCVWVuQ4zCHV33E04EN2Sm94CbyOiG6Oz83FHyj+0+5kkLYnytZwCx9OQU/kKEOSMB/slJ7I82Q1wNe2qoztDR2hqA78aJ+HX/sDSD5TM02a7bqYQporOfgtr4LP5GmQZKdcTtj+P8X7trzCl991Am0yID1WCyDRZnth9TObiLTPqiED+nH0TJmXsEgWrvywd1N269QEOT80JRAPzxlY3htZ8FPOffRjDNffnxZKdyY7Y+Tsppf+E/0AMaYAsTcOY3gOwwZvBkJ+ZPbYLiVbxyf7SiKjNEhhXdWZwZ2yjHTCkxsJhXumHvTOXxwWW3048jnNopw== 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 MRXP264MB0311.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:22::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Wed, 15 Dec 2021 06:45:13 +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.4778.018; Wed, 15 Dec 2021 06:45:13 +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" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v5 09/11] powerpc/mm: Move get_unmapped_area functions to slice.c Thread-Topic: [PATCH v5 09/11] powerpc/mm: Move get_unmapped_area functions to slice.c Thread-Index: AQHX8X9PfJMd8arIBE+k0k9TTXOCMg== Date: Wed, 15 Dec 2021 06:45:13 +0000 Message-ID: <510046d11cc0d5da800d9bdbd9d4ac3bc0a605a8.1639550392.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: 7723a19b-edec-41ab-2773-08d9bf967277 x-ms-traffictypediagnostic: MRXP264MB0311: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: FE7A4ulTpvjfTq9lmcnyjtJzaGw76Yx6pZkfIav7678rRCyJlnmylhRwtHekoSak9JcnRhYwTNWE5+ElWnPnTOTcK73/qVAwMe4r2rOWkT9PecsO+Rty+azuzJy62U1x924yfojqzJ85y/XzvE+szGYLa0S4lTK7vNBxFeSI0y6vlLM7LgkusdifR7A1PRBpZZizri2kAV8wfgFy7qCZPj04e2RgaXDWBGJpqx03Xouz1jnxPXawuu1OuN/wpQqjR9zCh50kwmoeqhkjCtkJpzpOm/oMHYCcc7PqCf4TlfQzxdLcJWgBSXXR5OJtICag5Z5zsAZpripCyZE956tDr+KH0SF8ssi5YQtt2NLG6nKrZyeGMCAqBtAs4vulgX3XUxNpSoNzmR23dEK7ACmcS05PLj7uJtl+kF9amRWUB8lWtiChhNnh0OfMQUqlN9E0PyFZYaP6jqEeZfw48YMAvK4R2P9tV5rr0PZkZzHm4HNrDBL6+uBPr0bU8vhKh9KIGRQGrtFQNg9uL06qf2Q3MVSefL1URqG6XBBAwIiZxeTWO/vfkIBlSXhPLpaZaKtha2h43lHheQGg6xDHDx1wIE+9RERpuwy6ZlVyiOMXKiHSE800sudWEKhVTiMuy98m+TdSR5p+0CMyf9o9TwvyiMi/keE5saPHC90Sx0fR8uC3mdmHzssg/euwqFwXZ3F9WW5JqSyyxHNNF44hzdZpjw== 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)(54906003)(36756003)(86362001)(6512007)(83380400001)(2616005)(26005)(76116006)(8936002)(71200400001)(66556008)(66476007)(66946007)(64756008)(66446008)(38070700005)(186003)(110136005)(122000001)(38100700002)(316002)(8676002)(6506007)(7416002)(5660300002)(91956017)(508600001)(2906002)(6486002)(4326008)(44832011);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?yqTnmyqVRZbbRekppizezaN?= =?iso-8859-1?q?1e96udt7mWRpmR+bNpl8ZpG3lN/x17lJdpFDK4N6bKgV7pugiuHQ/P+/KbBm?= =?iso-8859-1?q?UhbA/wPPvvcgQiOwrAjAIvqlwPdrhCfe0WBsThBnrR8bViAPC/1vN/NBojI8?= =?iso-8859-1?q?fBmdFZrLKDHkyrm8i98kBtaGRgeVj7qQPLdbtoBPFbhXwihbeFHU9JQwLKc+?= =?iso-8859-1?q?iGwJNiav6DUOtjIGnNfj0XE98aceUd4r9QlTw1P5pvzE0CVo6uGwRaNuwY39?= =?iso-8859-1?q?v8492xh4gWE62cEtY1aRa5Uhg/Elp0HsQc1ba7alzeNvnde+9kL8bW8ITM+L?= =?iso-8859-1?q?kPp/AHwpfcM1inG/5Ae6nywBXmc56Saf/TmC9lyd/dJHP7AsKJJ8d9loMk15?= =?iso-8859-1?q?gYDBLegbbHlmiTEQ8kwDvCZUNlMmjm7g3+9vsZ794t5mVFWz99ULOggqWwWg?= =?iso-8859-1?q?12E6Y9F0LpQ/oWQ77sZCKWlikltiUVDtkWH5fPI9ex0MtqPy7iTvLFiAa9yE?= =?iso-8859-1?q?dscBzhdWpx8eLZZeYzcu7Cy3jp0HXz5+peSgZXem7H1Spls3LzfFNwMklRNa?= =?iso-8859-1?q?uwJioWWzFHkMWd56wGkboZq22EtTO420QJWu8CDFAV1B3E0APMqvLBzG5GHk?= =?iso-8859-1?q?mCxGeFOYKhyO5+hHCzs6bYghtIdkIUe1zd1l266iRV7uhwxiARbs2G/v2FN0?= =?iso-8859-1?q?P5JInI9rLTqRXFwqN0dMj5t6XL8GamvOvCJdW5s0tHbAPURhPEzF4OQoHflD?= =?iso-8859-1?q?iYI4LW4UhMECaczXrOcS+wqLKZZHv6UNbktwdvotCCl64aCPJa4IAmM3HD+P?= =?iso-8859-1?q?KHiwz3lxJWQH58X6FGRB7vtbZsdADkclynSHWRf5lu55gwTC8a6RNny07mgc?= =?iso-8859-1?q?11GUdEB++p8qKJN9iJq7hrfPS1syzOPOsPiwd0BbzCmshBLn/5I+ynuQ89Iw?= =?iso-8859-1?q?W8ltEchQS2iHKSkP8TLeTXc6jzzAcrkz9jCA4rJxHxHm0Z7MO7T/p2+igoH2?= =?iso-8859-1?q?uiKHvBRwnU6Gp9Q1mDVSCDHv6bSw/TPLBlbgqZ9aIXnUtUxC74Tnrw50WEKL?= =?iso-8859-1?q?g1qh+MhiEesVmicRr/iq4WYQaaZJhmjjKnlzbGo6wJUVLzc8F18pFIeaTrlH?= =?iso-8859-1?q?Mg8d1VYdRgrIYeh6he2aRUrYlu2oOoJFyG9sOOfGc5Us0SNQWxUGB4Zy1OpP?= =?iso-8859-1?q?DwZi/yb6UZ2AgTdwBYoXY5YdWfBetGOHo5OSHI7K+pqP7aTXCpxRbE7bXGY+?= =?iso-8859-1?q?hp6P2cGf2xL1tow535+9Kmw3wceAUkC7qGdnAJnuqvNlUYb0h5kxSnZtnVPn?= =?iso-8859-1?q?/MyfaOYjK3Q4JHZncYUM/xK/gs4iQ/MGeEqBWBlvRDyYmDDxVmffNS5f+VNC?= =?iso-8859-1?q?N8q9enwmeJg/iSQ4agPb+2AVVFBP2bKW4nzrkh19yva+F/ZjsKuMD6GTq8qf?= =?iso-8859-1?q?bxJRqoQO5SF9hn9opHjoaA8lBg5JKLmMMqAZkK0AN6+iimESKUixYBLHfASQ?= =?iso-8859-1?q?wgEWJBANvA6uAQQbPV9/LXFyZSVFvWbwojAkL6frczpgF6G6X4mpOxhLDY3I?= =?iso-8859-1?q?yhPAHwsj0sjnC1HG/9q/zzAEt4U9xTcix6LZ/TG9LYEVvfXLJFmQOWLglEX7?= =?iso-8859-1?q?UPCzgxxsgw88lYT8/83hrKGD0jrJ9CBJMM3aAlJCj3zOc52fL7QtmkBzVwqR?= =?iso-8859-1?q?eGQZpCdO9BZ/CqKPAPullTdLtINSTiKOzjLFaiNocUmScRsT2fzScpv5/YsD?= =?iso-8859-1?q?Ug70=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: 7723a19b-edec-41ab-2773-08d9bf967277 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 06:45:13.5350 (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: IVbILLp60vu25x7ojZvUNTt4Qmq6401YdRxKOxtZs2gKieBVtZovoM8siJX5oq111HPP+JMFMnEbkB+OdVni2F0dn+euYGppxpRTqzl2siM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MRXP264MB0311 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 1573418000E X-Stat-Signature: 5zzt8qbs691z4r98p1dsw5b1415myii9 Authentication-Results: imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.51 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1639550714-309699 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 15 06:45:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12677567 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 A8574C433F5 for ; Wed, 15 Dec 2021 06:46:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C05926B0074; Wed, 15 Dec 2021 01:45:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BB54D6B0075; Wed, 15 Dec 2021 01:45:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A2E686B0078; Wed, 15 Dec 2021 01:45:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0076.hostedemail.com [216.40.44.76]) by kanga.kvack.org (Postfix) with ESMTP id 94B026B0074 for ; Wed, 15 Dec 2021 01:45:27 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4DDD88249980 for ; Wed, 15 Dec 2021 06:45:17 +0000 (UTC) X-FDA: 78919091874.07.960AC68 Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120051.outbound.protection.outlook.com [40.107.12.51]) by imf24.hostedemail.com (Postfix) with ESMTP id 25EC218000E for ; Wed, 15 Dec 2021 06:45:13 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NVJiRoDuvbRKQgnhb96j/RhmFn2uSQvKKrEGcRWlvqW83AlEUuzEp5hDeT16+Fec/12wL3dMRAidkyhvkiwX5Q/0TZFblrB6CNigd7CUslcF368DOdmEOCHGFy+ekWy++EXyeVGpne5/1TzUuMXSySUyAsqbjFWbskc4DOuS2u0pcyRAk2LwvT0xueovl6uZ6Oa3K6bWa1vhF3X0PNlpfCjTmQqnzZ2KCynbxihmrmhZNjQ9wMoPsFIee9wfTrL1gmvdbhUIuD3DSUEeJLlNnpZXTQpbj6po32sbFBxLS6ctChAa6qquTYIfaXCwoHUDkjnmdZJRqoeMmfXdyQr5Gg== 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=PM1tsV2E7+/dx7vpR2aV9rqndz5KU8OyEwLYpGyZ5i4=; b=nvxAdtQAfV5kPmXU3syupgoCOyvAeaitVIJCGmRdUhnQAQR4le0qKG0qlfKBhjM+CVe3BubeMXI7KOWvaW5YePw6wTPxcIb0Mu9CSACIf8gGtpYwg+obMJHC5mrB4fcdAQF41HyXR0hv+2wN9lBUuDLqmXFr9M4bS4YBPomG9C3gFXQkCkSYbJcCXtjxlueVsi3DEiVrVR06ncDilG/4gQ4TvRJq0MJeAJ8AU+tT8/wRr/7JmN4BTJjkXO8ErV9kbxC2yICgJJBGmf1QK+5U0rmc6pjVT0gD6kH3aBrUMTHaXjJq1SQfuPbiZ3FzsX/H+k+NVnNnim6/bn1jDvIpYA== 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 MRXP264MB0311.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:22::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Wed, 15 Dec 2021 06:45:14 +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.4778.018; Wed, 15 Dec 2021 06:45:14 +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" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v5 10/11] powerpc/mm: Enable full randomisation of memory mappings Thread-Topic: [PATCH v5 10/11] powerpc/mm: Enable full randomisation of memory mappings Thread-Index: AQHX8X9Q/ktb5Z47sk+j8B+lW3TmEg== Date: Wed, 15 Dec 2021 06:45:13 +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: 46991725-e54b-4a25-67a2-08d9bf9672be x-ms-traffictypediagnostic: MRXP264MB0311:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2887; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: APjQCZUAx+4k8+S2Ysp2JKvpCrg8eitzmjHZ68o8qERFCSWbXiEt3pgxbc2M5h4K4BntTugHmObYAYaM2ums9jYX3AlSFiecLuZRaOQiSk1v0yXDsqAzw4g7oLrM2iPQjuTq0/RgR5BGNS4pOL9GMZgFye9tZUjLuM71RTEOx2ME7fF7q7MMmYxjh0GWR0xPzsqrBX9ON2stOoKkbWwLerOvNDatX6LRk7holw/BsvD6/3lA0GcKT0yP05rwVuXDfAc2QJRNaABK9fmilEYHoCBkjopmdJ0nVcpQJeQfwbkAPaU1XHaxX7XkbvU0ArXnGHPVUG/I/zaeOKo6n0skVgEVF+yTTZAvL5yWZb6+sUbuely6zh4Gy0r7SyeV2PaVzvHPVNMDaFicalVt1RWPfb6xCZWQdY5gNbMuRcLiamgd0Yo9pkO6Gy/ACERDc2MR338zbsUrggvfKi25/ibcqoAiccR6ylHjvcTmYX+veOHAjUsZ+MDqZwOOdAbhqp6LLyXBZkTyi/9LCMT7OYN0aL18Vm61stS4EXQbiJcaP/b6FssqZKjuVmv3TL92K256Cy1XgyrHGXKkKcT909A+t/CpDcoiK2oN8tVN6yL4SCYWhNxaK/z373BNeGHpf7PvZ2QWHrCGX7retG6ctSGDYKkbWZcs/Uh+gKQcWqukDKgxKi+JqZdZ72Feq7E0g6sw3MjChTILeIejTcaRjfygwQ== 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)(54906003)(36756003)(86362001)(6512007)(83380400001)(2616005)(26005)(76116006)(8936002)(71200400001)(66556008)(66476007)(66946007)(64756008)(66446008)(38070700005)(186003)(110136005)(122000001)(38100700002)(316002)(8676002)(6506007)(7416002)(5660300002)(91956017)(508600001)(2906002)(6486002)(4326008)(44832011);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?G+gTTL/FOFvJOnvwsfRxT8t?= =?iso-8859-1?q?CTYSYW5qcSMLyPEUaOHDcQHeOc1EyzFnSrYdyxMgIXfBq5kUgNJZt16eeHa+?= =?iso-8859-1?q?FuuzW1Cs3OZH1haeNUghpXUZodRAgH7ww0pKqRvDeXe1Xo9JEyFTHhgoQ8nD?= =?iso-8859-1?q?f3J8t7L5V2wXK+q9Sxc7WvqwVRX2vW50AtkZX7bvKiUHdrGk/Q0KLIw3kSzu?= =?iso-8859-1?q?Q6rs2xOEGZWtcoNimnYlHAC2TdDK6H8qp33X/yd4GGX/0mHvIUaiEd2srjcb?= =?iso-8859-1?q?BHNZ8Hs9C59MzOl8v7mqRxM4ALCS9aYiJdABz62uaNPCUalXOEKhiWp35bmd?= =?iso-8859-1?q?88b+sopOHmHM8mteLKbNWMBBZIatPSksMM4Z6NsSgrRaU7eEDvtUs7+3bB1P?= =?iso-8859-1?q?i19QKb/bAu29+xhYxjlMJi6E8wzxflojiffVJ0cjiEIKZ6AFc8WrhM+VaHPu?= =?iso-8859-1?q?VujcS9zamcl74++yj37uq/Wk6ZIGbb/zNxdSkoM/j70cgstTbepvGTjsnK1L?= =?iso-8859-1?q?ZMeACcek4n5p5wM8ARt15r3YzRWaKTwTZzyNj5uCxKQce1vPuh/1oJQMnNzq?= =?iso-8859-1?q?SsnVz509e/aQdkFLhMrT6GbKOlgZCJWK8ktH/CF8Lpmdx20NxheDVNIC9g0O?= =?iso-8859-1?q?IQVDZSBuDc0TRJ71t3CFXM7hUvUYIyEScOCosH3XuMSGzS9VNBtat4bqGEDi?= =?iso-8859-1?q?4YGC5xFMpz18wJq3I3re6Hd+WOywhoWzRS7OGS1SCNgBuWar+8oEk0kriBwQ?= =?iso-8859-1?q?/BbVSbBNIPJSXAvaWa9HzMX/1IYDQwJw/RUIeP4nrp3gkEO/32ddMNBb2ikC?= =?iso-8859-1?q?BodzZtNJegXm65HdoxwoQNvkgPBqsE1jre/AwHAuHptxcFwrlZmsdziOaqS2?= =?iso-8859-1?q?VsdoeqYpKAc5HoROrVWoKktj0kIKSg9gAHM/6jbXa9qQOFzNwQvApaT+ADoQ?= =?iso-8859-1?q?jL8JFhvd+kb6SgWHJdn2v8VlZi85fd3ktg6dKArHgTCkwMI3V+g/0R6KTwZd?= =?iso-8859-1?q?yPDDJzcSc4LXIBM9/P/bx4XPQmU/Y56QyYWGHnxwtseIHdYhypWXZyOwMjyk?= =?iso-8859-1?q?bwGvnrYi91VITEYcTij/6w2hwwD/fSAHdWVLh25Lkn0b3/r1HpgYnWEZr+Na?= =?iso-8859-1?q?zp5xKP/gl25aHH8HSQLwyTM0NMNLfqg1WXMbRGeuhIntA3VgOrhWxkpQgH6y?= =?iso-8859-1?q?HBByRQko+oaHHIZJ6q+gY1hAn6b5NQKdKYrSh96k32dsN73j2w1p0pMxvTyt?= =?iso-8859-1?q?a2DKIg2AlgR21vYpwdwEcAdC5TOIE2uVFpYJE2bDcOg07rwiIGcnShpkfr9R?= =?iso-8859-1?q?x6v0xOgAjj2Mp7rItLP+Ha4yvJZSebzS3la6tqrQKadiiGhiBtdiOvHdQacE?= =?iso-8859-1?q?QE+DsPqvco5Bbu/WwtoV+tvc5a75Fps1jFLgwu5rVAT29s3uqXT3ZohTfeIz?= =?iso-8859-1?q?itdm9bs4oji4S3zFPEorx44rzoaPq+wSQMfd4kBeq2qHaYOk5YhlAHLPQ0+r?= =?iso-8859-1?q?et2rR/Mih6tRprfM9nGtXhcvt3SY5T2hMQAlbDWRVWgPJ9oqSR/M8wgFffO/?= =?iso-8859-1?q?EvgGWPfRjQViaYctgK0t22IcmeQN9mUevrKDQGWPoFJ1D4AUDEhuAwUvFveo?= =?iso-8859-1?q?4V/ZJDFctDbUhaNznlergW0P2MwQA1hngOqhp3//OfGTg4vjuj/6rAmZX5Wc?= =?iso-8859-1?q?MBqaTHTMeP6TgUEB9QuJGu5Wgk0NpnBMvE47H00eBmQijJlfjAI5O4dTT6NE?= =?iso-8859-1?q?PQNU=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: 46991725-e54b-4a25-67a2-08d9bf9672be X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 06:45:13.8078 (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: 8jUx6jihDYYSolgj3DQntJZqryL6G7io7CAwKOZSyoYZuAIIFDd36nzMgrjedNR64hJ6n5lJ97JnRRGZJ1YIOh4Tl6nz1Z2998YsM/u5C3o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MRXP264MB0311 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 25EC218000E X-Stat-Signature: wszprutafkbz3975s4sk6d9i8xnnui3r Authentication-Results: imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.51 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1639550713-651118 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: Do like most other architectures and provide randomisation also to "legacy" memory mappings, by adding the random factor to mm->mmap_base in arch_pick_mmap_layout(). See commit 8b8addf891de ("x86/mm/32: Enable full randomization on i386 and X86_32") for all explanations and benefits of that mmap randomisation. At the moment, 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 +++++++----------- arch/powerpc/mm/mmap.c | 2 +- 2 files changed, 8 insertions(+), 12 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, diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c index 5972d619d274..d9eae456558a 100644 --- a/arch/powerpc/mm/mmap.c +++ b/arch/powerpc/mm/mmap.c @@ -96,7 +96,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack) * bit is set, or if the expected stack growth is unlimited: */ if (mmap_is_legacy(rlim_stack)) { - mm->mmap_base = TASK_UNMAPPED_BASE; + mm->mmap_base = TASK_UNMAPPED_BASE + random_factor; mm->get_unmapped_area = arch_get_unmapped_area; } else { mm->mmap_base = mmap_base(random_factor, rlim_stack); From patchwork Wed Dec 15 06:45:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12677575 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 610CFC433EF for ; Wed, 15 Dec 2021 06:48:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 74FF26B007D; Wed, 15 Dec 2021 01:45:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AD506B0081; Wed, 15 Dec 2021 01:45:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 54CA66B0080; Wed, 15 Dec 2021 01:45:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0026.hostedemail.com [216.40.44.26]) by kanga.kvack.org (Postfix) with ESMTP id 468646B007D for ; Wed, 15 Dec 2021 01:45:29 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id EFADB84CED for ; Wed, 15 Dec 2021 06:45:18 +0000 (UTC) X-FDA: 78919091916.29.ABD43B3 Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120051.outbound.protection.outlook.com [40.107.12.51]) by imf24.hostedemail.com (Postfix) with ESMTP id 03071180011 for ; Wed, 15 Dec 2021 06:45:15 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ntvEBT4LJmqHIEe7Rbt8PnQ/6fvgJCZfYOF0CyNPE8W4Fu1YzswZusQZpiyek0a0pNLw0OEHoDXC8inW0RVlsxnkWyAS0K4iN9szwsDG56Da+HviZVKAQSqSRfIjaq3rtxZjBlGhVeKeA/M2pUi3xX2lWJtMu+WjhVY6GGc3Ad3fF8wDEbw6S/Mbbdv/4oCkGyCTzcHKCvJEsKaEz34oJJIWkS2L2ZSr9w8N+EXDW03Djn42Uwg0/NhOLgdjTz/V3tfiRqIy/fZLDFhGeDhOs5ChiOJQAJ4gD2M5fPjLM4ZC5bf5O0/HfY99phE/WZjbV0L4GxZfGDDZSd+K7kJnnQ== 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=gGFW1HR24WYAEOnV8dd+oFOXUWflLAKM+E2nFCnaGvg=; b=XIFEG2C9ct2Y6EzAudzpbL8L3UNIOrxCU4aYO6pfsHZgJ0PU2Cp+SVyZ8Otsx0jOZJd+kBgee1DcQHFlOmOl6RRNkvLnHBiPOjoONIhh4xJgXsxgfZ5jr1ALagT2WpRbAR9jQLLpfFrGiyvzIUTi8Kk8r+Vee5H3HB8LFC2HzXKRHVWPJcy1E+qwbCisR0p8W1krGvekIyQKIJ/tLSAMENQxGcRHupC2vh8io0xyyLUGkzrmJRRMbJjny9Z0Dgfn8IYm/5/mAzoO80QIfvTwfGhCsZHuJOw7GUe2Yy7hxXfjjC74uNQzt5edyi7c74e3Wio/ZF/K/hnyLEI9IGmhdQ== 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 MRXP264MB0311.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:22::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Wed, 15 Dec 2021 06:45:14 +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.4778.018; Wed, 15 Dec 2021 06:45:14 +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" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v5 11/11] powerpc/mm: Convert to default topdown mmap layout Thread-Topic: [PATCH v5 11/11] powerpc/mm: Convert to default topdown mmap layout Thread-Index: AQHX8X9Qgu4CnQ/bmEeq6LBbICcf2g== Date: Wed, 15 Dec 2021 06:45:14 +0000 Message-ID: <5eec7cc6923729d067b8f09347862408e2ad993c.1639550392.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: 90b879a6-783c-4342-4579-08d9bf9672e7 x-ms-traffictypediagnostic: MRXP264MB0311:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:311; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: n72yKB2taiVYT+O8kPr65sbc3VTjFXVwq63ts5FZ6ITnlzwPpQ1B1a/mSUcZJLB85ac7TgfxakGGDdwawkni1ctvgig01faox35bWeybsQ5CqTc4TYpSHK2a/XACPrFJu2sZk5CykUSHcJAPcvgTfMaZyu6AY3yD4JNf8hYMx3ErjPMv2xPwlIFhysDJbVY2kjObdCB+30wvXQDEHtsCPMjvwEqTVgm/xjpZ2xLJpxpBKrRi1hMOydXUSwSoxfN7AADeAdXIFdYLfMC5t/k29AWSoAHUWi+fXmE7ShrmhObZ9Xxz1DWUSbMrH8QW1DBO9EoyhSqyHh7ZTru9pBV39wLec/aFVrbv2UDqSfm1O6KV2XlET9OImH0MRVFVgRk8wF2wpkh/jGtlvG1K4spUrg4h9/hwWU2IPxX2WoJlU9KuN3Emf9P9yP8TkSvoOo1YEF/vXqHIsaXUVK/lSIvtP63kQobgbWiPMgA8F7rrcFB2AjXtFStizBqSkSupBJgK+CGSSbG9lZXYdgmyrBjyhhALfJEr5HrycKHkgfEKcPO76WJ+D68wdjGZtH9y+7X3fMj+/R3ykZMfCgscOIXakuaFCpKImGfWKaDD1YmXSpWa21haSOMLEyX0LOgpkhDpo8H2g02VF12CRzbJ0+ZIDIYhYHHwBrBdF1rlM9D1TVvQ0KOUJSD+qM1ICYdSj3sdvE736lREGAlZERmvunaHLw== 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)(54906003)(36756003)(86362001)(6512007)(83380400001)(2616005)(26005)(76116006)(8936002)(71200400001)(66556008)(66476007)(66946007)(64756008)(66446008)(38070700005)(186003)(110136005)(122000001)(38100700002)(316002)(8676002)(6506007)(7416002)(5660300002)(91956017)(508600001)(2906002)(6486002)(4326008)(44832011);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?g4ufxBQ7oJ7emvP3hxpJ0pp?= =?iso-8859-1?q?143doKfqy7oV2PC7dYp8KJ0OJETLyygSbdQpMUI9X61+gl2AqSWOtiuhJ10l?= =?iso-8859-1?q?cBAaHG7rz+2LH9Q+1RLJ7aMKzphCrErELpf89ezrNJnbpBwn0D4XHMLrkKpK?= =?iso-8859-1?q?g8DyOFMoaBgmNvLP4sHSZ+lZeSnDnnCyRLjwRFjZBBWRA+OhkF3rdDp3lyvU?= =?iso-8859-1?q?EQ0xebD2mK9e1bTzLjOrdzpHvsMQ6DOQkAadURAQVbu0f8iWFWmts93ud26Z?= =?iso-8859-1?q?t32bscpmdaeJcz7Ujsw9r+uRuzq8TgiChiRcj8UNPmXC4sihNOqz557UXWTi?= =?iso-8859-1?q?Wha6da33CO+oDRM589mRJgoWb6k5vfCXLJoeSXsn6vd+iHtrWYGbRpUNdXKD?= =?iso-8859-1?q?BEBVEQPUevulpgdAKC9bu4nPC5Ny7nElWRvsgB9fYTdp7ZlC+GKiiqigDjUQ?= =?iso-8859-1?q?5vPnU9PxipX6dA6O7DGs88I98yJCqKaboL66bwugEQfoHIXFKOWPPt5iBDAa?= =?iso-8859-1?q?nikdrzIt9rX5KVXzEFeSslw82NFPGqtAAlLwgkrGKFGPh80uLZm87t3r2/bA?= =?iso-8859-1?q?LD6VZ4GsRFUeftLWwZ1AjhHFKoXqDAg4BMe+h9bo5e/5jj9r9VDXdCtCWFb9?= =?iso-8859-1?q?y1GViJo1UuD+t5t8eeNXHiTm7B0hWVZADVosuG8jHxL6F2BCp5ce3NN+NNuF?= =?iso-8859-1?q?oXRxsj/IuZBBuhcugzuJSemgOYPxBkM+V/4UdDGPAACSkEbAG3q/GX7ReWs4?= =?iso-8859-1?q?wM1KrBBnH1OUT9MpOsGBPuY8240Rsaezu7n+PVPRuLcR0ES07BOWliG3NWFf?= =?iso-8859-1?q?yAywVFsiZyO2uSkl39pKuPZ4z0HGW1mGqs9I96ousGUMwt+ETOjpmWzUX4LD?= =?iso-8859-1?q?KfTTgsaz3Rm94yvdWZZVPamsuqij7vgsVbbSTOqQVSWVCB4kfT91BhPxjfkI?= =?iso-8859-1?q?kmm9ofDOS8LHprRVlNpR1PU64ErLZN3aaws7VGJjYTeYX8wPDaZtkcItuGoc?= =?iso-8859-1?q?oGJv6Slpb5RanO7Rcp+2pzKL+Z/9T57ijC/YWqf9bpo5W+j66CnYzgtgCnTb?= =?iso-8859-1?q?3b9HjiYoDbIQu4zQarlAnKNRH6WH03FUJY/wr+VGwvbujfeYvgKTTpWxM/hm?= =?iso-8859-1?q?x53BmjM1wOJ7ty52IDjFoHwd8ZUU96IxXgveXjKzali4ygjh5OySQj7TvG0+?= =?iso-8859-1?q?29DLLgf4zYsMpFUprbN0VIE8L+tKSEXsK0HLH5UyBrS2qsYSUeEwTiEsHPVW?= =?iso-8859-1?q?Vp7CzTs+JstIiEz3bR+aA2D/5Oej1pNMUTpzBRThdPlufNaz0NJFlrElkY+7?= =?iso-8859-1?q?BwRCgLPad9iSyBrIcKjGkqWR4ml/2nWDrUXpk7sg+S1Y2P5vJnO1OcjQ98tP?= =?iso-8859-1?q?76+C1OJr9l/OT+pgmwcAuX+QdGi50ub5c98Isy0DBuev3W/LPC37SRf0z880?= =?iso-8859-1?q?TlusMkEp31FV9ljLOXaRb6PFl5nTbl/eiyF5sGe1q1yieOyu6LZgris2REmq?= =?iso-8859-1?q?9IZN8lbnru8AHZdKX5ixsJxL7WYRnWXslsP0BM4jIHMVWO75uZ/BU1uPR8Fd?= =?iso-8859-1?q?+S6Fzo7wPXHrvzKYWfCmaufLyU9JOBujQSwAcOiiiRrmE56o3J4C7EUHGOPm?= =?iso-8859-1?q?3HA8O9oHOpumIQKzsWg0/xaGSJXT9QKMgR0WIgVIyX2HDAROmRxi/mJrQ2Y5?= =?iso-8859-1?q?/ZaFSqGj2Icsmj/s8AGnqzPlj9rxF4RPTRGn6c6ZhhTF9hj9kKOLjZ7zLTED?= =?iso-8859-1?q?m/5o=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: 90b879a6-783c-4342-4579-08d9bf9672e7 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 06:45:14.1154 (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: N08R0KTlVWtvybxRkU292ReBRz55Yiw9GPwuuWNdQPm4i9eJRIK37pIHCQHBSG2nTczlVHISAHzp+ABHOCXIvTniIYdPFHNg7YM/+UektaA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MRXP264MB0311 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 03071180011 X-Stat-Signature: mrqon6r5ywe1m6zwc1te7biq8ptk611m Authentication-Results: imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.51 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1639550715-26358 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 reuses the generic framework added by commit 67f3977f805b ("arm64, mm: move generic mmap layout functions to mm") without any functional change. 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 identical. 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 d9eae456558a..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 + random_factor; - 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; - } -}