qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] vga optmization


From: Avi Kivity
Subject: Re: [Qemu-devel] vga optmization
Date: Tue, 04 Nov 2008 09:23:50 +0200
User-agent: Thunderbird 2.0.0.16 (X11/20080723)

Glauber Costa wrote:
this is a port of current kvm vga memory optimization to our new
infrastructure proposed by anthony. It's goal is to use as few
kvm specific hooks as possible. In fact, the only one I'm relying
on is enabling/disabling of logging. The rest, is pretty much general.

We map the linear frame buffer area as RAM, and then use dirty tracking
to decide whether or not to update it. To be consistent with qemu,
this version, differently from upstream kvm, tracks memory based on its
physical address, represented by vram_offset, instead of vram_ptr, or
any other construct.

Let me know what you think

+int cpu_physical_memory_get_dirty(ram_addr_t addr,
+                                                int dirty_flags)
+{
+    int is_dirty = 0;
+    is_dirty = phys_ram_dirty[addr >> TARGET_PAGE_BITS] & dirty_flags;
+    if (is_dirty)
+        goto out;
+#ifdef CONFIG_KVM
+    if (kvm_enabled())
+        is_dirty = kvm_physical_memory_get_dirty(addr);
+        /* to make it usable below */
+        is_dirty = !!is_dirty * 0xff;
+#endif
+out:
+    return is_dirty;
+}
+

The kvm dirty bitmap and qemu dirty bitmap are different. 'qemu dirty' means 'written to since hte last time the dirty bit was cleared', while 'kvm dirty' means 'written to since the last time the bitmap was synchronized'. So the qemu bitmap is stickier than the kvm bitmap.

The current code accounts for that by merging the kvm bitmap into the qemu bitmap, but you're losing some information here. It doesn't matter for vga, since you're clearing the dirty bit immediately anyway, but it will matter for other uses (example, live migration with the vga optimization enabled).

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]