On 20/08/2018 09:54, Peter Xu wrote: > +/* Size of the testing memory slot */ > +#define TEST_MEM_PAGES (1ULL << 18) /* 1G for 4K pages */ > +/* How many pages to dirty for each guest loop */ > +#define TEST_PAGES_PER_LOOP 1024 > +/* How many host loops to run (one KVM_GET_DIRTY_LOG for each loop) */ > +#define TEST_HOST_LOOP_N 16 > +/* Interval for each host loop (ms) */ > +#define TEST_HOST_LOOP_INTERVAL 10 How long does the test run overall? Do you get coverage for the set_bit(page, bmap_track) statement? It's okay to increase the values, it's not a problem if the test runs for 10-20 seconds. > + > + /* > + * The default size is (slightly) not enough to put the page > + * tables for the dirty logging memory region. Extend it > + * depending on how big a region we're testing upon > + */ > + mem_size = DEFAULT_GUEST_PHY_PAGES + TEST_MEM_PAGES / 512 * 2; Hmm, now I see why you need the argument; I thought you were just adding more memory for the test pages there but you are (correctly) using a separate memory slot. If it's about the page tables, maybe you could pass TEST_MEM_PAGES to vm_create_default and then do the computation in vm_create_default? (Therefore scrapping my suggestion in patch 4/5). Thanks, Paolo > + vm = _vm_create_default(VCPU_ID, mem_size, guest_code); > + > + /* Add an extra memory slot for testing dirty logging */ > + vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, > + TEST_MEM_OFFSET, > + TEST_MEM_SLOT_INDEX, > + TEST_MEM_PAGES, > + KVM_MEM_LOG_DIRTY_PAGES); > + /* Cache the HVA pointer of the region */