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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5519C6FD1D for ; Fri, 7 Apr 2023 05:57:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232488AbjDGF5J (ORCPT ); Fri, 7 Apr 2023 01:57:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231210AbjDGF5I (ORCPT ); Fri, 7 Apr 2023 01:57:08 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78339C5; Thu, 6 Apr 2023 22:57:07 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 63FA868AFE; Fri, 7 Apr 2023 07:57:04 +0200 (CEST) Date: Fri, 7 Apr 2023 07:57:04 +0200 From: Christoph Hellwig To: Petr Tesarik Cc: Christoph Hellwig , Jonathan Corbet , Marek Szyprowski , Robin Murphy , Borislav Petkov , "Paul E. McKenney" , Andrew Morton , Randy Dunlap , Damien Le Moal , Kim Phillips , "Steven Rostedt (Google)" , "open list:DOCUMENTATION" , open list , "open list:DMA MAPPING HELPERS" , Roberto Sassu , petr@tesarici.cz, Alexander Graf Subject: Re: [RFC v1 3/4] swiotlb: Allow dynamic allocation of bounce buffers Message-ID: <20230407055704.GD6803@lst.de> References: <0334a54332ab75312c9de825548b616439dcc9f5.1679309810.git.petr.tesarik.ext@huawei.com> <20230328040724.GB25506@lst.de> <4268fa4e-4f0f-a2f6-a2a5-5b78ca4a073d@huaweicloud.com> <8cf7c515-9ce6-a2ed-0643-972aa3eba2fb@huaweicloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8cf7c515-9ce6-a2ed-0643-972aa3eba2fb@huaweicloud.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Tue, Mar 28, 2023 at 02:43:03PM +0200, Petr Tesarik wrote: > Oh, wait! I can do at least something for devices which do not use > swiotlb at all. > > If a device does not use bounce buffers, it cannot pass an address > that belongs to the swiotlb. Consequently, the potentially > expensive check can be skipped. This avoids the dynamic lookup > penalty for devices which do not need the swiotlb. > > Note that the counter always remains zero if dma_io_tlb_mem is > NULL, so the NULL check is not required. Hmm, that's yet another atomic for each map/unmap, and bloats struct device. (Btw, in case anyone is interested, we really need to get started on moving the dma fields out of struct device into a sub-struct only allocated for DMA capable busses)