From patchwork Wed Dec 15 06:45:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12696185 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4FBB5C433F5 for ; Wed, 15 Dec 2021 06:49:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=s21DIQ2Ei5+ONw1mVprBhJQhBYMIzv40JvjCrc9dCR0=; b=p0P7XvZ2laKtDB sTZGtTWPc4pvFybBNy4EhDkzEOrc/aizmGH3GXhOpXYt0S+3tzizO2HZg5SsBGxvFcmpmb0D7Frkq UCXNYOpLYt3uomwVYrQR9UEg0KEL/4tk8Kzj0tD4GuOiRDv1Fp5WljOa6wSJLeVMP2RGtMBHPCTqU A+7qkAlIS+jnmvhMDBaHnvQCbzU7vysUDxgQbeAqUuxavV/DsnHxf9kkqr4m8OhBWbhY8g82uBFr3 PmVXdIhUxnfGgFqWAC3COFxF2A8EDkIrCxDqmpmrbPIJzu0zxL4/h1m+tj5YhALEV2oA3KeKSCWOE 608FIDuHrJvSZYFsXFjg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxO3z-00GxsG-RI; Wed, 15 Dec 2021 06:46:56 +0000 Received: from mail-mr2fra01on0607.outbound.protection.outlook.com ([2a01:111:f400:7e19::607] helo=FRA01-MR2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxO2T-00GxOn-KU for linux-arm-kernel@lists.infradead.org; Wed, 15 Dec 2021 06:45:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oTUDdb+u71wh+aLGW3mGLRleQKf6CG3xrp4ZxI9QAtYWpwOzTHACizxUTxMfWgCDuj8aQ7kxRnBob/S1qjFEAvJT79QhdBpw9Xre2elHRbX5Rj13dDoI5pzvzLfOIOSA4J5THMSniPzH3i3kqOBBCD3g06Qrnc48dRZFwrOclZkoBvSjr7rfSWemMvwKl9RDfFLCg0N3WloA2U9rGpDiYLVMSjIiRTK5EzvYBCvXD407PGH/jFJa1XIlspjYzWq0Nkz1DKbVlRP7U5Vy9rMwztzeQmVL1At+TYoQgB8H2E6mK+enbWCKhHOqYkwQ6XoytPUJmwMLefCT2N6AFp/x7Q== 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=Pqu5t7ZEZ75ytmq48ajhVuqgPowqyRBUVN8Qaoy7bhY=; b=YxN5OzpO9ZXVjqThApDuyQYW+3g1rIRNr2FDertCO/IyJ2mbV7rOxnfzIhjN2NBzwJgqOfAWz7WszrpEMn/z5hQfl3+B8/LQ5dg3BLaYIHd3oP7kLlvAU/2fLs+GBdKwCecnMLjgnDkShu+x8fzXiHLHZJbwid3Abael8mSiJes3+XaiR/6k5i0gw5WbBDACzh9tBlEbAHNqHFDugIdAQ/EWdskJ3rtWguMkSjR4voPUr9DsDnnV43Wfi3JqZSJQXlWj03/3RxTGNDlWqOtvKpOz8GIZPH9rQx7qzXmZ/NwOhvVBF798OLSx3tUb1xY0+t0igLn0QTkGR+CXOBMjWg== 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 00/11] Convert powerpc to default topdown mmap layout Thread-Topic: [PATCH v5 00/11] Convert powerpc to default topdown mmap layout Thread-Index: AQHX8X9OSW2wRX7ASUO4LGtq8Gx6qg== Date: Wed, 15 Dec 2021 06:45:10 +0000 Message-ID: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=csgroup.eu; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2595facb-d1a3-4fb8-578b-08d9bf967102 x-ms-traffictypediagnostic: MR1P264MB2147:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: mfQILF/pzbSUvQT+GMeMJfYYaYKkVIMnh0e0Er3LHHgJ/htpCm7o0xnGN7zMGc1PW1Tb6VIuXhcFR03DkNp+EdQtkXWWzewdx7ywtdH5bdfr20Ujha6s96COKAXWLcpyUkMJthzW+awhjV6H23ARkJ0uYXOnNjHbn0hipNhHIjUFs/gdRAKA/FaCu08Y1YHWrDxjbyoeWXle0maGjm+qFoLPO3XI+DXQ7GAOAsmluJF6fEdXlHztiiYlcI1tnXzZr5evFUVjnuqTeLjodlivEgDBlrPs8RWg68mU3Ds1uyDWH1vh+zzAxs/L8sVBjOAjPZl4bFi64mr7eOZcuXNfuZK4WcbGezpD4ilP6xxDzJdKKrQyxUjyDCgdwps5CxsifSsItuU0T4Hz4RJjuMyTjTqWJhQO5dMFn1XE10FFYO/drrxMTGbDt+9Vmnq4cQlwBH0YmUqja+XzivLeSk4CTHsLWQoLjNSOpJ2eiIhMcmGvDG/7Fx08VSDJeiNy9bDLb/2VP7tIeAntTKaQgKZMIJUKfPg6Fjt001eFXCOxB3jKIMLSoxMn5Rqth8217UwVkAEKPCl9hyppOOgLiH5s/O7+2e9KZykiYX0iUHZui8bhaNgmO5t25HIqCLzPO5JDfRryfCYJicKHo4yb58P6t3jPhI/jr/kDvt+Jwgzf8rgfxHn60fxkUf62BPqmSDneeJtCDu76bSAxTx1hA+St+g== 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?KUeyBv6FmqiHVQV7gmP5zPz?= =?iso-8859-1?q?UyLMirC4HLMDJyZ9uDGzB8WGpYD+UdeAUIhhhP1iUXb+avpOIzDYNXGocYl/?= =?iso-8859-1?q?8jN/MvQvDt41e4WiA/PwlLkuo4R1/nAkJdYBx/S8EwJQR/F67tkS6dXtKvxZ?= =?iso-8859-1?q?gdwjWdJwbJqLm+65KRivxUznH3+XgFoEuTQg2XsTCLDU8e6hyZdYTqryIa6T?= =?iso-8859-1?q?WeVuaFy/bEKm79GpEjj20gR83R7RUgqp6pf6LlN3hCKds9f3f2ar1MTxqsBH?= =?iso-8859-1?q?nVHOwyySi4KNG8QCv6xJnhrLAW/gNoS3k+1O+zLdflqvtWQrLE0HNyRw8aMk?= =?iso-8859-1?q?6hUuqp5uOCGLSFfEikDnO6V/rcdaCHo8ncj77Is+d9PPFweF16HqywAp0leE?= =?iso-8859-1?q?OhX0eZp0r0Lap0vmIs7V5IilW3w2tuO5QMiNi5TFO+JjUfCLiF9Cmrj5AfmJ?= =?iso-8859-1?q?/oxymb0enfzhpY77oD2f6GZWdUZ+z2iHRGVWpouBVdoTLmPzddQg7QarRkxT?= =?iso-8859-1?q?HzZGphXwE8XaxqpcpB08AhVFRcSbRX1KAfHIBkdXeNQB2D3oNaJegktLv96v?= =?iso-8859-1?q?y7f1XDlx/ETQKEEIwBMoL0jsETMgqQXZWpxYvH/ViK/XlUt9gMkruVV/Uc2l?= =?iso-8859-1?q?FHWYwFCqgoWSgQo9GJo3m+PcCO/uScxSoIDslZruekRNyAVbfynGfKAsjoo2?= =?iso-8859-1?q?F2m3AF7SeCgSe3baT2qu/u0XniT/UyJKhreEnK2YPqfOL5hXWP5x5u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J+BKuTod8oE4qDmUr5M/GpnY5/vj1txJcr3NVxu1wsPpyvjcnP?= =?iso-8859-1?q?wR2DHspWfaSTScBV4pZG0+pMul+F38MsY6m/3qQtPepcqMgl4w8u3asEQ0Rw?= =?iso-8859-1?q?StoE=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: 2595facb-d1a3-4fb8-578b-08d9bf967102 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 06:45:11.0250 (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: fJGbtJcun1jftXUfS+saOaAnu26d2ZGJxmljyr4PiApGrH22UhNwOMyd44We1F8L6o4rjzYeWEcpB46zaxw7XwZU1sH6+jMuZogPXIUga94= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB2147 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211214_224521_781008_DCEA5E69 X-CRM114-Status: GOOD ( 14.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Rebased on top of powerpc/next branch This series converts powerpc to default topdown mmap layout. powerpc requires its own arch_get_unmapped_area() only when slices are needed, which is only for book3s/64. First part of the series moves slices into book3s/64 specific directories and cleans up other subarchitectures. Last part converts to default topdown mmap layout. A small modification is done to core mm to allow powerpc to still provide its own arch_randomize_brk() Another modification is done to core mm to allow powerpc to use generic versions of get_unmapped_area functions for Radix while still providing its own implementation for Hash, the selection between Radix and Hash being doing at runtime. Last modification to core mm is to give len and flags to arch_get_mmap_end(). Signed-off-by: Christophe Leroy Changes in v5: - Added patch 3 - Added arch_get_mmap_base() and arch_get_mmap_end() to patch 7 to better match original powerpc behaviour - Switched patched 10 and 11 and performed full randomisation in patch 10 just before switching to default implementation, as suggested by Nic. Changes in v4: - Move arch_randomize_brk() simplification out of this series - Add a change to core mm to enable using generic implementation while providing arch specific one at the same time. - Reworked radix get_unmapped_area to use generic implementation - Rebase on top of Nic's series v6 Changes in v3: - Fixed missing in last patch - Added a patch to move SZ_1T out of drivers/pci/controller/pci-xgene.c Changes in v2: - Moved patch 4 before patch 2 - Make generic arch_randomize_brk() __weak - Added patch 9 Christophe Leroy (11): mm: Allow arch specific arch_randomize_brk() with CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT mm, hugetlbfs: Allow an arch to always use generic versions of get_unmapped_area functions mm: Add len and flags parameters to arch_get_mmap_end() powerpc/mm: Move vma_mmu_pagesize() powerpc/mm: Make slice specific to book3s/64 powerpc/mm: Remove CONFIG_PPC_MM_SLICES powerpc/mm: Use generic_get_unmapped_area() and call it from arch_get_unmapped_area() powerpc/mm: Use generic_hugetlb_get_unmapped_area() powerpc/mm: Move get_unmapped_area functions to slice.c powerpc/mm: Enable full randomisation of memory mappings powerpc/mm: Convert to default topdown mmap layout arch/arm64/include/asm/processor.h | 4 +- arch/powerpc/Kconfig | 2 +- arch/powerpc/include/asm/book3s/64/hugetlb.h | 4 - arch/powerpc/include/asm/book3s/64/mmu-hash.h | 1 + arch/powerpc/include/asm/book3s/64/mmu.h | 6 - arch/powerpc/include/asm/book3s/64/slice.h | 24 ++ arch/powerpc/include/asm/hugetlb.h | 2 +- arch/powerpc/include/asm/paca.h | 7 - arch/powerpc/include/asm/page.h | 1 - arch/powerpc/include/asm/processor.h | 2 - arch/powerpc/include/asm/slice.h | 46 ---- arch/powerpc/include/asm/task_size_64.h | 8 + arch/powerpc/kernel/paca.c | 5 - arch/powerpc/mm/Makefile | 3 +- arch/powerpc/mm/book3s64/Makefile | 2 +- arch/powerpc/mm/book3s64/hash_utils.c | 14 - arch/powerpc/mm/book3s64/radix_hugetlbpage.c | 55 ---- arch/powerpc/mm/{ => book3s64}/slice.c | 71 ++++- arch/powerpc/mm/hugetlbpage.c | 34 --- arch/powerpc/mm/mmap.c | 256 ------------------ arch/powerpc/mm/nohash/mmu_context.c | 9 - arch/powerpc/mm/nohash/tlb.c | 4 - arch/powerpc/platforms/Kconfig.cputype | 4 - fs/hugetlbfs/inode.c | 17 +- include/linux/hugetlb.h | 5 + include/linux/sched/mm.h | 9 + mm/mmap.c | 37 ++- mm/util.c | 2 +- 28 files changed, 152 insertions(+), 482 deletions(-) delete mode 100644 arch/powerpc/include/asm/slice.h rename arch/powerpc/mm/{ => book3s64}/slice.c (91%) delete mode 100644 arch/powerpc/mm/mmap.c