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 088B5C433F5 for ; Wed, 24 Nov 2021 18:00:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243252AbhKXSDk (ORCPT ); Wed, 24 Nov 2021 13:03:40 -0500 Received: from foss.arm.com ([217.140.110.172]:41660 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241542AbhKXSDj (ORCPT ); Wed, 24 Nov 2021 13:03:39 -0500 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 46B781FB; Wed, 24 Nov 2021 10:00:29 -0800 (PST) Received: from [10.57.56.56] (unknown [10.57.56.56]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9CDBA3F66F; Wed, 24 Nov 2021 10:00:27 -0800 (PST) Message-ID: Date: Wed, 24 Nov 2021 18:00:23 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH 9/9] iommu: Move flush queue data into iommu_dma_cookie Content-Language: en-GB To: John Garry , joro@8bytes.org, will@kernel.org Cc: iommu@lists.linux-foundation.org, suravee.suthikulpanit@amd.com, baolu.lu@linux.intel.com, willy@infradead.org, linux-kernel@vger.kernel.org References: <49bfd9636fd21c4b40e07558db6bfbbf82a449ac.1637674723.git.robin.murphy@arm.com> <9dece0b8-2832-f467-91f3-f63ef0f70d16@huawei.com> From: Robin Murphy In-Reply-To: <9dece0b8-2832-f467-91f3-f63ef0f70d16@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-11-24 17:25, John Garry wrote: > On 23/11/2021 14:10, Robin Murphy wrote: >> ruct iommu_dma_msi_page { >>       struct list_head    list; >> @@ -41,7 +43,19 @@ struct iommu_dma_cookie { >>       enum iommu_dma_cookie_type    type; >>       union { >>           /* Full allocator for IOMMU_DMA_IOVA_COOKIE */ >> -        struct iova_domain    iovad; >> +        struct { >> +            struct iova_domain    iovad; >> + >> +            struct iova_fq __percpu *fq;    /* Flush queue */ >> +            /* Number of TLB flushes that have been started */ >> +            atomic64_t        fq_flush_start_cnt; >> +            /* Number of TLB flushes that have been finished */ >> +            atomic64_t        fq_flush_finish_cnt; >> +            /* Timer to regularily empty the flush queues */ >> +            struct timer_list    fq_timer; >> +            /* 1 when timer is active, 0 when not */ >> +            atomic_t        fq_timer_on; > > I thought that putting all the FQ stuff in its own structure would be > neater, but that's just personal preference. But look, it is! ;) The iova_domain is still a fundamental part of the flush queue built around it; the rest of the machinery can't stand in isolation. It's just an anonymous structure because I don't feel like needlessly cluttering up the code with "cookie->fq.fq" silliness. Cheers, Robin. 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 smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A10BBC433EF for ; Wed, 24 Nov 2021 18:00:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 30018404B4; Wed, 24 Nov 2021 18:00:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0VkN_3CxIxCX; Wed, 24 Nov 2021 18:00:33 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id E76A5400E9; Wed, 24 Nov 2021 18:00:32 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id CC922C001E; Wed, 24 Nov 2021 18:00:32 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 42BF5C0012 for ; Wed, 24 Nov 2021 18:00:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 3172980DDC for ; Wed, 24 Nov 2021 18:00:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JF5NhTouLQFu for ; Wed, 24 Nov 2021 18:00:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp1.osuosl.org (Postfix) with ESMTP id 09A3480DD7 for ; Wed, 24 Nov 2021 18:00:29 +0000 (UTC) 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 46B781FB; Wed, 24 Nov 2021 10:00:29 -0800 (PST) Received: from [10.57.56.56] (unknown [10.57.56.56]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9CDBA3F66F; Wed, 24 Nov 2021 10:00:27 -0800 (PST) Message-ID: Date: Wed, 24 Nov 2021 18:00:23 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH 9/9] iommu: Move flush queue data into iommu_dma_cookie Content-Language: en-GB To: John Garry , joro@8bytes.org, will@kernel.org References: <49bfd9636fd21c4b40e07558db6bfbbf82a449ac.1637674723.git.robin.murphy@arm.com> <9dece0b8-2832-f467-91f3-f63ef0f70d16@huawei.com> From: Robin Murphy In-Reply-To: <9dece0b8-2832-f467-91f3-f63ef0f70d16@huawei.com> Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, willy@infradead.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: base64 Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" T24gMjAyMS0xMS0yNCAxNzoyNSwgSm9obiBHYXJyeSB3cm90ZToKPiBPbiAyMy8xMS8yMDIxIDE0 OjEwLCBSb2JpbiBNdXJwaHkgd3JvdGU6Cj4+IHJ1Y3QgaW9tbXVfZG1hX21zaV9wYWdlIHsKPj4g wqDCoMKgwqDCoCBzdHJ1Y3QgbGlzdF9oZWFkwqDCoMKgIGxpc3Q7Cj4+IEBAIC00MSw3ICs0Mywx OSBAQCBzdHJ1Y3QgaW9tbXVfZG1hX2Nvb2tpZSB7Cj4+IMKgwqDCoMKgwqAgZW51bSBpb21tdV9k bWFfY29va2llX3R5cGXCoMKgwqAgdHlwZTsKPj4gwqDCoMKgwqDCoCB1bmlvbiB7Cj4+IMKgwqDC oMKgwqDCoMKgwqDCoCAvKiBGdWxsIGFsbG9jYXRvciBmb3IgSU9NTVVfRE1BX0lPVkFfQ09PS0lF ICovCj4+IC3CoMKgwqDCoMKgwqDCoCBzdHJ1Y3QgaW92YV9kb21haW7CoMKgwqAgaW92YWQ7Cj4+ ICvCoMKgwqDCoMKgwqDCoCBzdHJ1Y3Qgewo+PiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCBzdHJ1 Y3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