From mboxrd@z Thu Jan 1 00:00:00 1970 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 C07CAC4332F for ; Tue, 8 Nov 2022 09:52:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 354D96B0071; Tue, 8 Nov 2022 04:52:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 304A26B0073; Tue, 8 Nov 2022 04:52:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1CD0D8E0001; Tue, 8 Nov 2022 04:52:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0AF3C6B0071 for ; Tue, 8 Nov 2022 04:52:30 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CF6541C67A6 for ; Tue, 8 Nov 2022 09:52:29 +0000 (UTC) X-FDA: 80109810018.15.DC0F739 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf12.hostedemail.com (Postfix) with ESMTP id 00FBA40002 for ; Tue, 8 Nov 2022 09:52:28 +0000 (UTC) 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 sin.source.kernel.org (Postfix) with ESMTPS id 1D205CE1ADE; Tue, 8 Nov 2022 09:52:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6129C433D6; Tue, 8 Nov 2022 09:52:18 +0000 (UTC) Date: Tue, 8 Nov 2022 09:52:15 +0000 From: Catalin Marinas To: Robin Murphy Cc: Linus Torvalds , Arnd Bergmann , Christoph Hellwig , Greg Kroah-Hartman , 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" , linux-mm@kvack.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 13/13] dma: arm64: Add CONFIG_DMA_BOUNCE_UNALIGNED_KMALLOC and enable it for arm64 Message-ID: References: <20221106220143.2129263-1-catalin.marinas@arm.com> <20221106220143.2129263-14-catalin.marinas@arm.com> <6e846f75-b330-9523-4356-41d5f9e48f12@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6e846f75-b330-9523-4356-41d5f9e48f12@arm.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667901149; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HjBDDykizAZpjsfTBbXobywlC6czMBCKnoHEn1w16VM=; b=PylHwoWdufIE5zfsVMIJ1SqBK1Qop06jJHBMDHVrNhRR8vPeEAv7Ek2H7ApmGHvkaiVyAN MHtscRM5L1FOA7YK0V2zFh63E8eM8iL1H5agPrN2ZebnHikDfTJNEcH/LNckPx7ksKf7Xw Wc0tIa5fMk4XHvB0/+62+etSgtEom4U= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; spf=pass (imf12.hostedemail.com: domain of cmarinas@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667901149; a=rsa-sha256; cv=none; b=ptQMhMJO4HBIv08JOcwzjmqkhAIf5FV4fpq/kygnQOkamjJZOe6MUa6tNIhqShvi6sHq3M 1c01OeNC24mmntjHQDexNmooNuwhqFWFeNkPlSmrz00dbjtbaN5T46asq0AGOLzT/pZdqr syd5BsaMTyitsZnHg1D3y+2OuuX2C0s= X-Rspam-User: X-Stat-Signature: f7fnfmetu1xfaubtin3wx1mgp9h3my44 X-Rspamd-Queue-Id: 00FBA40002 Authentication-Results: imf12.hostedemail.com; dkim=none; spf=pass (imf12.hostedemail.com: domain of cmarinas@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) X-Rspamd-Server: rspam07 X-HE-Tag: 1667901148-361611 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 Mon, Nov 07, 2022 at 01:03:31PM +0000, Robin Murphy wrote: > On 2022-11-06 22:01, Catalin Marinas wrote: > > With all the infrastructure in place for bouncing small kmalloc() > > buffers, add the corresponding Kconfig entry and select it for arm64. > > AFAICS we're missing the crucial part to ensure that SWIOTLB is available > even when max_pfn <= arm64_dma_phys_limit, which is very likely to be true > on low-memory systems that care most about kmalloc wastage. This was a deliberate decision for this version. Patch 4 mitigates it a bit by raising the kmalloc() minimum alignment to the cache line size (typically 64). It's still an improvement from the current 128-byte alignment. Since it's hard to guess the optimal swiotlb buffer for such platforms, I think a follow-up step would be to use the DMA coherent pool for bouncing if no swiotlb buffer is available. At least the pool can grow dynamically. Yet another option would be to increase the swiotlb buffer at run-time but it has an overhead for is_swiotlb_buffer(). -- Catalin