On Wed, Oct 21, 2020 at 06:42:19PM +0100, Dr. David Alan Gilbert wrote: > * Peter Xu (pet...@redhat.com) wrote: > > On Wed, Oct 21, 2020 at 03:23:45PM +0100, Dr. David Alan Gilbert wrote: > > > > @@ -354,8 +368,33 @@ int > > > > migrate_send_rp_message_req_pages(MigrationIncomingState *mis, > > > > } > > > > > > > > int migrate_send_rp_req_pages(MigrationIncomingState *mis, > > > > - RAMBlock *rb, ram_addr_t start) > > > > + RAMBlock *rb, ram_addr_t start, uint64_t > > > > haddr) > > > > { > > > > + void *aligned = (void *)(uintptr_t)(haddr & > > > > qemu_real_host_page_mask); > > > > > > Can you remind me, what happens here for hugepages? > > > > Sure. Previously it was: > > > > (haddr & (-qemu_target_page_size()) > > > > Now it is: > > > > (haddr & qemu_real_host_page_mask) > > > > Basically we changed the psize alignment from guest to host. > > > > The bug triggered previously on ppc64 where host_psize=64k, then when guest > > psize is smaller, e.g., 4k, we can have some addr that aligned to 4k rather > > than 64k, so we failed later on checking the host psize alignment (because > > this > > pointer should point to a host page, so it should align with host psize). > > But my question is what happens when we have say a 2MB hugepage?
Oops, I definitely misread. Good point, I think it can break hugepages. So the mask should really be "(qemu_ram_pagesize(rb) - 1)". I'll fix and smoke it with some huge pages before another repost. Thanks! -- Peter Xu