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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53412C43461 for ; Tue, 11 May 2021 07:40:22 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D71DA61926 for ; Tue, 11 May 2021 07:40:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D71DA61926 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 7C99A843A5; Tue, 11 May 2021 07:40:21 +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 bk5ksRCgd1PN; Tue, 11 May 2021 07:40:20 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTP id 4196984359; Tue, 11 May 2021 07:40:20 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 16DE3C000E; Tue, 11 May 2021 07:40:20 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5C704C0001 for ; Tue, 11 May 2021 07:40:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 3CA214056C for ; Tue, 11 May 2021 07:40:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WodwidIcBV0B for ; Tue, 11 May 2021 07:40:17 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by smtp4.osuosl.org (Postfix) with ESMTPS id 7B94440564 for ; Tue, 11 May 2021 07:40:17 +0000 (UTC) Received: from dggeml764-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FfV8c1LbKzWhXN; Tue, 11 May 2021 15:36:00 +0800 (CST) Received: from dggpemm000003.china.huawei.com (7.185.36.128) by dggeml764-chm.china.huawei.com (10.1.199.174) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Tue, 11 May 2021 15:40:13 +0800 Received: from [10.174.187.224] (10.174.187.224) by dggpemm000003.china.huawei.com (7.185.36.128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 11 May 2021 15:40:13 +0800 Subject: Re: [RFC PATCH v4 01/13] iommu: Introduce dirty log tracking framework To: Lu Baolu , , , , Robin Murphy , Will Deacon , "Joerg Roedel" , Jean-Philippe Brucker , Yi Sun , Tian Kevin References: <20210507102211.8836-1-zhukeqian1@huawei.com> <20210507102211.8836-2-zhukeqian1@huawei.com> <18ac787a-179e-71f7-728b-c43feda80a16@huawei.com> <55fda826-9ab6-a3a0-b17e-a4d4879f00bc@linux.intel.com> From: Keqian Zhu Message-ID: <60182a35-e151-7150-3708-4e58dd8e78da@huawei.com> Date: Tue, 11 May 2021 15:40:12 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.174.187.224] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm000003.china.huawei.com (7.185.36.128) X-CFilter-Loop: Reflected Cc: jiangkunkun@huawei.com, Cornelia Huck , Kirti Wankhede , lushenming@huawei.com, Alex Williamson , wanghaibin.wang@huawei.com 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" Hi Baolu, On 2021/5/11 11:12, Lu Baolu wrote: > Hi Keqian, > > On 5/10/21 7:07 PM, Keqian Zhu wrote: >>>>> I suppose this interface is to ask the vendor IOMMU driver to check >>>>> whether each device/iommu in the domain supports dirty bit tracking. >>>>> But what will happen if new devices with different tracking capability >>>>> are added afterward? >>>> Yep, this is considered in the vfio part. We will query again after attaching or >>>> detaching devices from the domain. When the domain becomes capable, we enable >>>> dirty log for it. When it becomes not capable, we disable dirty log for it. >>> If that's the case, why not putting this logic in the iommu subsystem so >>> that it doesn't need to be duplicate in different upper layers? >>> >>> For example, add something like dirty_page_trackable in the struct of >>> iommu_domain and ask the vendor iommu driver to update it once any >>> device is added/removed to/from the domain. It's also better to disallow >> If we do it, the upper layer still needs to query the capability from domain and switch >> dirty log tracking for it. Or do you mean the domain can switch dirty log tracking automatically >> when its capability change? If so, I think we're lack of some flexibility. The upper layer >> may have it's own policy, such as only enable dirty log tracking when all domains are capable, >> and disable dirty log tracking when just one domain is not capable. > > I may not get you. > > Assume that dirty_page_trackable is an attribution of an iommu_domain. > This attribution might be changed once a new device (with different > capability) added or removed. So it should be updated every time a new > device is attached or detached. This work could be done by the vendor > iommu driver on the path of dev_attach/dev_detach callback. Yes, this is what I understand you. > > For upper layers, before starting page tracking, they check the > dirty_page_trackable attribution of the domain and start it only it's > capable. Once the page tracking is switched on the vendor iommu driver > (or iommu core) should block further device attach/detach operations > until page tracking is stopped. But when a domain becomes capable after detaching a device, the upper layer still needs to query it and enable dirty log for it... To make things coordinated, maybe the upper layer can register a notifier, when the domain's capability change, the upper layer do not need to query, instead they just need to realize a callback, and do their specific policy in the callback. What do you think? > >> >>> any domain attach/detach once the dirty page tracking is on. >> Yep, this can greatly simplify our code logic, but I don't know whether our maintainers >> agree that, as they may think that IOMMU dirty logging should not change original domain >> behaviors. > > The maintainer owns the last word, but we need to work out a generic and > self-contained API set. OK, I see. Thanks, Keqian _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu 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 X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35A73C433ED for ; Tue, 11 May 2021 11:52:13 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9053661207 for ; Tue, 11 May 2021 11:52:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9053661207 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From:CC: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=T914NoKSZlhpqAftSLEHZyq7toO5QK7KM9gUVsOHQos=; b=S67wjozJMGX+FRrP2ggE/Uelu DE4U/PA8g66LcKHeR7cp0NmQMkWr8fHmi2UFqePamu6Rrm3ATWhzeAbs0v/4O5vbmohWXnKt4Fw7K iD0HcvQGtiRVIimbk3ATfQL+nBv3cPFMk68urWigesl7bH8Rmg7ML7wsMxvZoKZ9+jujX4dspOu7R g/7niA/9Yu+nix5jrgBF7ceYYoeuGQPeEifUa9H3hETvuDCo9aB4ticSKrKXLz9z8b0cEUFPFXwOB AEkQs6CaduTprZRFx701doE2vPrZO7Hty+KxNP79pWHOk5JLGSOzzuwMzPkyl98CPxc8WvlErNC7u KJVfQ0gYw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lgQun-00HDeh-6F; Tue, 11 May 2021 11:51:06 +0000 Received: from [2607:7c80:54:e::133] (helo=bombadil.infradead.org) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgN0L-00GWqW-5d for linux-arm-kernel@desiato.infradead.org; Tue, 11 May 2021 07:40:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:CC:References:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=GThl92Avyc0OeAwSpMsAM1PqrAc9nNmG3fdh6RHSdCU=; b=0Q1ygLFxkbE1DC7WDuWWX22APx ZtZWnZSrszD32GQIeKSta2lItclU1lNiDjy9maP3Q5EApHn/dTbRaDizTtRJgBM8tSS91kToNNcEz /xYJGWZtBm0Etj/ZEEmCaSr5+QwmqcZrKwai+Pnrr1X6uU/0Yf2HoSxSIjblThJiPVuwiCdamEh4j 63W6at1ActtSCiezT/63IHxlbDGlTeif9ZWKlrVZZWf1UuRyJxcCvf8hIUnjqPN84CCGl7NXdlhQB 6NoQ32PZjp3wqEswBnMhmc4Z7nmvRy703q0HxxHEASz2/SPik+yQg56srTrtNkHq/ulfELQgVqSlJ YeLtxTUw==; Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgN0A-009Mrk-4Z for linux-arm-kernel@lists.infradead.org; Tue, 11 May 2021 07:40:24 +0000 Received: from dggeml764-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FfV8c1LbKzWhXN; Tue, 11 May 2021 15:36:00 +0800 (CST) Received: from dggpemm000003.china.huawei.com (7.185.36.128) by dggeml764-chm.china.huawei.com (10.1.199.174) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Tue, 11 May 2021 15:40:13 +0800 Received: from [10.174.187.224] (10.174.187.224) by dggpemm000003.china.huawei.com (7.185.36.128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 11 May 2021 15:40:13 +0800 Subject: Re: [RFC PATCH v4 01/13] iommu: Introduce dirty log tracking framework To: Lu Baolu , , , , Robin Murphy , Will Deacon , "Joerg Roedel" , Jean-Philippe Brucker , Yi Sun , Tian Kevin References: <20210507102211.8836-1-zhukeqian1@huawei.com> <20210507102211.8836-2-zhukeqian1@huawei.com> <18ac787a-179e-71f7-728b-c43feda80a16@huawei.com> <55fda826-9ab6-a3a0-b17e-a4d4879f00bc@linux.intel.com> CC: Alex Williamson , Kirti Wankhede , Cornelia Huck , Jonathan Cameron , , , , From: Keqian Zhu Message-ID: <60182a35-e151-7150-3708-4e58dd8e78da@huawei.com> Date: Tue, 11 May 2021 15:40:12 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.174.187.224] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm000003.china.huawei.com (7.185.36.128) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210511_004022_590537_08C03A99 X-CRM114-Status: GOOD ( 23.21 ) /bin/ln: failed to access 'reaver_cache/texts/20210511_004022_590537_08C03A99': No such file or directory X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210511_004022_590537_08C03A99 X-CRM114-Status: GOOD ( 19.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Baolu, On 2021/5/11 11:12, Lu Baolu wrote: > Hi Keqian, > > On 5/10/21 7:07 PM, Keqian Zhu wrote: >>>>> I suppose this interface is to ask the vendor IOMMU driver to check >>>>> whether each device/iommu in the domain supports dirty bit tracking. >>>>> But what will happen if new devices with different tracking capability >>>>> are added afterward? >>>> Yep, this is considered in the vfio part. We will query again after attaching or >>>> detaching devices from the domain. When the domain becomes capable, we enable >>>> dirty log for it. When it becomes not capable, we disable dirty log for it. >>> If that's the case, why not putting this logic in the iommu subsystem so >>> that it doesn't need to be duplicate in different upper layers? >>> >>> For example, add something like dirty_page_trackable in the struct of >>> iommu_domain and ask the vendor iommu driver to update it once any >>> device is added/removed to/from the domain. It's also better to disallow >> If we do it, the upper layer still needs to query the capability from domain and switch >> dirty log tracking for it. Or do you mean the domain can switch dirty log tracking automatically >> when its capability change? If so, I think we're lack of some flexibility. The upper layer >> may have it's own policy, such as only enable dirty log tracking when all domains are capable, >> and disable dirty log tracking when just one domain is not capable. > > I may not get you. > > Assume that dirty_page_trackable is an attribution of an iommu_domain. > This attribution might be changed once a new device (with different > capability) added or removed. So it should be updated every time a new > device is attached or detached. This work could be done by the vendor > iommu driver on the path of dev_attach/dev_detach callback. Yes, this is what I understand you. > > For upper layers, before starting page tracking, they check the > dirty_page_trackable attribution of the domain and start it only it's > capable. Once the page tracking is switched on the vendor iommu driver > (or iommu core) should block further device attach/detach operations > until page tracking is stopped. But when a domain becomes capable after detaching a device, the upper layer still needs to query it and enable dirty log for it... To make things coordinated, maybe the upper layer can register a notifier, when the domain's capability change, the upper layer do not need to query, instead they just need to realize a callback, and do their specific policy in the callback. What do you think? > >> >>> any domain attach/detach once the dirty page tracking is on. >> Yep, this can greatly simplify our code logic, but I don't know whether our maintainers >> agree that, as they may think that IOMMU dirty logging should not change original domain >> behaviors. > > The maintainer owns the last word, but we need to work out a generic and > self-contained API set. OK, I see. Thanks, Keqian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3304CC433ED for ; Tue, 11 May 2021 07:40:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 05B1361352 for ; Tue, 11 May 2021 07:40:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230343AbhEKHlY (ORCPT ); Tue, 11 May 2021 03:41:24 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:2052 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229892AbhEKHlW (ORCPT ); Tue, 11 May 2021 03:41:22 -0400 Received: from dggeml764-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FfV8c1LbKzWhXN; Tue, 11 May 2021 15:36:00 +0800 (CST) Received: from dggpemm000003.china.huawei.com (7.185.36.128) by dggeml764-chm.china.huawei.com (10.1.199.174) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Tue, 11 May 2021 15:40:13 +0800 Received: from [10.174.187.224] (10.174.187.224) by dggpemm000003.china.huawei.com (7.185.36.128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 11 May 2021 15:40:13 +0800 Subject: Re: [RFC PATCH v4 01/13] iommu: Introduce dirty log tracking framework To: Lu Baolu , , , , Robin Murphy , Will Deacon , "Joerg Roedel" , Jean-Philippe Brucker , Yi Sun , Tian Kevin References: <20210507102211.8836-1-zhukeqian1@huawei.com> <20210507102211.8836-2-zhukeqian1@huawei.com> <18ac787a-179e-71f7-728b-c43feda80a16@huawei.com> <55fda826-9ab6-a3a0-b17e-a4d4879f00bc@linux.intel.com> CC: Alex Williamson , Kirti Wankhede , Cornelia Huck , Jonathan Cameron , , , , From: Keqian Zhu Message-ID: <60182a35-e151-7150-3708-4e58dd8e78da@huawei.com> Date: Tue, 11 May 2021 15:40:12 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.187.224] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm000003.china.huawei.com (7.185.36.128) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Baolu, On 2021/5/11 11:12, Lu Baolu wrote: > Hi Keqian, > > On 5/10/21 7:07 PM, Keqian Zhu wrote: >>>>> I suppose this interface is to ask the vendor IOMMU driver to check >>>>> whether each device/iommu in the domain supports dirty bit tracking. >>>>> But what will happen if new devices with different tracking capability >>>>> are added afterward? >>>> Yep, this is considered in the vfio part. We will query again after attaching or >>>> detaching devices from the domain. When the domain becomes capable, we enable >>>> dirty log for it. When it becomes not capable, we disable dirty log for it. >>> If that's the case, why not putting this logic in the iommu subsystem so >>> that it doesn't need to be duplicate in different upper layers? >>> >>> For example, add something like dirty_page_trackable in the struct of >>> iommu_domain and ask the vendor iommu driver to update it once any >>> device is added/removed to/from the domain. It's also better to disallow >> If we do it, the upper layer still needs to query the capability from domain and switch >> dirty log tracking for it. Or do you mean the domain can switch dirty log tracking automatically >> when its capability change? If so, I think we're lack of some flexibility. The upper layer >> may have it's own policy, such as only enable dirty log tracking when all domains are capable, >> and disable dirty log tracking when just one domain is not capable. > > I may not get you. > > Assume that dirty_page_trackable is an attribution of an iommu_domain. > This attribution might be changed once a new device (with different > capability) added or removed. So it should be updated every time a new > device is attached or detached. This work could be done by the vendor > iommu driver on the path of dev_attach/dev_detach callback. Yes, this is what I understand you. > > For upper layers, before starting page tracking, they check the > dirty_page_trackable attribution of the domain and start it only it's > capable. Once the page tracking is switched on the vendor iommu driver > (or iommu core) should block further device attach/detach operations > until page tracking is stopped. But when a domain becomes capable after detaching a device, the upper layer still needs to query it and enable dirty log for it... To make things coordinated, maybe the upper layer can register a notifier, when the domain's capability change, the upper layer do not need to query, instead they just need to realize a callback, and do their specific policy in the callback. What do you think? > >> >>> any domain attach/detach once the dirty page tracking is on. >> Yep, this can greatly simplify our code logic, but I don't know whether our maintainers >> agree that, as they may think that IOMMU dirty logging should not change original domain >> behaviors. > > The maintainer owns the last word, but we need to work out a generic and > self-contained API set. OK, I see. Thanks, Keqian