Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4550158pxb; Tue, 22 Feb 2022 00:55:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSqy8pAYsa1muA0+BurY9QHmRRtc73W9ugp7Ze8DtVoXU/t9wEIXeOx6d0ns+bWTztPZJj X-Received: by 2002:a05:6a00:24c5:b0:4d1:65bf:1fe0 with SMTP id d5-20020a056a0024c500b004d165bf1fe0mr23911493pfv.0.1645520140473; Tue, 22 Feb 2022 00:55:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645520140; cv=none; d=google.com; s=arc-20160816; b=guaZuJZ3zR4Tt9lE7kMx8mNfvokXvMSP7lItgK6a3hecDhfq83mM7ALVU9mB6LLWu6 BmtYWbNadzqIfoDekBPMbM2rmRgHi2CkHrasQyQ+sOfHk6tVUrFNyeNA1frguPUyKBAV F7IM3CUF0zVs4fkKjaAggskKofyW+Jter9ZpYlPmwjFgrlnyns16UMPTIHewELseuATx QT9CJ3B1/6anjKNcL1pYWN/ZDFgpeXRLt+bf+jj4oIOwBsPyvKCznT1YAcwgnZzhOOz0 GUa+a7df9IueMpg7y9gdS5W2ZPKIFI9EOgmEgkLYIfTnkuXagssv9+4VV5c7x9NREtoA jnxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=d2Mp+5o1e71e/I9EuPPYnNN3aERaspDhqXMueLiw6+c=; b=kaPGQvX2VBF9+f2xvwVmtquXISTEcHUePf4hwXW6hpZTNToBx7we4c2bDaiSbjTNoy /ckzZKf/oUkbo8tLziAP5khKrjE0PPGfEOzBQoY4yfzUocpQm7cSqFz+4YroHBwbQ5/x TGR5fkfMVqBm3W6QP9GTVtXQQHd31Yv1dgfUiOMNQaVTs/kqNFFsaZCJYhswyMmntINd i5MEFSH1zB9CM9Nk18RlrTthIYDI1lHmHlQO8A5zBG5ABmTjdGz9aMWt7syGDVLM+wd4 5H+PbIeffantsQjzXJdFlkfoZ1b5cd64sRH/KC4a9XIkr58L91QqobrVWPNwYfNmu5r6 VMgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a24si20120491pgl.439.2022.02.22.00.55.16; Tue, 22 Feb 2022 00:55:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229842AbiBVIrV (ORCPT + 99 others); Tue, 22 Feb 2022 03:47:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229718AbiBVIrU (ORCPT ); Tue, 22 Feb 2022 03:47:20 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF9504CD53; Tue, 22 Feb 2022 00:46:55 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id B8BE368AA6; Tue, 22 Feb 2022 09:46:52 +0100 (CET) Date: Tue, 22 Feb 2022 09:46:52 +0100 From: Christoph Hellwig To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Christoph Hellwig , Baoquan He , linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, vbabka@suse.cz, David.Laight@aculab.com, david@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org, steffen.klassert@secunet.com, netdev@vger.kernel.org, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, linux-s390@vger.kernel.org, michael@walle.cc, linux-i2c@vger.kernel.org, wsa@kernel.org Subject: Re: [PATCH 22/22] mtd: rawnand: Use dma_alloc_noncoherent() for dma buffer Message-ID: <20220222084652.GB6210@lst.de> References: <20220219005221.634-1-bhe@redhat.com> <20220219005221.634-23-bhe@redhat.com> <20220219071900.GH26711@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Sat, Feb 19, 2022 at 11:18:24AM +0000, Hyeonggon Yoo wrote: > > I think it would be better to still allocate the buffer at allocation > > time and then just transfer ownership using dma_sync_single* in the I/O > > path to avoid the GFP_ATOMIC allocation. > > This driver allocates the buffer at initialization step and maps the buffer > for DMA_TO_DEVICE and DMA_FROM_DEVICE when processing IO. > > But after making this driver to use dma_alloc_noncoherent(), remapping > dma_alloc_noncoherent()-ed buffer is strange So I just made it to allocate > the buffer in IO path. You should not remap it. Just use dma_sync_single* to transfer ownership. > Hmm.. for this specific case, What about allocating two buffers > for DMA_TO_DEVICE and DMA_FROM_DEVICE at initialization time? That will work, but I don't see the benefit as you'd still need to call dma_sync_single* before and after each data transfer.