Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4563317pxb; Tue, 22 Feb 2022 01:16:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDvPq60PDUri0363Vd4BtHctU0mRc7Ung8ynIaYc+w90VCVwS2/0Zk8g2JfFwvSkOLTtIt X-Received: by 2002:a17:903:2352:b0:14f:b1ec:ec55 with SMTP id c18-20020a170903235200b0014fb1ecec55mr9218747plh.59.1645521376517; Tue, 22 Feb 2022 01:16:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645521376; cv=none; d=google.com; s=arc-20160816; b=YiL0TzumEtfhWV9rFzIKi4Md/yhHO9bo+jFv7nwShL9KVDQdDlYPYV0vG3rkPYZ+3N vvvsqbXXikv29J4KYnK37xsHsSLi8dHqxGKjMT2VbWAcx5HRsNyqm1B2HFB/ksRQKGtN CYaTtfAzNTxz2P/Qd7Y+B0MGZlgECs/PZiIyMcfUovdRepx8L2PfMGqy+6XrKETa2EKo 6fKCvKtXhkN0APyVJcq/D/F16DvGnP6pDEO4db2SwwsC9LG9SnQ1I7Rw/F5P9Ri274SP jPtkp1uDPYj1+8OV7y5tu0rolBwtrhxC5wrvKXyXdl6cWVp73E9Q+wxe0/V+44Z5IK/y tYUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=tGznI8bU1sCCHUVkpnHj67s0k3u22yJFnN2xJ1ARcQQ=; b=kkIfxKqc+grvPPDXDewqqb2IiaqJuVLd2weHnBdtZNx9b0uJDm4JsyJsn1C/iR9YBq 3Lhio+ZR0NWDScrEWvShH2yzTwwl91EUOgsPD9R9o1cWGSSEf6RhiHaGkK17c+34RE/U zrWoRmoOFgcRWJeMNznTkkcffsVuJ9iuK42CwTs2FriYRhwCQG5A3vpYoek9+ONQD288 Gan0fKPAtM2QIRzp+qTlMX2RiYgq726Ct4dOxHmn6Q99an+QbtT0X2uGVbnAM+QSpCOr JB9Kh4R4bFJcr/2e2t0RMmKxPYFPBGPNkUu8dQy4Hwd/il40JRNuikr4B1JR76t4yz8X woRg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 130si20731173pga.65.2022.02.22.01.15.55; Tue, 22 Feb 2022 01:16:16 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230086AbiBVJHU convert rfc822-to-8bit (ORCPT + 99 others); Tue, 22 Feb 2022 04:07:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230071AbiBVJHT (ORCPT ); Tue, 22 Feb 2022 04:07:19 -0500 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AD24B14866F for ; Tue, 22 Feb 2022 01:06:53 -0800 (PST) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-308-GmoSOj60Pgiu_y5_NLHrDQ-1; Tue, 22 Feb 2022 09:06:50 +0000 X-MC-Unique: GmoSOj60Pgiu_y5_NLHrDQ-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.28; Tue, 22 Feb 2022 09:06:49 +0000 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.028; Tue, 22 Feb 2022 09:06:48 +0000 From: David Laight To: 'Christoph Hellwig' , Hyeonggon Yoo <42.hyeyoo@gmail.com> CC: 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@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 Thread-Topic: [PATCH 22/22] mtd: rawnand: Use dma_alloc_noncoherent() for dma buffer Thread-Index: AQHYJ8i+SkBT2V8OuE+2tEasDwiwNayfRZ0Q Date: Tue, 22 Feb 2022 09:06:48 +0000 Message-ID: References: <20220219005221.634-1-bhe@redhat.com> <20220219005221.634-23-bhe@redhat.com> <20220219071900.GH26711@lst.de> <20220222084652.GB6210@lst.de> In-Reply-To: <20220222084652.GB6210@lst.de> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, 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 From: Christoph Hellwig > Sent: 22 February 2022 08:47 ... > > 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. For systems with an iommu that should save all the iommu setup for every transfer. I'd also guess that it saves worrying about the error path when the dma_map fails (eg because the iommu has no space). OTOH the driver would be 'hogging' iommu space, so maybe allocate during open() (or equivalent). David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)