On Mon, Sep 29, 2008 at 2:29 PM, Glauber Costa <[EMAIL PROTECTED]> wrote:
> On Sun, Sep 28, 2008 at 6:44 PM, Michael Malone
> <[EMAIL PROTECTED]> wrote:
>> 2) (this has been around for quite some time, I just haven't done anything
>> about it)
>> Even though I start up with -smp 2, windows only reads 1 cpu
>>
>> 3) When I run it using the --std-vga parameter, windows boots to just before
>> it gets to the "welcome" screen and hangs.  The output shows a multitude of
>> "kvm: get_dirty_pages returned -2"  Is this something to do with the kernel
>> version I am using?  I am using the standard Ubuntu Hardy Kernel
>
> No. It's a regression introduced in last version. It should work using
> cirrus vga (can you confirm, please?)
>
> It happens because for the specific range std vga is relying the
> memory will be, it do a cpu_register_physical_mem().
> When kvm tries to create a new piece of memory in this place, it's
> marked as already existant.
>
> There are some quick hacks, but I'll be trying to work on a proper fix
> in the following days.

This is a band aid, but proves the general idea. Can you confirm that
it fixes the problem for you ?

-- 
Glauber  Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index dfa63bb..6abb3b9 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -399,8 +399,7 @@ int kvm_create(kvm_context_t kvm, unsigned long phys_mem_bytes, void **vm_mem)
 	return 0;
 }
 
-
-void *kvm_create_phys_mem(kvm_context_t kvm, unsigned long phys_start,
+void *kvm_set_phys_mem(kvm_context_t kvm, unsigned long phys_start,
 			  unsigned long len, int log, int writable)
 {
 	int r;
@@ -441,6 +440,23 @@ void *kvm_create_phys_mem(kvm_context_t kvm, unsigned long phys_start,
         return ptr;
 }
 
+void *kvm_create_phys_mem(kvm_context_t kvm, unsigned long phys_start,
+			  unsigned long len, int log, int writable)
+{
+	int slot = get_container_slot(phys_start, len);
+	int flags = log ? KVM_MEM_LOG_DIRTY_PAGES : 0;
+
+	if (slot == -1) {
+		return kvm_set_phys_mem(kvm, phys_start, len, log, writable);
+	}
+	if (slots[slot].flags == flags) {
+		return slots[slot].userspace_addr;
+	} else {
+		kvm_destroy_phys_mem(kvm, phys_start, len);
+		return kvm_set_phys_mem(kvm, phys_start, len, log, writable);
+	}
+}
+
 int kvm_register_phys_mem(kvm_context_t kvm,
 			  unsigned long phys_start, void *userspace_addr,
 			  unsigned long len, int log)

Reply via email to