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 81D01C4332F for ; Tue, 1 Nov 2022 17:32:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1C2816B0071; Tue, 1 Nov 2022 13:32:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 172AC6B0073; Tue, 1 Nov 2022 13:32:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 088E26B0074; Tue, 1 Nov 2022 13:32:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id ED4976B0071 for ; Tue, 1 Nov 2022 13:32:25 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id BAC10120FDA for ; Tue, 1 Nov 2022 17:32:25 +0000 (UTC) X-FDA: 80085567450.23.96491C9 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf17.hostedemail.com (Postfix) with ESMTP id 01AF24004C for ; Tue, 1 Nov 2022 17:32:23 +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 ams.source.kernel.org (Postfix) with ESMTPS id D8EB1B81E7B; Tue, 1 Nov 2022 17:32:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41526C433C1; Tue, 1 Nov 2022 17:32:18 +0000 (UTC) Date: Tue, 1 Nov 2022 17:32:14 +0000 From: Catalin Marinas To: Christoph Hellwig Cc: Greg Kroah-Hartman , Linus Torvalds , Arnd Bergmann , Will Deacon , Marc Zyngier , Andrew Morton , Herbert Xu , Ard Biesheuvel , Isaac Manjarres , Saravana Kannan , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 2/2] treewide: Add the __GFP_PACKED flag to several non-DMA kmalloc() allocations Message-ID: References: <20221030084718.GC5278@lst.de> <20221030091349.GA5600@lst.de> <20221101105919.GA13872@lst.de> <20221101172416.GB20381@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221101172416.GB20381@lst.de> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667323944; a=rsa-sha256; cv=none; b=FaTEJJb/HJr8bln6uleMzInprSTCsh55dMS6QqJy0zTk1pQ2SQ8Z7keGqkrwfGBtcdOLV9 uVJRgrN+cNXIHnzg9F10DwbWzlIRYfJKyaWmh9xpCbMEE1boK5MBownMnodw9zPmre5flg UeaK4e9+X70LQtxds63v+GC6frOoXQQ= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf17.hostedemail.com: domain of cmarinas@kernel.org designates 145.40.68.75 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=1667323944; 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=kX8219OpVlg07kG35sRO/R88XyphcmX5MSkUKQG91WE=; b=M86qbY8OAytLSRHGUzRc1OlPDqEkRCJLDXyitVBfXEgUt20RXHN6L6pXkilby3gfV4i1w4 2hhzQNld3fPamcIqUwoRQKkm70XKbuLoSlv7GEEW5i/Vbn4R2ay7FUaJbmPFZRdJGxSllx oNqtQcv3qSkElbTp+mnxUUNOxXRT+y4= X-Stat-Signature: r5zyiex7jopubcqwkbtwk7cjaxwekp3z X-Rspamd-Queue-Id: 01AF24004C Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf17.hostedemail.com: domain of cmarinas@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=cmarinas@kernel.org X-Rspam-User: X-Rspamd-Server: rspam07 X-HE-Tag: 1667323943-124336 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 Tue, Nov 01, 2022 at 06:24:16PM +0100, Christoph Hellwig wrote: > On Tue, Nov 01, 2022 at 05:19:46PM +0000, Catalin Marinas wrote: > > > > The main downside of bouncing is mobile phones where those vendors are > > in the habit of passing noswiotlb on the kernel command line or they > > want a very small bounce buffer (hard to pick a universally small size). > > I guess we can go ahead with this and, depending on how bad the problem > > is, we can look at optimising swiotlb to use a kmem_cache (or aligned > > kmalloc) as fall-back for bouncing. > > Theses phones setups are completely broken already. There is a reason > why it needs a debug option to disable swiotlb, and that reason is > that Linux guarantees that the 32-bit DMA always works. If they force > swiotlb off they can keep the pieces as this is not a supported > configuration. There's also the case of low-end phones with all RAM below 4GB and arm64 doesn't allocate the swiotlb. Not sure those vendors would go with a recent kernel anyway. So the need for swiotlb now changes from 32-bit DMA to any DMA (non-coherent but we can't tell upfront when booting, devices may be initialised pretty late). > > As a less than optimal solution, we can force bouncing for the whole > > list if any of the sg elements is below the alignment size. Hopefully we > > won't have many such mixed size cases. > > I suspect we won't see any such cases. The scatterlist is usually used > for large data transfers, and many devices won't like unaligned buffers > for SG operations to start with. So I think it is a perfectly fine > tradeoff. I'll give it a try this week, hopefully post patches soon(ish). -- Catalin