Patchwork [v2,10/13] Drop dirty log start/stop infrastructure

login
register
mail settings
Submitter Jan Kiszka
Date June 23, 2011, 11:09 a.m.
Message ID <4E031ED6.1050804@web.de>
Download mbox | patch
Permalink /patch/101609/
State New
Headers show

Comments

Jan Kiszka - June 23, 2011, 11:09 a.m.
From: Jan Kiszka <jan.kiszka@siemens.com>

No more users of vga_dirty_log_start/start, thus also no use anymore for
the log_start/stop CPUPhysMemoryClient callbacks. Drop the whole
infrastructure.

CC: Anthony PERARD <anthony.perard@citrix.com>
CC: Michael S. Tsirkin <mst@redhat.com>
CC: Avi Kivity <avi@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Changes in v2:
 - rebased over master, removing the freshly added Xen hooks

Avi, does this match your plans for a new memory API? Or would be end up
reintroducing such callbacks after the refactoring?
---
 cpu-all.h    |    6 ------
 cpu-common.h |    4 ----
 exec.c       |   30 ------------------------------
 hw/vga.c     |   36 ------------------------------------
 hw/vga_int.h |    3 ---
 hw/vhost.c   |    2 --
 kvm-all.c    |   47 -----------------------------------------------
 xen-all.c    |   18 ------------------
 8 files changed, 0 insertions(+), 146 deletions(-)
Avi Kivity - June 23, 2011, 11:53 a.m.
On 06/23/2011 02:09 PM, Jan Kiszka wrote:
> From: Jan Kiszka<jan.kiszka@siemens.com>
>
> No more users of vga_dirty_log_start/start, thus also no use anymore for
> the log_start/stop CPUPhysMemoryClient callbacks. Drop the whole
> infrastructure.
>
> CC: Anthony PERARD<anthony.perard@citrix.com>
> CC: Michael S. Tsirkin<mst@redhat.com>
> CC: Avi Kivity<avi@redhat.com>
> Signed-off-by: Jan Kiszka<jan.kiszka@siemens.com>
> ---
>
> Changes in v2:
>   - rebased over master, removing the freshly added Xen hooks
>
> Avi, does this match your plans for a new memory API? Or would be end up
> reintroducing such callbacks after the refactoring?

I think we should be fine.

Patch

diff --git a/cpu-all.h b/cpu-all.h
index 880f570..ac81a07 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -1015,12 +1015,6 @@  int cpu_physical_memory_get_dirty_tracking(void);
 int cpu_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
                                    target_phys_addr_t end_addr);
 
-int cpu_physical_log_start(target_phys_addr_t start_addr,
-                           ram_addr_t size);
-
-int cpu_physical_log_stop(target_phys_addr_t start_addr,
-                          ram_addr_t size);
-
 void dump_exec_info(FILE *f, fprintf_function cpu_fprintf);
 #endif /* !CONFIG_USER_ONLY */
 
diff --git a/cpu-common.h b/cpu-common.h
index b027e43..07379c5 100644
--- a/cpu-common.h
+++ b/cpu-common.h
@@ -112,10 +112,6 @@  struct CPUPhysMemoryClient {
                              target_phys_addr_t end_addr);
     int (*migration_log)(struct CPUPhysMemoryClient *client,
                          int enable);
-    int (*log_start)(struct CPUPhysMemoryClient *client,
-                     target_phys_addr_t phys_addr, ram_addr_t size);
-    int (*log_stop)(struct CPUPhysMemoryClient *client,
-                    target_phys_addr_t phys_addr, ram_addr_t size);
     QLIST_ENTRY(CPUPhysMemoryClient) list;
 };
 
diff --git a/exec.c b/exec.c
index b03b5be..56b95ab 100644
--- a/exec.c
+++ b/exec.c
@@ -2127,36 +2127,6 @@  int cpu_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
     return ret;
 }
 
-int cpu_physical_log_start(target_phys_addr_t start_addr,
-                           ram_addr_t size)
-{
-    CPUPhysMemoryClient *client;
-    QLIST_FOREACH(client, &memory_client_list, list) {
-        if (client->log_start) {
-            int r = client->log_start(client, start_addr, size);
-            if (r < 0) {
-                return r;
-            }
-        }
-    }
-    return 0;
-}
-
-int cpu_physical_log_stop(target_phys_addr_t start_addr,
-                          ram_addr_t size)
-{
-    CPUPhysMemoryClient *client;
-    QLIST_FOREACH(client, &memory_client_list, list) {
-        if (client->log_stop) {
-            int r = client->log_stop(client, start_addr, size);
-            if (r < 0) {
-                return r;
-            }
-        }
-    }
-    return 0;
-}
-
 static inline void tlb_update_dirty(CPUTLBEntry *tlb_entry)
 {
     ram_addr_t ram_addr;
diff --git a/hw/vga.c b/hw/vga.c
index fdfa3c4..a74f581 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -1570,42 +1570,6 @@  static void vga_sync_dirty_bitmap(VGACommonState *s)
 
 }
 
-void vga_dirty_log_start(VGACommonState *s)
-{
-    if (s->map_addr) {
-        cpu_physical_log_start(s->map_addr, s->map_end - s->map_addr);
-    }
-
-    if (s->lfb_vram_mapped) {
-        cpu_physical_log_start(isa_mem_base + 0xa0000, 0x8000);
-        cpu_physical_log_start(isa_mem_base + 0xa8000, 0x8000);
-    }
-
-#ifdef CONFIG_BOCHS_VBE
-    if (s->vbe_mapped) {
-        cpu_physical_log_start(VBE_DISPI_LFB_PHYSICAL_ADDRESS, s->vram_size);
-    }
-#endif
-}
-
-void vga_dirty_log_stop(VGACommonState *s)
-{
-    if (s->map_addr) {
-        cpu_physical_log_stop(s->map_addr, s->map_end - s->map_addr);
-    }
-
-    if (s->lfb_vram_mapped) {
-        cpu_physical_log_stop(isa_mem_base + 0xa0000, 0x8000);
-        cpu_physical_log_stop(isa_mem_base + 0xa8000, 0x8000);
-    }
-
-#ifdef CONFIG_BOCHS_VBE
-    if (s->vbe_mapped) {
-        cpu_physical_log_stop(VBE_DISPI_LFB_PHYSICAL_ADDRESS, s->vram_size);
-    }
-#endif
-}
-
 /*
  * graphic modes
  */
diff --git a/hw/vga_int.h b/hw/vga_int.h
index 5cd9a6e..73328c2 100644
--- a/hw/vga_int.h
+++ b/hw/vga_int.h
@@ -194,9 +194,6 @@  void vga_init(VGACommonState *s);
 int vga_init_io(VGACommonState *s);
 void vga_common_reset(VGACommonState *s);
 
-void vga_dirty_log_start(VGACommonState *s);
-void vga_dirty_log_stop(VGACommonState *s);
-
 extern const VMStateDescription vmstate_vga_common;
 uint32_t vga_ioport_read(void *opaque, uint32_t addr);
 void vga_ioport_write(void *opaque, uint32_t addr, uint32_t val);
diff --git a/hw/vhost.c b/hw/vhost.c
index 80f771e..b7e6284 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -668,8 +668,6 @@  int vhost_dev_init(struct vhost_dev *hdev, int devfd, bool force)
     hdev->client.set_memory = vhost_client_set_memory;
     hdev->client.sync_dirty_bitmap = vhost_client_sync_dirty_bitmap;
     hdev->client.migration_log = vhost_client_migration_log;
-    hdev->client.log_start = NULL;
-    hdev->client.log_stop = NULL;
     hdev->mem = qemu_mallocz(offsetof(struct vhost_memory, regions));
     hdev->log = NULL;
     hdev->log_size = 0;
diff --git a/kvm-all.c b/kvm-all.c
index cbc2532..c95a64d 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -100,24 +100,6 @@  static KVMSlot *kvm_alloc_slot(KVMState *s)
     abort();
 }
 
-static KVMSlot *kvm_lookup_matching_slot(KVMState *s,
-                                         target_phys_addr_t start_addr,
-                                         target_phys_addr_t end_addr)
-{
-    int i;
-
-    for (i = 0; i < ARRAY_SIZE(s->slots); i++) {
-        KVMSlot *mem = &s->slots[i];
-
-        if (start_addr == mem->start_addr &&
-            end_addr == mem->start_addr + mem->memory_size) {
-            return mem;
-        }
-    }
-
-    return NULL;
-}
-
 /*
  * Find overlapping slot with lowest start address
  */
@@ -274,33 +256,6 @@  static int kvm_slot_dirty_pages_log_change(KVMSlot *mem, bool log_dirty)
     return kvm_set_user_memory_region(s, mem);
 }
 
-static int kvm_dirty_pages_log_change(target_phys_addr_t phys_addr,
-                                      ram_addr_t size, bool log_dirty)
-{
-    KVMState *s = kvm_state;
-    KVMSlot *mem = kvm_lookup_matching_slot(s, phys_addr, phys_addr + size);
-
-    if (mem == NULL)  {
-        fprintf(stderr, "BUG: %s: invalid parameters " TARGET_FMT_plx "-"
-                TARGET_FMT_plx "\n", __func__, phys_addr,
-                (target_phys_addr_t)(phys_addr + size - 1));
-        return -EINVAL;
-    }
-    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)
-{
-    return kvm_dirty_pages_log_change(phys_addr, size, true);
-}
-
-static int kvm_log_stop(CPUPhysMemoryClient *client,
-                        target_phys_addr_t phys_addr, ram_addr_t size)
-{
-    return kvm_dirty_pages_log_change(phys_addr, size, false);
-}
-
 static int kvm_set_migration_log(int enable)
 {
     KVMState *s = kvm_state;
@@ -679,8 +634,6 @@  static CPUPhysMemoryClient kvm_cpu_phys_memory_client = {
     .set_memory = kvm_client_set_memory,
     .sync_dirty_bitmap = kvm_client_sync_dirty_bitmap,
     .migration_log = kvm_client_migration_log,
-    .log_start = kvm_log_start,
-    .log_stop = kvm_log_stop,
 };
 
 static void kvm_handle_interrupt(CPUState *env, int mask)
diff --git a/xen-all.c b/xen-all.c
index fcb106f..3c87b36 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -416,22 +416,6 @@  static int xen_sync_dirty_bitmap(XenIOState *state,
     return 0;
 }
 
-static int xen_log_start(CPUPhysMemoryClient *client, target_phys_addr_t phys_addr, ram_addr_t size)
-{
-    XenIOState *state = container_of(client, XenIOState, client);
-
-    return xen_sync_dirty_bitmap(state, phys_addr, size);
-}
-
-static int xen_log_stop(CPUPhysMemoryClient *client, target_phys_addr_t phys_addr, ram_addr_t size)
-{
-    XenIOState *state = container_of(client, XenIOState, client);
-
-    state->log_for_dirtybit = NULL;
-    /* Disable dirty bit tracking */
-    return xc_hvm_track_dirty_vram(xen_xc, xen_domid, 0, 0, NULL);
-}
-
 static int xen_client_sync_dirty_bitmap(struct CPUPhysMemoryClient *client,
                                         target_phys_addr_t start_addr,
                                         target_phys_addr_t end_addr)
@@ -451,8 +435,6 @@  static CPUPhysMemoryClient xen_cpu_phys_memory_client = {
     .set_memory = xen_client_set_memory,
     .sync_dirty_bitmap = xen_client_sync_dirty_bitmap,
     .migration_log = xen_client_migration_log,
-    .log_start = xen_log_start,
-    .log_stop = xen_log_stop,
 };
 
 /* VCPU Operations, MMIO, IO ring ... */