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=-15.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 9EB6AC433E0 for ; Wed, 17 Mar 2021 03:14:19 +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 3D40964F96 for ; Wed, 17 Mar 2021 03:14:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3D40964F96 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-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uirXOE99QP/7xtq51AY6X5Zld6+ol2KNoHF7lU8vSDQ=; b=Lymu2OsRuKbW3N1UpqIH+fCF6 0f/znrQMSwCrHGfRaeW66E+zgv9tgyaCNWQ8yXpn1xk6UWvFfXBEyfCGzZrIQD8jHbNpX00qNLO1m lfYPt6vZGSMkJ7ASpNTSZVIqc0hddd/4lUbTlfR1R3UP/Lq2GB4vCYcuihVoqV03up+Qe2gnDW99n UAHljZiQz+LenbGdMTjD1/gDSni7blzTF5r5QPTF0Ja3HPKPddmGFPu04Aac8JPlEsCaO9lm6kTSO Rl0OziUGCPO9f9qulHnBzWsudxA6pgKM6mgTrZe7EmDbKpUrK8WKLIQy9GN5F/S7OEY7jdque4X2t SeU/7kLTg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lMMc2-002L7Y-JK; Wed, 17 Mar 2021 03:12:46 +0000 Received: from mga06.intel.com ([134.134.136.31]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lMMbv-002L6p-Ct for linux-arm-kernel@lists.infradead.org; Wed, 17 Mar 2021 03:12:42 +0000 IronPort-SDR: OReby2s69Vi9gQHpvdtjOfch+jGsxMahDusgX3iZQ24TLD5Le5wBDkO3/wFxR0WBuJN1IOPbCe AJcAy9L67JQg== X-IronPort-AV: E=McAfee;i="6000,8403,9925"; a="250739213" X-IronPort-AV: E=Sophos;i="5.81,254,1610438400"; d="scan'208";a="250739213" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2021 20:12:35 -0700 IronPort-SDR: FSv7+WVPIfSeBOm8IDU3guGi4HRgtprZGvblH9S2KmesztcKJG0kwooyKi/3v5SdkuRddznjkE 4JWo7jkqjy5A== X-IronPort-AV: E=Sophos;i="5.81,254,1610438400"; d="scan'208";a="412475709" Received: from yisun1-ubuntu.bj.intel.com (HELO yi.y.sun) ([10.238.156.116]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-SHA256; 16 Mar 2021 20:12:29 -0700 Date: Wed, 17 Mar 2021 11:06:44 +0800 From: Yi Sun To: Keqian Zhu Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, Alex Williamson , Robin Murphy , Will Deacon , Kirti Wankhede , Cornelia Huck , Marc Zyngier , Catalin Marinas , Mark Rutland , James Morse , Suzuki K Poulose , wanghaibin.wang@huawei.com, jiangkunkun@huawei.com, yuzenghui@huawei.com, lushenming@huawei.com Subject: Re: [PATCH v2 04/11] iommu/arm-smmu-v3: Split block descriptor when start dirty log Message-ID: <20210317030644.GO28580@yi.y.sun> References: <20210310090614.26668-1-zhukeqian1@huawei.com> <20210310090614.26668-5-zhukeqian1@huawei.com> <20210316091751.GN28580@yi.y.sun> <84cef87c-af82-8564-fc23-654042448d05@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <84cef87c-af82-8564-fc23-654042448d05@huawei.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210317_031240_058121_ADBEDD9D X-CRM114-Status: GOOD ( 24.79 ) 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 On 21-03-16 19:39:47, Keqian Zhu wrote: > Hi Yi, > > On 2021/3/16 17:17, Yi Sun wrote: > > On 21-03-10 17:06:07, Keqian Zhu wrote: > >> From: jiangkunkun > >> > >> Block descriptor is not a proper granule for dirty log tracking. > >> Take an extreme example, if DMA writes one byte, under 1G mapping, > >> the dirty amount reported to userspace is 1G, but under 4K mapping, > >> the dirty amount is just 4K. > >> > >> This adds a new interface named start_dirty_log in iommu layer and > >> arm smmuv3 implements it, which splits block descriptor to an span > >> of page descriptors. Other types of IOMMU will perform architecture > >> specific actions to start dirty log. > >> > >> To allow code reuse, the split_block operation is realized as an > >> iommu_ops too. We flush all iotlbs after the whole procedure is > >> completed to ease the pressure of iommu, as we will hanle a huge > >> range of mapping in general. > >> > >> Spliting block does not simultaneously work with other pgtable ops, > >> as the only designed user is vfio, which always hold a lock, so race > >> condition is not considered in the pgtable ops. > >> > >> Co-developed-by: Keqian Zhu > >> Signed-off-by: Kunkun Jiang > >> --- > >> > >> changelog: > >> > >> v2: > >> - Change the return type of split_block(). size_t -> int. > >> - Change commit message to properly describe race condition. (Robin) > >> - Change commit message to properly describe the need of split block. > >> - Add a new interface named start_dirty_log(). (Sun Yi) > >> - Change commit message to explain the realtionship of split_block() and start_dirty_log(). > >> > >> --- > >> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 52 +++++++++ > >> drivers/iommu/io-pgtable-arm.c | 122 ++++++++++++++++++++ > >> drivers/iommu/iommu.c | 48 ++++++++ > >> include/linux/io-pgtable.h | 2 + > >> include/linux/iommu.h | 24 ++++ > >> 5 files changed, 248 insertions(+) > >> > > Could you please split iommu common interface to a separate patch? > > This may make review and comments easier. > Yup, good suggestion. > > > > > IMHO, I think the start/stop interfaces could be merged into one, e.g: > > int iommu_domain_set_hwdbm(struct iommu_domain *domain, bool enable, > > unsigned long iova, size_t size, > > int prot); > Looks good, this reduces some code. but I have a concern that this causes loss of flexibility, > as we must pass same arguments when start|stop dirty log. What's your opinion about this? > Per current design, start/stop interfaces have similar arguments. So I think it is ok for now. For future extension, we may think to define a structure to pass these arguments. > > > > Same comments to patch 5. > OK. Thanks. > > > > > BRs, > > Yi Sun > > > >> -- > >> 2.19.1 > > . > Thanks, > Keqian BRs, Yi Sun _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel