Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4273314pxj; Wed, 12 May 2021 01:45:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy22dySAV0YQyJFcEttg6+NvacZ3Trt6Jfqmb95+jj90ABxZqwdWeBL2h/jRNg+vl/iIZLq X-Received: by 2002:a05:6e02:20ce:: with SMTP id 14mr30199444ilq.102.1620809106011; Wed, 12 May 2021 01:45:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620809106; cv=none; d=google.com; s=arc-20160816; b=DyW5/ngMYZAWTW/19p0Bu6QPblU6xBO/zbG9gJqLRPInsX/zDk/8+xD7QHPzvG2i2V 99Vq4Y8dCHjHHQVWgS5P/U+UnIJhLmwAVV/FzUtsXPAu3YXHNS8FFV7yhpwLQWndROk0 WlrGDlWXi+ub657hXwel5ubVtYmyhT5Qku6HktbBSpFQWfO9nL4vMw3CkQ+nSEmwFF43 /Fktt/+exzNIb+KOTbpVfBEHvZgEGpmYqDRjnCTbgbOlwS8mscWuzEe96/xcpbLF/Q9Z amk5pptnB+EPwibWwvE2yXYwOQmeZR0Ad3LwKBtIUCd10COgnPcQXxGe7lsTgxwh+avy IULw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=5lleOQbIRaC/eS2kHNbBG29yWsYxxqIeLyxO22yPyds=; b=O6uC9KRqRef0fEJBeokX5lSJnB02ShFtDCWiJ1vZGKP+043kFgFVouEbAw1HwPzfFQ CtanXGajHSeS37JXlanleS6lcLha8rCF6NjuN/daLkWdZyhGjJXM07iajzOqhdcYnSJe VSPRJQuX/GeBKuFNrFS+vVXIrrBrfG8tc9YpYrgQuJuy48fyIFnN6xxqPpz367BhCQtT TMNyxB5FJrWA4E04SDkF52zWC9m9tp7ttTq3kykJqPg9u7nX9zsJFcqZvcfEY8HjslCp F4MC8cLddr7of90ACivUy9UqRq39PSsNYR0JAU3D98nnb/xdBbmZO+uZk3CM1sOWJcEe va2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u24si21325959iom.67.2021.05.12.01.44.52; Wed, 12 May 2021 01:45:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230181AbhELIp1 (ORCPT + 99 others); Wed, 12 May 2021 04:45:27 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:2639 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229968AbhELIp1 (ORCPT ); Wed, 12 May 2021 04:45:27 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Fg7ZR35LGzlYJM; Wed, 12 May 2021 16:42:07 +0800 (CST) Received: from [10.174.187.224] (10.174.187.224) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.498.0; Wed, 12 May 2021 16:44:11 +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> <60182a35-e151-7150-3708-4e58dd8e78da@huawei.com> <36cc7267-6aa3-db54-b08c-c2dfc0bbacb6@linux.intel.com> CC: Alex Williamson , Kirti Wankhede , Cornelia Huck , Jonathan Cameron , , , , From: Keqian Zhu Message-ID: Date: Wed, 12 May 2021 16:44:11 +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: <36cc7267-6aa3-db54-b08c-c2dfc0bbacb6@linux.intel.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.187.224] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/5/12 11:20, Lu Baolu wrote: > On 5/11/21 3:40 PM, Keqian Zhu wrote: >>> 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? >> > > That might be an option. But why not checking domain's attribution every > time a new tracking period is about to start? Hi Baolu, I'll add an attribution in iommu_domain, and the vendor iommu driver will update the attribution when attach/detach devices. The attribute should be protected by a lock, so the upper layer shouldn't access the attribute directly. Then the iommu_domain_support_dirty_log() still should be retained. Does this design looks good to you? Thanks, Keqian