Skip to contentSkip to conversation

kvm: flush the dirty log when unregistering a slot

PATCH Applied Avi Kivity 5 participants 10 messages Jan 15, 2012 – Jan 29, 2012 KVM

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 kvm: flush the dirty log when unregistering a slot

Otherwise, the dirty log information is lost in the kernel forever.

Fixes opensuse-12.1 boot screen, which changes the vga windows rapidly.

---

This patch gives me a deja vu - I'm sure I've fixed exactly the same issue before.

Please test.

 kvm-all.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
kvm-all.c +4 -0
index 3174f42..2cc4562 100644
@@ -566,6 +566,10 @@ static void kvm_set_phys_mem(MemoryRegionSection *section, bool add)
 
         old = *mem;
 
+        if (mem->flags & KVM_MEM_LOG_DIRTY_PAGES) {
+            kvm_physical_sync_dirty_bitmap(section);
+        }
+
         /* unregister the overlapping slot */
         mem->memory_size = 0;
         err = kvm_set_user_memory_region(s, mem);
Signature · 1 line
1.7.7.1
#1 lore raw
Quoted 3 lines · Avi Kivity

Otherwise, the dirty log information is lost in the kernel forever.

Fixes opensuse-12.1 boot screen, which changes the vga windows rapidly.

Confirmed, problems solved here.

Thanks,
Jan

Quoted 29 lines

---

This patch gives me a deja vu - I'm sure I've fixed exactly the same issue before.

Please test.

 kvm-all.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
kvm-all.c +4 -1
index 3174f42..2cc4562 100644
@@ -566,6 +566,10 @@ static void kvm_set_phys_mem(MemoryRegionSection *section, bool add)
 
         old = *mem;
 
+        if (mem->flags & KVM_MEM_LOG_DIRTY_PAGES) {
+            kvm_physical_sync_dirty_bitmap(section);
+        }
+
         /* unregister the overlapping slot */
         mem->memory_size = 0;
         err = kvm_set_user_memory_region(s, mem);
-- 1.7.7.1
#2 lore raw
Quoted 6 lines · Jan Kiszka
Quoted 3 lines · Avi Kivity

Otherwise, the dirty log information is lost in the kernel forever.

Fixes opensuse-12.1 boot screen, which changes the vga windows rapidly.

Confirmed, problems solved here.

Problem from: http://permalink.gmane.org/gmane.comp.emulators.qemu/131853

Confirmed to be fixed, too. Long awaited patch :-)

BTW: There is also a major difference in video performance:
1.) With Patch: 1400MB/s (MByte/s)
2.) Without Patch: 6MB/s

Any reason for that?

Ciao,
Gerhard

Signature · 1 line
http://www.wiesinger.com/
author
#3 lore raw
Quoted 5 lines · Gerhard Wiesinger
Quoted 3 lines · Jan Kiszka
Quoted 2 lines · Avi Kivity

Otherwise, the dirty log information is lost in the kernel forever.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Fixes opensuse-12.1 boot screen, which changes the vga windows rapidly.

Confirmed, problems solved here.

Problem from: http://permalink.gmane.org/gmane.comp.emulators.qemu/131853

Confirmed to be fixed, too. Long awaited patch :-)

Sorry, I forgot about that. Please ping me if I do that.

Quoted 6 lines

BTW: There is also a major difference in video performance:
1.) With Patch: 1400MB/s (MByte/s)
2.) Without Patch: 6MB/s

Any reason for that?

What are you measuring exactly?

Signature · 1 line
error compiling committee.c: too many arguments to function
#8 lore raw
In reply to Avi Kivity
Quoted 7 lines · Avi Kivity

Otherwise, the dirty log information is lost in the kernel forever.

Fixes opensuse-12.1 boot screen, which changes the vga windows rapidly.

---

Quoted 7 lines

This patch gives me a deja vu - I'm sure I've fixed exactly the same issue before.

Please test.

 kvm-all.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Applied to uq/master, thanks.

#9 lore raw
Quoted 11 lines · Marcelo Tosatti
Quoted 10 lines · Avi Kivity

Otherwise, the dirty log information is lost in the kernel forever.

Fixes opensuse-12.1 boot screen, which changes the vga windows rapidly.

---

This patch gives me a deja vu - I'm sure I've fixed exactly the same issue before.

Quoted 6 lines
Quoted 4 lines

Please test.

 kvm-all.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Applied to uq/master, thanks.

It's already in qemu/master. Maybe you want to rebase uq/master at this chance.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#4 lore raw
In reply to Avi Kivity
Quoted 17 lines · Avi Kivity
Quoted 5 lines · Gerhard Wiesinger
Quoted 3 lines · Jan Kiszka
Quoted 2 lines · Avi Kivity

Otherwise, the dirty log information is lost in the kernel forever.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Fixes opensuse-12.1 boot screen, which changes the vga windows rapidly.

Confirmed, problems solved here.

Problem from: http://permalink.gmane.org/gmane.comp.emulators.qemu/131853

Confirmed to be fixed, too. Long awaited patch :-)

Sorry, I forgot about that. Please ping me if I do that.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines

BTW: There is also a major difference in video performance:
1.) With Patch: 1400MB/s (MByte/s)
2.) Without Patch: 6MB/s

Any reason for that?

What are you measuring exactly?

I'm measuring VGA video performance under DOS with own written test program.

What's strange, new findings: Measurement doesn't depend on the patch. Sometimes it is high sometimes low. I think I have to investigate further.

Any ideas?

BTW: Please merge the patch into qemu-kvm repository.

Ciao,
Gerhard

--
http://www.wiesinger.com/

author
#5 lore raw
Quoted 29 lines · Gerhard Wiesinger
Quoted 19 lines · Avi Kivity
Quoted 8 lines · Gerhard Wiesinger
Quoted 6 lines · Jan Kiszka
Quoted 4 lines · Avi Kivity

Otherwise, the dirty log information is lost in the kernel forever.

Fixes opensuse-12.1 boot screen, which changes the vga windows rapidly.

Quoted 6 lines
Quoted 1 line

Confirmed, problems solved here.

Problem from:
http://permalink.gmane.org/gmane.comp.emulators.qemu/131853

Confirmed to be fixed, too. Long awaited patch :-)

Sorry, I forgot about that. Please ping me if I do that.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines

BTW: There is also a major difference in video performance:
1.) With Patch: 1400MB/s (MByte/s)
2.) Without Patch: 6MB/s

Any reason for that?

What are you measuring exactly?

Quoted 8 lines

I'm measuring VGA video performance under DOS with own written test program.

What's strange, new findings: Measurement doesn't depend on the patch. Sometimes it is high sometimes low. I think I have to investigate further.

Any ideas?

What vga mode are you using? What does the test program do?

Signature · 1 line
error compiling committee.c: too many arguments to function
#6 lore raw
Quoted 33 lines · Avi Kivity
Quoted 32 lines · Gerhard Wiesinger
Quoted 19 lines · Avi Kivity
Quoted 8 lines · Gerhard Wiesinger
Quoted 6 lines · Jan Kiszka
Quoted 4 lines · Avi Kivity

Otherwise, the dirty log information is lost in the kernel forever.

Fixes opensuse-12.1 boot screen, which changes the vga windows rapidly.

Quoted 6 lines
Quoted 1 line

Confirmed, problems solved here.

Problem from:
http://permalink.gmane.org/gmane.comp.emulators.qemu/131853

Confirmed to be fixed, too. Long awaited patch :-)

Sorry, I forgot about that. Please ping me if I do that.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines

BTW: There is also a major difference in video performance:
1.) With Patch: 1400MB/s (MByte/s)
2.) Without Patch: 6MB/s

Any reason for that?

What are you measuring exactly?

I'm measuring VGA video performance under DOS with own written test program.

Quoted 7 lines
Quoted 5 lines

What's strange, new findings: Measurement doesn't depend on the patch. Sometimes it is high sometimes low. I think I have to investigate further.

Any ideas?

What vga mode are you using? What does the test program do?

DOS Test programs, source and binaries can be found at:
http://www.wiesinger.com/opensource/qemu/

1.) Measures page A000:0000 with videomode 4F02, see:
http://www.wiesinger.com/opensource/qemu/memperf.c

2.) Second test program measures setting and getting video bank, see:
http://www.wiesinger.com/opensource/qemu/int10per.c
We already talked about the low performance some time ago and tracked it down to kernel <=> userspace switching. But I benchmarked it already once and I think there are some optimizations possible (linear list search) with mapping functions (e.g. trivial hash function before)

Thnx.

Ciao,
Gerhard

--
http://www.wiesinger.com/

author
#7 lore raw
Quoted 39 lines · Gerhard Wiesinger
Quoted 37 lines · Avi Kivity
Quoted 36 lines · Gerhard Wiesinger
Quoted 19 lines · Avi Kivity
Quoted 8 lines · Gerhard Wiesinger
Quoted 6 lines · Jan Kiszka
Quoted 4 lines · Avi Kivity

Otherwise, the dirty log information is lost in the kernel forever.

Fixes opensuse-12.1 boot screen, which changes the vga windows rapidly.

Quoted 6 lines
Quoted 1 line

Confirmed, problems solved here.

Problem from:
http://permalink.gmane.org/gmane.comp.emulators.qemu/131853

Confirmed to be fixed, too. Long awaited patch :-)

Sorry, I forgot about that. Please ping me if I do that.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines

BTW: There is also a major difference in video performance:
1.) With Patch: 1400MB/s (MByte/s)
2.) Without Patch: 6MB/s

Any reason for that?

What are you measuring exactly?

I'm measuring VGA video performance under DOS with own written test program.

What's strange, new findings: Measurement doesn't depend on the patch. Sometimes it is high sometimes low. I think I have to investigate further.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Any ideas?

What vga mode are you using? What does the test program do?

DOS Test programs, source and binaries can be found at:
http://www.wiesinger.com/opensource/qemu/

And which one is slower?

Quoted 9 lines

1.) Measures page A000:0000 with videomode 4F02, see:
http://www.wiesinger.com/opensource/qemu/memperf.c

2.) Second test program measures setting and getting video bank, see:
http://www.wiesinger.com/opensource/qemu/int10per.c
We already talked about the low performance some time ago and tracked it down to kernel <=> userspace switching. But I benchmarked it already once and I think there are some optimizations possible (linear list search) with mapping functions (e.g. trivial hash function before)

That would be due to srcu, but recent optimizations in srcu should make is faster than it was initially (though still slow - kvm trades off memory map update speed for run-time memory access speed).

Signature · 1 line
error compiling committee.c: too many arguments to function