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 54E90C7EE26 for ; Tue, 23 May 2023 12:16:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236638AbjEWMQ5 (ORCPT ); Tue, 23 May 2023 08:16:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236688AbjEWMQy (ORCPT ); Tue, 23 May 2023 08:16:54 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8BE02109; Tue, 23 May 2023 05:16:52 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 103DA139F; Tue, 23 May 2023 05:17:37 -0700 (PDT) Received: from [10.57.84.70] (unknown [10.57.84.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2138E3F6C4; Tue, 23 May 2023 05:16:44 -0700 (PDT) Message-ID: Date: Tue, 23 May 2023 13:16:40 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v9 5/6] iommu/dma: Allow a single FQ in addition to per-CPU FQs Content-Language: en-GB To: Niklas Schnelle , Joerg Roedel , Matthew Rosato , Will Deacon , Wenjia Zhang , Jason Gunthorpe Cc: Gerd Bayer , Julian Ruess , Pierre Morel , Alexandra Winter , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Suravee Suthikulpanit , Hector Martin , Sven Peter , Alyssa Rosenzweig , David Woodhouse , Lu Baolu , Andy Gross , Bjorn Andersson , Konrad Dybcio , Yong Wu , Matthias Brugger , AngeloGioacchino Del Regno , Gerald Schaefer , Orson Zhai , Baolin Wang , Chunyan Zhang , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Krishna Reddy , Jonathan Hunter , Jonathan Corbet , linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-doc@vger.kernel.org References: <20230310-dma_iommu-v9-0-65bb8edd2beb@linux.ibm.com> <20230310-dma_iommu-v9-5-65bb8edd2beb@linux.ibm.com> <0d9e3f86cf9a1a3d69e650fb631809498c2cd01e.camel@linux.ibm.com> From: Robin Murphy In-Reply-To: <0d9e3f86cf9a1a3d69e650fb631809498c2cd01e.camel@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-s390@vger.kernel.org On 2023-05-23 13:02, Niklas Schnelle wrote: [...] >>> +static void fq_flush_single(struct iommu_dma_cookie *cookie) >>> +{ >>> + struct iova_fq *fq = cookie->single_fq; >>> + unsigned long flags; >>> + >>> + spin_lock_irqsave(&fq->lock, flags); >>> + fq_ring_free(cookie, fq); >>> + spin_unlock_irqrestore(&fq->lock, flags) >> >> Nit: this should clearly just be a self-locked version of fq_ring_free() >> that takes fq as an argument, then both the new case and the existing >> loop body become trivial one-line calls. > > Sure will do. Just one question about names. As an example > pci_reset_function_locked() means that the relevant lock is already > taken with pci_reset_function() adding the lock/unlock. In your wording > the implied function names sound the other way around. I can't find > anything similar in drivers/iommu so would you mind going the PCI way > and having: > > fq_ring_free_locked(): Called in queue_iova() with the lock held > fr_ring_free(): Called in fq_flush_timeout() takes the lock itself > > Or maybe I'm just biased because I've used the PCI ..locked() functions > before and there is a better convention. Yes, that's the form that's most familiar to me too - sorry I failed to express it clearly :) Thanks, Robin.