From: Kunkun Jiang <jiangkunkun@huawei.com>
To: "Tian, Kevin" <kevin.tian@intel.com>,
"Alex Williamson" <alex.williamson@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Kirti Wankhede" <kwankhede@nvidia.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Tarun Gupta" <targupta@nvidia.com>,
"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: "shameerali.kolothum.thodi@huawei.com"
<shameerali.kolothum.thodi@huawei.com>,
Eric Auger <eric.auger@redhat.com>, Peter Xu <peterx@redhat.com>,
Zenghui Yu <yuzenghui@huawei.com>,
"wanghaibin.wang@huawei.com" <wanghaibin.wang@huawei.com>,
Keqian Zhu <zhukeqian1@huawei.com>
Subject: Re: [RFC PATCH 0/3] vfio/migration: Support manual clear vfio dirty log
Date: Thu, 18 Mar 2021 20:28:33 +0800 [thread overview]
Message-ID: <fa31ed64-1c6e-f7db-7650-656a22223501@huawei.com> (raw)
In-Reply-To: <MWHPR11MB1886BC40825E4FADA1BFB93F8C699@MWHPR11MB1886.namprd11.prod.outlook.com>
Hi Kevin,
On 2021/3/18 17:04, Tian, Kevin wrote:
>> From: Kunkun Jiang <jiangkunkun@huawei.com>
>> Sent: Thursday, March 18, 2021 3:59 PM
>>
>> Hi Kevin,
>>
>> On 2021/3/18 14:28, Tian, Kevin wrote:
>>>> From: Kunkun Jiang
>>>> Sent: Wednesday, March 10, 2021 5:41 PM
>>>>
>>>> Hi all,
>>>>
>>>> In the past, we clear dirty log immediately after sync dirty log to
>>>> userspace. This may cause redundant dirty handling if userspace
>>>> handles dirty log iteratively:
>>>>
>>>> After vfio clears dirty log, new dirty log starts to generate. These
>>>> new dirty log will be reported to userspace even if they are generated
>>>> before userspace handles the same dirty page.
>>>>
>>>> Since a new dirty log tracking method for vfio based on iommu hwdbm[1]
>>>> has been introduced in the kernel and added a new capability named
>>>> VFIO_DIRTY_LOG_MANUAL_CLEAR, we can eliminate some redundant
>> dirty
>>>> handling by supporting it.
>>> Is there any performance data showing the benefit of this new method?
>>>
>> Current dirty log tracking method for VFIO:
>> [1] All pages marked dirty if not all iommu_groups have pinned_scope
>> [2] pinned pages by various vendor drivers if all iommu_groups have
>> pinned scope
>>
>> Both methods are coarse-grained and can not determine which pages are
>> really dirty. Each round may mark the pages that are not really dirty as
>> dirty
>> and send them to the destination. ( It might be better if the range of the
>> pinned_scope was smaller. ) This will result in a waste of resources.
>>
>> HWDBM is short for Hardware Dirty Bit Management.
>> (e.g. smmuv3 HTTU, Hardware Translation Table Update)
>>
>> About SMMU HTTU:
>> HTTU is a feature of ARM SMMUv3, it can update access flag or/and dirty
>> state of the TTD (Translation Table Descriptor) by hardware.
>>
>> With HTTU, stage1 TTD is classified into 3 types:
>> DBM bit AP[2](readonly bit)
>> 1. writable_clean 1 1
>> 2. writable_dirty 1 0
>> 3. readonly 0 1
>>
>> If HTTU_HD (manage dirty state) is enabled, smmu can change TTD from
>> writable_clean to writable_dirty. Then software can scan TTD to sync dirty
>> state into dirty bitmap. With this feature, we can track the dirty log of
>> DMA continuously and precisely.
>>
>> The capability of VFIO_DIRTY_LOG_MANUAL_CLEAR is similar to that on
>> the KVM side. We add this new log_clear() interface only to split the old
>> log_sync() into two separated procedures:
>>
>> - use log_sync() to collect the collection only, and,
>> - use log_clear() to clear the dirty bitmap.
>>
>> If you're interested in this new method, you can take a look at our set of
>> patches.
>> [1]
>> https://lore.kernel.org/linux-iommu/20210310090614.26668-1-
>> zhukeqian1@huawei.com/
>>
> I know what you are doing. Intel is also working on VT-d dirty bit support
> based on above link. What I'm curious is the actual performance gain
> with this optimization. KVM doing that is one good reference, but IOMMU
> has different characteristics (e.g. longer invalidation latency) compared to
> CPU MMU. It's always good to understand what a so-called optimization
> can actually optimize in a context different from where it's originally proved.😊
>
> Thanks
> Kevin
My understanding is that this is a new method, which is quite different
from the
previous two. So can you explain in more detail what performance data
you want?😁
Thanks,
Kunkun Jiang
next prev parent reply other threads:[~2021-03-18 12:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-10 9:41 [RFC PATCH 0/3] vfio/migration: Support manual clear vfio dirty log Kunkun Jiang
2021-03-10 9:41 ` [RFC PATCH 1/3] linux-headers: update against 5.12-rc2 and "vfio log clear" series Kunkun Jiang
2021-03-10 9:41 ` [RFC PATCH 2/3] vfio: Maintain DMA mapping range for the container Kunkun Jiang
2021-03-10 9:41 ` [RFC PATCH 3/3] vfio/migration: Support VFIO_IOMMU_DIRTY_PAGES_FLAG_CLEAR_BITMAP Kunkun Jiang
2021-03-18 6:22 ` [RFC PATCH 0/3] vfio/migration: Support manual clear vfio dirty log Kunkun Jiang
2021-03-18 6:28 ` Tian, Kevin
2021-03-18 7:59 ` Kunkun Jiang
2021-03-18 9:04 ` Tian, Kevin
2021-03-18 12:28 ` Kunkun Jiang [this message]
2021-03-18 12:36 ` Tian, Kevin
2021-03-18 13:14 ` Kunkun Jiang
2021-03-23 2:48 ` Kunkun Jiang
-- strict thread matches above, loose matches on Subject: below --
2021-05-08 9:31 Kunkun Jiang
2021-05-10 7:42 ` Kunkun Jiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fa31ed64-1c6e-f7db-7650-656a22223501@huawei.com \
--to=jiangkunkun@huawei.com \
--cc=alex.williamson@redhat.com \
--cc=berrange@redhat.com \
--cc=cohuck@redhat.com \
--cc=eric.auger@redhat.com \
--cc=kevin.tian@intel.com \
--cc=kwankhede@nvidia.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=targupta@nvidia.com \
--cc=wanghaibin.wang@huawei.com \
--cc=yuzenghui@huawei.com \
--cc=zhukeqian1@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).