On 01/22/2018 10:08 AM, Christian Borntraeger wrote: >> +static inline unsigned long *cmma_bitmap(struct kvm_memory_slot *slot) >> +{ >> + return slot->dirty_bitmap + >> + kvm_dirty_bitmap_bytes(slot) / sizeof(*slot->dirty_bitmap); >> +} >> + > > Hmmm, in virt/kvm/kvm_main.c we do have in kvm_get_dirty_log_protect > > > n = kvm_dirty_bitmap_bytes(memslot); > > dirty_bitmap_buffer = dirty_bitmap + n / sizeof(long); FWIW, I find this variant easier to read. > > > Does it make sense to have that helper common (and call it maybe > > unsigned long *kvm_get_shadow_dirty(struct kvm_memory_slot *slot) >