Re: [PATCH 13/23] kvm: convert to MemoryListener API
On 2011-12-19 15:13, Avi Kivity wrote: Drop the use of cpu_register_phys_memory_client() in favour of the new MemoryListener API. The new API simplifies the caller, since there is no need to deal with splitting and merging slots; however this is not exploited in this patch. This breaks graphical grub1 with cirrus-vga in KVM mode. Dunno why yet. Jan Signed-off-by: Avi Kivity a...@redhat.com --- kvm-all.c | 107 - 1 files changed, 70 insertions(+), 37 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 4f58ae8..138e0a2 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -27,6 +27,7 @@ #include gdbstub.h #include kvm.h #include bswap.h +#include memory.h /* This check must be after config-host.h is included */ #ifdef CONFIG_EVENTFD @@ -289,16 +290,28 @@ static int kvm_dirty_pages_log_change(target_phys_addr_t phys_addr, return kvm_slot_dirty_pages_log_change(mem, log_dirty); } -static int kvm_log_start(CPUPhysMemoryClient *client, - target_phys_addr_t phys_addr, ram_addr_t size) +static void kvm_log_start(MemoryListener *listener, + MemoryRegionSection *section) { -return kvm_dirty_pages_log_change(phys_addr, size, true); +int r; + +r = kvm_dirty_pages_log_change(section-offset_within_address_space, + section-size, true); +if (r 0) { +abort(); +} } -static int kvm_log_stop(CPUPhysMemoryClient *client, -target_phys_addr_t phys_addr, ram_addr_t size) +static void kvm_log_stop(MemoryListener *listener, + MemoryRegionSection *section) { -return kvm_dirty_pages_log_change(phys_addr, size, false); +int r; + +r = kvm_dirty_pages_log_change(section-offset_within_address_space, + section-size, false); +if (r 0) { +abort(); +} } static int kvm_set_migration_log(int enable) @@ -519,13 +532,15 @@ static int kvm_check_many_ioeventfds(void) return NULL; } -static void kvm_set_phys_mem(target_phys_addr_t start_addr, ram_addr_t size, - ram_addr_t phys_offset, bool log_dirty) +static void kvm_set_phys_mem(MemoryRegionSection *section, bool add) { KVMState *s = kvm_state; -ram_addr_t flags = phys_offset ~TARGET_PAGE_MASK; KVMSlot *mem, old; int err; +MemoryRegion *mr = section-mr; +bool log_dirty = memory_region_is_logging(mr); +target_phys_addr_t start_addr = section-offset_within_address_space; +ram_addr_t size = section-size; void *ram = NULL; /* kvm works in page size chunks, but the function may be called @@ -533,20 +548,19 @@ static void kvm_set_phys_mem(target_phys_addr_t start_addr, ram_addr_t size, size = TARGET_PAGE_ALIGN(size); start_addr = TARGET_PAGE_ALIGN(start_addr); -/* KVM does not support read-only slots */ -phys_offset = ~IO_MEM_ROM; - -if ((phys_offset ~TARGET_PAGE_MASK) == IO_MEM_RAM) { -ram = qemu_safe_ram_ptr(phys_offset); +if (!memory_region_is_ram(mr)) { +return; } +ram = memory_region_get_ram_ptr(mr) + section-offset_within_region; + while (1) { mem = kvm_lookup_overlapping_slot(s, start_addr, start_addr + size); if (!mem) { break; } -if (flags IO_MEM_UNASSIGNED start_addr = mem-start_addr +if (add start_addr = mem-start_addr (start_addr + size = mem-start_addr + mem-memory_size) (ram - start_addr == mem-ram - mem-start_addr)) { /* The new slot fits into the existing one and comes with @@ -575,8 +589,7 @@ static void kvm_set_phys_mem(target_phys_addr_t start_addr, ram_addr_t size, * slot comes around later, we will fail (not seen in practice so far) * - and actually require a recent KVM version. */ if (s-broken_set_mem_region -old.start_addr == start_addr old.memory_size size -flags IO_MEM_UNASSIGNED) { +old.start_addr == start_addr old.memory_size size add) { mem = kvm_alloc_slot(s); mem-memory_size = old.memory_size; mem-start_addr = old.start_addr; @@ -591,7 +604,6 @@ static void kvm_set_phys_mem(target_phys_addr_t start_addr, ram_addr_t size, } start_addr += old.memory_size; -phys_offset += old.memory_size; ram += old.memory_size; size -= old.memory_size; continue; @@ -642,8 +654,7 @@ static void kvm_set_phys_mem(target_phys_addr_t start_addr, ram_addr_t size, if (!size) { return; } -/* KVM does not need to know about this memory */ -if (flags = IO_MEM_UNASSIGNED) { +if (!add) {
Re: [PATCH 13/23] kvm: convert to MemoryListener API
On 2012-01-15 11:49, Jan Kiszka wrote: On 2011-12-19 15:13, Avi Kivity wrote: Drop the use of cpu_register_phys_memory_client() in favour of the new MemoryListener API. The new API simplifies the caller, since there is no need to deal with splitting and merging slots; however this is not exploited in this patch. This breaks graphical grub1 with cirrus-vga in KVM mode. Dunno why yet. In fact, it breaks all vga types in that scenario. Jan signature.asc Description: OpenPGP digital signature
Re: [PATCH 13/23] kvm: convert to MemoryListener API
On 01/15/2012 12:52 PM, Jan Kiszka wrote: On 2012-01-15 11:49, Jan Kiszka wrote: On 2011-12-19 15:13, Avi Kivity wrote: Drop the use of cpu_register_phys_memory_client() in favour of the new MemoryListener API. The new API simplifies the caller, since there is no need to deal with splitting and merging slots; however this is not exploited in this patch. This breaks graphical grub1 with cirrus-vga in KVM mode. Dunno why yet. In fact, it breaks all vga types in that scenario. An F14 guest works here. More info, please. -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 13/23] kvm: convert to MemoryListener API
On 2012-01-15 13:35, Avi Kivity wrote: On 01/15/2012 12:52 PM, Jan Kiszka wrote: On 2012-01-15 11:49, Jan Kiszka wrote: On 2011-12-19 15:13, Avi Kivity wrote: Drop the use of cpu_register_phys_memory_client() in favour of the new MemoryListener API. The new API simplifies the caller, since there is no need to deal with splitting and merging slots; however this is not exploited in this patch. This breaks graphical grub1 with cirrus-vga in KVM mode. Dunno why yet. In fact, it breaks all vga types in that scenario. An F14 guest works here. More info, please. Just try to boot an openSUSE live image (or installation). Grub output is corrupted, obviously dirty logging is not properly set up in that graphic mode. Jan signature.asc Description: OpenPGP digital signature
Re: [PATCH 13/23] kvm: convert to MemoryListener API
On 01/15/2012 02:40 PM, Jan Kiszka wrote: On 2012-01-15 13:35, Avi Kivity wrote: On 01/15/2012 12:52 PM, Jan Kiszka wrote: On 2012-01-15 11:49, Jan Kiszka wrote: On 2011-12-19 15:13, Avi Kivity wrote: Drop the use of cpu_register_phys_memory_client() in favour of the new MemoryListener API. The new API simplifies the caller, since there is no need to deal with splitting and merging slots; however this is not exploited in this patch. This breaks graphical grub1 with cirrus-vga in KVM mode. Dunno why yet. In fact, it breaks all vga types in that scenario. An F14 guest works here. More info, please. Just try to boot an openSUSE live image (or installation). Grub output is corrupted, obviously dirty logging is not properly set up in that graphic mode. Downloading now. -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 13/23] kvm: convert to MemoryListener API
On 01/15/2012 02:49 PM, Avi Kivity wrote: On 01/15/2012 02:40 PM, Jan Kiszka wrote: On 2012-01-15 13:35, Avi Kivity wrote: On 01/15/2012 12:52 PM, Jan Kiszka wrote: On 2012-01-15 11:49, Jan Kiszka wrote: On 2011-12-19 15:13, Avi Kivity wrote: Drop the use of cpu_register_phys_memory_client() in favour of the new MemoryListener API. The new API simplifies the caller, since there is no need to deal with splitting and merging slots; however this is not exploited in this patch. This breaks graphical grub1 with cirrus-vga in KVM mode. Dunno why yet. In fact, it breaks all vga types in that scenario. An F14 guest works here. More info, please. Just try to boot an openSUSE live image (or installation). Grub output is corrupted, obviously dirty logging is not properly set up in that graphic mode. Downloading now. Wait, isn't opensuse grub2 based? Which version should I test? -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 13/23] kvm: convert to MemoryListener API
On 2012-01-15 13:50, Avi Kivity wrote: On 01/15/2012 02:49 PM, Avi Kivity wrote: On 01/15/2012 02:40 PM, Jan Kiszka wrote: On 2012-01-15 13:35, Avi Kivity wrote: On 01/15/2012 12:52 PM, Jan Kiszka wrote: On 2012-01-15 11:49, Jan Kiszka wrote: On 2011-12-19 15:13, Avi Kivity wrote: Drop the use of cpu_register_phys_memory_client() in favour of the new MemoryListener API. The new API simplifies the caller, since there is no need to deal with splitting and merging slots; however this is not exploited in this patch. This breaks graphical grub1 with cirrus-vga in KVM mode. Dunno why yet. In fact, it breaks all vga types in that scenario. An F14 guest works here. More info, please. Just try to boot an openSUSE live image (or installation). Grub output is corrupted, obviously dirty logging is not properly set up in that graphic mode. Downloading now. Wait, isn't opensuse grub2 based? Which version should I test? My test case is 11.4-based, but I think to remember 12.1 is also still grub1 (luckily...). Jan signature.asc Description: OpenPGP digital signature