>-----Original Message-----
>From: Joao Martins <joao.m.mart...@oracle.com>
>>> The gist of these first four patches is essentially that we need to query 
>>> the
>>> dirty bitmap before unmap, and we have an extra optimization that let us
>>> simply
>>> read the Dirty bit (without clearing it) and so the query is much faster as
>you
>>> don't have a TLB flush.
>>
>> I see the legacy backend use dma_unmap_bitmap to do the same thing in
>one ioctl(),
>> will you add that support in kernel?
>> IIUC, between query and unmap, there is a window in which we will miss
>dirty pages
>> if a buggy guest still raises DMA.
>>
>
>No. My first version of the kernel patches had something like this (but not
>quite done fully correctly), but we deliberately not handle it and we accepted
>that race ... as it was a theoretical use-case and not worth the
>cost/complexity
>it would bring i.e. we would have to write protect the IOPTE, flush, then read
>the dirty bits and then unmap (for something we are not aware it exists).
>
>See commit 609848132c71 ("iommufd: Add a flag to skip clearing of IOPTE
>dirty")
>for the history and inside there's a link to the thread to the discussion.

Clear, thanks for the info.

>
>This flag is meant to make it easier to get dirty bits given the next operation
>is the unmap which will do TLB flush (and also destroy the dirty bit).

OK.

BRs,
Zhenzhong

Reply via email to