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 A154EC433ED for ; Thu, 13 May 2021 12:06:27 +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 1FD0D613C8 for ; Thu, 13 May 2021 12:06:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1FD0D613C8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Cc:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=li+/hrwDGWQjo1S4cSiEq1ecKmLCbsKmxEvzfRrFlCc=; b=QKQXPXvA05MlhWunhKBOMWg1B mpULKKRiW2ITyrONc7YeBFTyUabFJ71Np+jard8exVZbIgCJBstLWSc2uHoVnGGwwo8AmO13+KkBc Gez8gp+kRdLyFjXNl9HkDL6t6xQbCgoXVMMDckq0jU3MPb6nQ4ShFMl2Jsj6AOlt1ltMti7aUhEv6 1+hRYWLMywmZwlaZTBqJYDiuHm4SJQ8EfS/htoAeXS6wO6aRCFJKIIuBnn4kjdUWNrKP1v7iDBdDd zI+N79MhRQczSMwPznq+lpjKR8tXHZarZ/WlUHfgdNFcAKk+8PegBdWodUNh5V75hvA4vtcZ+Jy0m taTqUrVag==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lhA4J-005TlE-N2; Thu, 13 May 2021 12:03:57 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lhA4F-005Tkx-VM for linux-arm-kernel@desiato.infradead.org; Thu, 13 May 2021 12:03:52 +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:References:To: Subject:Cc:Sender:Reply-To:Content-ID:Content-Description; bh=7HOGqb63Kjs3XWAGUZ0c6e9kc1pGYEMPFiNrZ3TgoBA=; b=vgdS8F/Uzc2PL6cUqEEeTbXnZ1 oaCqEWZIOlo+PO9NyuxU7rVZUlzMl7U195jMaBH8dhZnApZMHIs1dGPgOCw+Yy2WWmBUe19Crvb5c wmbj56YqRQc3Q/lN4a9F8pWh80OXW8pevyWS6yjisYYoRCIiHa7bQcJTzI/k8cvLlQslpdmyVYtVk xYX/uvjoZP4Oj0i4hXwss9MrYOYhEHnZXH5UNeBgMjNAbqy5GF91Z/2EwcYR1cbNd0HsFLjuwTKp1 U5u+1jjN4RCe3xW1V+g8LXFqq3mKgg3bJt3iOtKU2NTCTMaA8sBz5w6v7HyaaP8m8yRdYjDNDLtEh 8nfu1Rwg==; Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lhA4D-00BE65-6l for linux-arm-kernel@lists.infradead.org; Thu, 13 May 2021 12:03:50 +0000 IronPort-SDR: wfwheDSUwquD+A7hsHL7KTrbEXYXahpnTU3KoPW5igNr3sCPJ8XCU5g+6SERHUHQa8CPq/o1xr zEK3080zyuTA== X-IronPort-AV: E=McAfee;i="6200,9189,9982"; a="179523249" X-IronPort-AV: E=Sophos;i="5.82,296,1613462400"; d="scan'208";a="179523249" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2021 05:03:42 -0700 IronPort-SDR: kfUiTvJZ1XRAiMzDD85xQ4AZvc2CoPqWLiApWLsfmMyUNBoR8072rQ7CR5yJeVvPvATmhq6UKP U7hk43vai35A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,296,1613462400"; d="scan'208";a="623600415" Received: from allen-box.sh.intel.com (HELO [10.239.159.128]) ([10.239.159.128]) by fmsmga006.fm.intel.com with ESMTP; 13 May 2021 05:03:35 -0700 Cc: baolu.lu@linux.intel.com, Alex Williamson , Kirti Wankhede , Cornelia Huck , Jonathan Cameron , wanghaibin.wang@huawei.com, jiangkunkun@huawei.com, yuzenghui@huawei.com, lushenming@huawei.com Subject: Re: [RFC PATCH v4 01/13] iommu: Introduce dirty log tracking framework To: Keqian Zhu , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, 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> <7fb678c7-509b-dbb5-d533-32c5ce2a0476@linux.intel.com> From: Lu Baolu Message-ID: Date: Thu, 13 May 2021 20:02:47 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210513_050349_297360_E8F3007A X-CRM114-Status: GOOD ( 20.56 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 5/13/21 6:58 PM, Keqian Zhu wrote: > > > On 2021/5/12 19:36, Lu Baolu wrote: >> Hi keqian, >> >> On 5/12/21 4:44 PM, Keqian Zhu wrote: >>> >>> >>> 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? >> >> Yes, that's what I was thinking of. But I am not sure whether it worth >> of a lock here. It seems not to be a valid behavior for upper layer to >> attach or detach any device while doing the dirty page tracking. > Hi Baolu, > > Right, if the "detach|attach" interfaces and "dirty tracking" interfaces can be called concurrently, > a lock in iommu_domain_support_dirty_log() is still not enough. I will add another note for the dirty > tracking interfaces. > > Do you have other suggestions? I will accelerate the progress, so I plan to send out v5 next week. No further comments expect below nit: "iommu_switch_dirty_log: Perform actions to start|stop dirty log tracking" How about splitting it into - iommu_start_dirty_log() - iommu_stop_dirty_log() Not a strong opinion anyway. Best regards, baolu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel