From patchwork Thu May 18 17:33:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 13247176 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 E6A3AC77B7D for ; Thu, 18 May 2023 17:34:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8EF26900010; Thu, 18 May 2023 13:34:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 89F1B900003; Thu, 18 May 2023 13:34:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 76758900010; Thu, 18 May 2023 13:34:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 66D88900003 for ; Thu, 18 May 2023 13:34:53 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2A313408D6 for ; Thu, 18 May 2023 17:34:53 +0000 (UTC) X-FDA: 80804076066.02.186F1B4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id 696A68000F for ; Thu, 18 May 2023 17:34:51 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf02.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684431291; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gh+3BJM2SL1SQbFVnuGwYNETki1VdSuu83rEIeI6iP4=; b=u2idiKCpOtPlmpVKigiy5GBc7COEyJqKCP3CDMgLx/p2Ip3DKJu+76ccHxiU6N3qprhFbF iuO8CKhp8XSGVcxiEZfHV0heHqNOMv/cHVU/ycWuOrxVPd8v9u3Qp+H5F+W16ZWZiAri6j zlW0rjHg/pqD+88wav9AaBD37lW70IY= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf02.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684431291; a=rsa-sha256; cv=none; b=66IKTgzjjnefhy4RoGMwGSCcBWOTNTJK5x9ZZ4N5G7ErtGp8+YZXF5zaqCWWVFjJFYI11u ZBCjUaGEZUA6V2t2yCpdPQNp2pasUeBpo6GJaJvYOHxRCZZ1/hUI6jZBz5YeqIekxbYKin WXg7hPg+zHnp9JuMpjLoAmc7BxdCjuE= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 67D686515C; Thu, 18 May 2023 17:34:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2686AC433AC; Thu, 18 May 2023 17:34:46 +0000 (UTC) From: Catalin Marinas To: Linus Torvalds , Arnd Bergmann , Christoph Hellwig , Greg Kroah-Hartman Cc: Will Deacon , Marc Zyngier , Andrew Morton , Herbert Xu , Ard Biesheuvel , Isaac Manjarres , Saravana Kannan , Alasdair Kergon , Daniel Vetter , Joerg Roedel , Mark Brown , Mike Snitzer , "Rafael J. Wysocki" , Robin Murphy , linux-mm@kvack.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 10/15] arm64: Allow kmalloc() caches aligned to the smaller cache_line_size() Date: Thu, 18 May 2023 18:33:58 +0100 Message-Id: <20230518173403.1150549-11-catalin.marinas@arm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230518173403.1150549-1-catalin.marinas@arm.com> References: <20230518173403.1150549-1-catalin.marinas@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 696A68000F X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 7r8nsidw1ypcrxnxsrcakirkrie3tuq7 X-HE-Tag: 1684431291-978642 X-HE-Meta: U2FsdGVkX1/yTD+xD1gS35+KbQ/V/zB+l+nzDIJ61JabnMTpF4fby1rU1Mihs8QbyczhKjL2p7YLZ2jvPdT3FaDQGySaKULxRNDIY+hZpabeLSgvoWJfKo3LwVbRthPXaqCEEOjAvo7XxPROsc5nZB96wwq8iz0PUOSseggTJoWwrcMYQYa98fR2NfZk1AgYkosnrL3WrSZ9B4LcYT7TzmP3ofdW8VVSTAsx+jstcorNKaI5/afmptGNWKan2vwUZ6RAGdvgPlye7IhbSuZhhYVJ3xHOiNTSwW2BOCiKZ/SqLtlK9t7pP3fE5a8gV3YU7L53ySnH5GYeS/txRQRAbb1JzS1LxVeAde9cSYQBSsPM4JKz2Z+d2RC+R9nNC1vfOe2u7n/wLK4xAYH4d/BHjjzs9wDEPHTTBPFwb9KmyaOfAK4mVEiqOpTQ0vig2BDWTszalPJjvNNd9Z8jXq8fR5RUflCGviPVAGWNdj+2I5Sm57j33luWkO3r8ta4u09o9MAHYujHn8bOXqIWM5Q24qMAHLJ4aS6w/8+cEQQviCDn6rLTXbsAHCyzj7m++6v8VPONdZaSTkcjEXMSNIsgQHm2M9lNKANq17I2Ng1kSWjzCfN3MiJovR2HIelREjOV6XC6Up6fFb9knxoU83rYeEpaPk/G76v8mIH1Akdum5BfgltoEhVfwrKpaOpGEB4y7ttTDaLuDFZCquV33CO2I3rkGMDXVbdAh78XXbzsYs3Y4m6mt9In5Z4DTG5DCbudnm9Jrx8bIABGs+WFF+/BJe9WwLnMOSpIKonIYlhJvot09VkdLnU4CfZYBd8ZKJL6ONVsiMl+JsRY9jkrTZSnCeE3NpKkUe5f8T+fiuwkLZ/auTMz1M4GvT6P/tU+M0Jj10pec4o/0q1jjQztLAQ3yvLW0LibxH/jKEFQz2np1eVnZmDghdR+DYXgm2QMaCJebDb62ZKTj3/37Qiuy2y 5EPTntJC vupsuNFCEzmxC7u9jAmcZMoJgU5vxSqF0RoDczolY+L47YhgDHYLXpsloH5AW1kFWpZE+f1WRq6eFp80y/Oup8mu5qM9fBxQuU2iUQIemHm3Qt1YkR91Ln5DXa7/DkRct1oYsDC49TEnFjiGmT2XfZXLSeJaVKNMozoUkhg/hfDXRZyLPVkYJs4SqNaNytdoHgj+1c3XwQ3dDdKXlJuuHzoCEHf5Ob3XW7ApUttrZui8yWgxABD3guLVtFE857TX2JEj2YcCooJoY0Ev7BEnDM6x9tiwQp7W0GTnwxPAT5nPt/7k3gX/C/R38OLKrZlI0kR82WeUir6acpwNuZqfYXlTILoJ4fVkC4eazebjzYTYwcAx7ULLQjtFflQJ26Q2W3HNusKgX/J3SdeBJ09XCp9gEDLpqJaWdf7Gs8JqNh3/T41IHQhO06UGmsEEa5zcDBkmoJgNK3A5NK07o2tqCmb5FQfEwIfGL+1AKVObhRMO2sOftDK4zYmXF2dXYeBC7fuGQ/D80s5Xs6RhfWpruH26IX8vGYtatSlZDWJr91W1qvomEXTGVFXHFOmTHdCLCU0k4 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: On arm64, ARCH_DMA_MINALIGN is 128, larger than the cache line size on most of the current platforms (typically 64). Select ARCH_DMA_CACHE_LINE_SIZE and define ARCH_KMALLOC_MINALIGN to 8 (the default for architectures without their own ARCH_DMA_MINALIGN). The kmalloc() caches will be limited to the run-time value of cache_line_size(). Typically, this will allow the additional kmalloc-{64,192} caches on most arm64 platforms. Signed-off-by: Catalin Marinas Cc: Will Deacon --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/cache.h | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index b1201d25a8a4..d11340b41703 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -23,6 +23,7 @@ config ARM64 select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL select ARCH_HAS_DEBUG_VM_PGTABLE + select ARCH_HAS_DMA_CACHE_LINE_SIZE select ARCH_HAS_DMA_PREP_COHERENT select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI select ARCH_HAS_FAST_MULTIPLIER diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h index a51e6e8f3171..e24c10192636 100644 --- a/arch/arm64/include/asm/cache.h +++ b/arch/arm64/include/asm/cache.h @@ -33,6 +33,7 @@ * the CPU. */ #define ARCH_DMA_MINALIGN (128) +#define ARCH_KMALLOC_MINALIGN (8) #ifndef __ASSEMBLY__