From patchwork Mon Oct 21 05:39:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Shijie X-Patchwork-Id: 13843572 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 81F6BD3C93E for ; Mon, 21 Oct 2024 05:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding: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=CQsNfjx/IhkKg0ZPpcHM7GTbIkISt3CJbYTz+tebI+Q=; b=buTgLGSnyJl+4vkxptkraWP+uQ IM9Rvubrj3yQcGS20lab3Os1RJG/u0JLMuThmbfhuv5NmArMSV3agHF6AEwsGRN3//Tk3IGC+Rdjs jkQ6Kwh+90WTshX3qk06EOS/gPjWPDm2rpDhisqKcFuMjGzlaX1gvwp5I7BQPV8jYJKkn2UjwGxuT xHGYI+vb9amNh0rhd2ZYYxyc6pLIzZr34ULzMRAVLCXnyJUvJErIZiyI9u5r4ArGvH8uTfKWtyiCM 6zlgrOr3z26Pusp5RKIz6FGqOumGDJ/9u+TEm7eLUuUDd+3v+zmPDeyklMNN6Ff6FuvPzc2CBHzba Gvr7FMmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2lBO-000000066Pj-0nFe; Mon, 21 Oct 2024 05:42:22 +0000 Received: from mail-centralusazlp170110009.outbound.protection.outlook.com ([2a01:111:f403:c111::9] helo=DM5PR21CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2l9u-0000000665h-09Dr for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2024 05:40:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pnp7EYWS+HeypCQtJlHVg5l/nE8hRrDwEouXwCThF/JKQCMXxKRTxmkt2mx54R8Rmu++9Y6V/I/6qxvPJgKdB5xKyUieQlKVajf+yAXboHOVvNzcj41VHns67bUqT7J3v0VkSXAaHcinQIkl0dA3fU9DblgSlKU6mMSauwcK+r62lOT8Un52oXzGdMJyNYpSrrkwQsMBPJXBIXi7kDiveLQsnPWer3BJyiekb0t0AQSApMLSHvZtLFKlg/VVXxgQsJT0VmMduLzIwWpnHPcMEeaUTDTB9l/QbkkvHG28OZ/A8EOZlMQXc0URMxTBH9cOSUf32aAg07oHJqwmC7Fq9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=CQsNfjx/IhkKg0ZPpcHM7GTbIkISt3CJbYTz+tebI+Q=; b=WcrhFoMhbmoRJ11wdSleIsmAJiUVqguVD1lJbWaKIyNaBwoVDaYC93ldD+z++4iJ9DB4pgrv5HlhQueLhhWdI6PcNQ7ylnyDTTZKxF/qES/5epDtYQ+vUFnYQdkdHMTdJQjsmGqjhKGIu99KABn3u+UAvHyFHEtBCaFbJn/IItm1mK7XMQUnNJ5fwRBVzDv1iRFSGlVlZFdCDOBp92vK9PlE6+tWZxsKy+tc4BLw4GrIhvR3UFpB4NulSkcF6bKx2BaE2nzXwnxLAXAYXj8OPF+hlhCfAg3KLjFA7pfBEPSaBDD4i4DIAxuw6ATPnq0LveZdz117Axt2lOnnVRrtoQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CQsNfjx/IhkKg0ZPpcHM7GTbIkISt3CJbYTz+tebI+Q=; b=QZPQX4SD+YA1gmfe+BVS8VKBSotilyiPc5esy7TJAd36ch5UkOvmF02XBW/LoLBWr5ncdRBHcImb0wm/NFYi294r95ahsoSu0CC7jgAxRye5pyZsCyrVsbdpWfhaNeqTd38cuyUwZ+uKxGDG7XUvYEatHnfw4U70Oo8Xtpq5BW8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH0PR01MB7975.prod.exchangelabs.com (2603:10b6:510:26d::15) by BL1PR01MB7698.prod.exchangelabs.com (2603:10b6:208:395::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.14; Mon, 21 Oct 2024 05:40:38 +0000 Received: from PH0PR01MB7975.prod.exchangelabs.com ([fe80::6926:a627:118e:8050]) by PH0PR01MB7975.prod.exchangelabs.com ([fe80::6926:a627:118e:8050%6]) with mapi id 15.20.8093.013; Mon, 21 Oct 2024 05:40:37 +0000 From: Huang Shijie To: catalin.marinas@arm.com, will@kernel.org Cc: patches@amperecomputing.com, cl@os.amperecomputing.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, adamli@os.amperecomputing.com, Huang Shijie Subject: [PATCH] arm64: set "rodata=on" as default Date: Mon, 21 Oct 2024 13:39:48 +0800 Message-Id: <20241021053948.5848-1-shijie@os.amperecomputing.com> X-Mailer: git-send-email 2.40.1 X-ClientProxiedBy: MA0PR01CA0044.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:81::17) To PH0PR01MB7975.prod.exchangelabs.com (2603:10b6:510:26d::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR01MB7975:EE_|BL1PR01MB7698:EE_ X-MS-Office365-Filtering-Correlation-Id: b04f67da-ac86-40eb-7fa8-08dcf192e3d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: DmtExvhIoXfu2aKqPoIkcB8YV4ORunkT3b6TmmWIUjPN8O0WXEr7lD3W0KczvKXEsTQfxt2AxXxSQimnjw4AuMU0fGV9wT9dP8TJUTetjFR19+LI2n9NT3XRWEb+IIXp619cf7T+mztmpmlSV50d+PpEnjbB6FCUJQfqvfRj7G85Mb4QuxdQEM1qJyrRN7y176VgpyZ72FtukNKUfy7UbTVIttrO5J4js/YhEgXwwrSgaSiEI54ZyrSsu9UjT3ba2uc93wW4I0s8g2Fv+7XCJz58PHoX/piNSesVDNdLPnDKxNFLRQIAj9HXtxiNzUegjRjFpD5IjbWLCyg4DfivAbFkEdarZETme3aCNc03hOOvHAnbmkK5PHgfWMF3cg3otSy2Q/SGx9tNaBRCECVbdgzhL0AAEYMXKj2xQM3vKxE4FG1ce7YDKddoav3fgOtBx8EivaCUZQ/rSDvwfAUq3sUD5L6NPWqKqgFko7sC0WUSMshXRwUJt55pACXAxuWMG9qLn1w78ATMHhcgiDZHHtddXnOqKqey+aphhu/+CMSseH3RDWlwAFQ8NDl5nfvshjiNqBQ39o5LLiT5j7m34dFNvH4RU1vYRbH0M4/62wrCWx5Z+7OqR0c9qu1fSuSyFN3E0Eo84zCQPjcI3Ny5JWTCG4QbjAembDyX0QwRXeSTc5sqGq+nNhhI6qNlnDMIn/yeKrjBOoml+E5nF24181Fd2CaGNY9pN9qyrN34ntndbY6wGnVNSPTo7bSXYx1uMJiecUKGsPESl8uTi/wmR4zP60TrEQJF96EkFPVAfrjVG/mZ0SbI/7s3mJVdzewGlVrU+VLc+GHMczl/Trj45Y71aq+9hm8fZl0uHNFipwu5tQtsMxUkg9mjnle5smwgU9NjPSwNjOTGswZUZtH/wYmJaAuVe3J5xO7ytajEqdzJ4XBTR2e3kIduiC0Gz/Ws9A3pUg16My8COJKtzEkeOJu1Y3bD1+46qV3yxqw+BbLNb2Ns+ylJj1lncfowAlItv7sV04NCj7WiFDOy07u2wHoFeoYeFYALWosZBVRp9fRFwT8ce97DvFuFmbk3lFOPqoNqDoVBf4eW9jiD0eDSXUWbPrGWWtHPP8fM5tpIh05nRYxGtjDpkrbQrF5T6PQlG5aCt5DaKb3GPDo/LXqBySsTrzN9aE882OgtSovc2MF9wNXuzp7qwIYuy/y5yzATH1RkeskpuLJiEcQYyznOW1SCA26yA/6QN8tH60diUx3VLHbwOH8TnXqNUU8ATsinX/azkFfNunfMZyQyEybJDbx7xUWZYzMt/Z2BHAzflqmxYW4HYcuVo5bxO5yDOPh84VIjDyKDxHZs71+5dnjTwTQvFTAO6TsZehzFPn5+E6g= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR01MB7975.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(52116014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KyFUknUO9EdGuBsI6dT5I01S7XNz51XhE6P8AQNs4m72Whsynip0HPKCbTXTx726ixkbkanyJr9ZYO1J03kwZXCJSTQIEZzGRatJi4ydxt9Gn/YwryIONe7HTiVchxKhbyqGUoH/00M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VzkOkh3gKTWxt3GefYdMPCK4xs9T2utpbZPcwPdaj02hnP8mef1C+kisEkDmItrL0ZB3tt8WGzsdroeGXiFfJJntrq1kfz2wp2a0SLJ6Zv9vYyjKR4jTtWGSTxC8Eyl8G+wpF+pPl+LPSgtJC1YcfKG4niihmYtDSc4GGy0GbG68veiW64UG1dDN05FEEUXcMo2I3EeoewocjR1fS/SW+fXTMBI3EXNQMPdxoKMdkwf+ABjmnCNsOKZdPaC3YsXPqUn1cgieN2S7WkvMyvpI5rn1v00kJIPQ4pPsZYC83+N5HcTlOZ8Ei4dDRLoT6QE9fFbd5JOzANrzJB1Vj7Zo5oO0dnTOah0danZjJWJzNmDexBKgSn1YjALjicBq6Fq+Z9ydBpiLe9qCtVthF5LOtdYMc/+qmhgy30tQY+xk9Q6tIxe4Kc= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: b04f67da-ac86-40eb-7fa8-08dcf192e3d0 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7975.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 05:40:37.4973 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Oa0JfyOUfhDXtTFXckLmEo9KYjQunFlMULF3nMLV/mAu9AQ1wWZH9ZW+0kwvmDGM16A5y3r5JdPsJPBJ8AkP/eAnzYbj/OoT0rXkbSPNNoVBrSr02SxWdyf67ESzTyt1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR01MB7698 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241020_224050_094709_144054E5 X-CRM114-Status: GOOD ( 12.30 ) 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 From Documentation/admin-guide/kernel-parameters.txt, we know that: rodata= [KNL,EARLY] on Mark read-only kernel memory as read-only (default). off Leave read-only kernel memory writable for debugging. full Mark read-only kernel memory and aliases as read-only [arm64] So the "rodata=on" is the default. But the current code does not follow the document, it makes "rodata=full" as the default. After patch commit acfa60dbe038 ("arm64: mm: Fix "rodata=on" when CONFIG_RODATA_FULL_DEFAULT_ENABLED=y") the "rodata=on" can works fine now. The "rodata=on" can provide us more block mappings and contiguous hits to map the linear region which minimize the TLB footprint. And the linear aliases of pages belonging to read-only mappings in vmalloc region are also marked as read-only now. This patch disables RODATA_FULL_DEFAULT_ENABLED by default, so the default value: rodata_full=false, rodata_enabled=true then the default behavior follows the "rodata=on". And we can get better performance with the "rodata=on" as the default too. Signed-off-by: Huang Shijie --- arch/arm64/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index fd9df6dcc593..6f30f749156e 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1649,7 +1649,6 @@ config MITIGATE_SPECTRE_BRANCH_HISTORY config RODATA_FULL_DEFAULT_ENABLED bool "Apply r/o permissions of VM areas also to their linear aliases" - default y help Apply read-only attributes of VM areas to the linear alias of the backing pages as well. This prevents code or read-only data