From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takuya Yoshikawa Subject: [PATCH 2/3 kvm-unit-tests] dirty-log-perf: Split guest memory into two slots Date: Sun, 15 Jan 2012 12:44:30 +0900 Message-ID: <20120115124430.2485071dee7e99b37d4d1776@gmail.com> References: <20120115124131.3b460d1d85194edaa251e635@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: avi@redhat.com, mtosatti@redhat.com Return-path: Received: from mail-iy0-f174.google.com ([209.85.210.174]:49713 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754786Ab2AODoe (ORCPT ); Sat, 14 Jan 2012 22:44:34 -0500 Received: by iagf6 with SMTP id f6so606958iag.19 for ; Sat, 14 Jan 2012 19:44:34 -0800 (PST) In-Reply-To: <20120115124131.3b460d1d85194edaa251e635@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: VGA frame buffer logging may be affected by other large slots like RAM, so make it possible to test such cases. E.g. 8K pages for the logged slot and 256K pages for the entire memory space can be considered as 32MB framebuffer in 1GB memory space. Signed-off-by: Takuya Yoshikawa --- api/dirty-log-perf.cc | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/api/dirty-log-perf.cc b/api/dirty-log-perf.cc index b9e9796..f48bc95 100644 --- a/api/dirty-log-perf.cc +++ b/api/dirty-log-perf.cc @@ -10,6 +10,7 @@ namespace { const int page_size = 4096; const int64_t nr_total_pages = 256 * 1024; +const int64_t nr_slot_pages = 256 * 1024; // Return the current time in nanoseconds. uint64_t time_ns() @@ -50,8 +51,8 @@ void check_dirty_log(kvm::vcpu& vcpu, mem_slot& slot, void* slot_head) slot.set_dirty_logging(true); slot.update_dirty_log(); - for (int64_t i = 1; i <= nr_total_pages; i *= 2) { - do_guest_write(vcpu, slot_head, i, nr_total_pages); + for (int64_t i = 1; i <= nr_slot_pages; i *= 2) { + do_guest_write(vcpu, slot_head, i, nr_slot_pages); uint64_t start_ns = time_ns(); slot.update_dirty_log(); @@ -84,7 +85,11 @@ int main(int ac, char **av) identity::vm ident_vm(vm, memmap, hole); kvm::vcpu vcpu(vm, 0); - mem_slot slot(memmap, mem_addr, mem_size, mem_head); + uint64_t slot_size = nr_slot_pages * page_size; + uint64_t next_addr = mem_addr + slot_size; + uint64_t next_size = mem_size - slot_size; + mem_slot slot(memmap, mem_addr, slot_size, mem_head); + mem_slot other_slot(memmap, next_addr, next_size, (void *)next_addr); // pre-allocate shadow pages do_guest_write(vcpu, mem_head, nr_total_pages, nr_total_pages); -- 1.7.5.4