On Tue, Oct 18, 2011 at 7:40 PM, Avi Kivity <a...@redhat.com> wrote:
> On 10/18/2011 08:08 PM, Blue Swirl wrote:
>>
>> > What would the API look like?  accept a range, return true if any of the
>> > pages in the range are dirty?
>>
>> That would be 1:1 conversion but maybe better approach would be to
>> return the first dirty address (or zero if not found), then various
>> bitmap speedups may be available.
>
> Ah, an iterator.  Yes, it would allow switching from iteration on scan
> lines to iteration on actual dirty ranges.
>
> Perhaps
>
>    void memory_region_for_each_dirty_range(MemoryRegion *mr,
>                                            target_phys_addr_t start,
>                                            uint64_t size,
>                                            void (*dirty)(void *opaque,
> target_phys_addr_t start, uint64_t size),
>                                            void *opaque);

That approach could be better for the bitmap conversions, though there
is no way to exit the loop if needed and there is no status available
to the caller (for example about end of last block for bitmap
conversion).

Reply via email to