Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2929743pxb; Mon, 19 Apr 2021 18:27:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxt0aUWFW2vwrqkGwKRnfTK83Sgp7i/ky0hYHu3FVVqUPaSTxyIwVRGIP92P64uT40aYteT X-Received: by 2002:aa7:c5d0:: with SMTP id h16mr29041973eds.7.1618882032454; Mon, 19 Apr 2021 18:27:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618882032; cv=none; d=google.com; s=arc-20160816; b=yKkLKA2xc2DLcg+qbyfW9/7AhT56kH0NEjh4aE+QaOJfPhLIOQHxcw8ZFJoCZ6egor aOgZqxKz2X4Yvc7y+1swR+xkHTR3cNl6Vx2AmgOYOynWK2kmSYwwoIqLSPk3hE4OeMJj BukwA7ev9fiC4c3VKuistP41JYj8gjBvm9YK4yKF4ysuK2E4C6Nr4BGRX2vrmBjh9zhG xNIQ0C+IeOhSa36bD8yOiCirEJtxEjD86ybfRkbxqUkoAu4WRP6WQTKamMbMxiHzssQp d45e+IaGl07CsvRRVIaj4zn0mxWmfdzTam2Sa46XKxLVWbFVqdAeUOSHddY7ANDuHPil bdjg== 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=+yZfCmaufFEe7a7WyoeXucqCgamRYHN10Mtmd8BU+8g=; b=HqHSVqccVJMhkdTExtxqBubHp0BmMkL9ltOJ9pwjLZQw5WMvvOpEbI5IJjMY1M6Mi/ joVNTdFkZynfum47M3URzSrlWIsNCTCfwNiX3pCiEfMvfkpL+QCyLIySULt9IGrzOIRw dFbGZe5XzORlvdE195hT+vNH+8eMEXV5/D5nik20hB68LHSIBt9Mb/8MChTFzi/ZBvg5 J3B+H3w866G8wR5PQ+CyUA9Jdf+DZJPMxgGwpu1tUoFEMerhkYYz1NlWI237e36BzmCU jD8sph9ES+dBzmbRaw6rU17OzySB4S81frbGgGrEsFCgK1Gnr+lh7kW68+qHY9KevwLF csfA== 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 f8si13041299edy.245.2021.04.19.18.26.49; Mon, 19 Apr 2021 18:27:12 -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 S230300AbhDTB0c (ORCPT + 99 others); Mon, 19 Apr 2021 21:26:32 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:16138 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbhDTB0c (ORCPT ); Mon, 19 Apr 2021 21:26:32 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FPQsw6RDnzmdXJ; Tue, 20 Apr 2021 09:23:00 +0800 (CST) Received: from [10.174.187.224] (10.174.187.224) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.498.0; Tue, 20 Apr 2021 09:25:54 +0800 Subject: Re: [PATCH v3 02/12] iommu: Add iommu_split_block interface To: Lu Baolu , , , , Robin Murphy , Will Deacon , "Joerg Roedel" , Yi Sun , "Jean-Philippe Brucker" , Jonathan Cameron , Tian Kevin References: <20210413085457.25400-1-zhukeqian1@huawei.com> <20210413085457.25400-3-zhukeqian1@huawei.com> <491da550-dc54-42e6-ac91-13d411575fad@huawei.com> CC: Alex Williamson , Cornelia Huck , Kirti Wankhede , , , , From: Keqian Zhu Message-ID: Date: Tue, 20 Apr 2021 09:25:53 +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-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Baolu, On 2021/4/19 21:33, Lu Baolu wrote: > Hi Keqian, > > On 2021/4/19 17:32, Keqian Zhu wrote: >>>> +EXPORT_SYMBOL_GPL(iommu_split_block); >>> Do you really have any consumers of this interface other than the dirty >>> bit tracking? If not, I don't suggest to make this as a generic IOMMU >>> interface. >>> >>> There is an implicit requirement for such interfaces. The >>> iommu_map/unmap(iova, size) shouldn't be called at the same time. >>> Currently there's no such sanity check in the iommu core. A poorly >>> written driver could mess up the kernel by misusing this interface. >> Yes, I don't think up a scenario except dirty tracking. >> >> Indeed, we'd better not make them as a generic interface. >> >> Do you have any suggestion that underlying iommu drivers can share these code but >> not make it as a generic iommu interface? >> >> I have a not so good idea. Make the "split" interfaces as a static function, and >> transfer the function pointer to start_dirty_log. But it looks weird and inflexible. > > I understand splitting/merging super pages is an optimization, but not a > functional requirement. So is it possible to let the vendor iommu driver > decide whether splitting super pages when starting dirty bit tracking > and the opposite operation during when stopping it? The requirement for Right. If I understand you correct, actually that is what this series does. We realized split/merge in IOMMU core layer, but don't force vendor driver to use it. The problem is that when we expose these interfaces to vendor IOMMU driver, will also expose them to upper driver. > upper layer is that starting/stopping dirty bit tracking and > mapping/unmapping are mutually exclusive. OK, I will explicitly add the hints. Thanks. Thanks, Keqian > >> >> On the other hand, if a driver calls map/unmap with split/merge at the same time, >> it's a bug of driver, it should follow the rule. >> > > Best regards, > baolu > . >