QMP, Introduce xen-set-global-dirty-log command.
This command is used during a migration of a guest under Xen. It calls memory_global_dirty_log_start or memory_global_dirty_log_stop according to the argument pass to the command. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
		
							parent
							
								
									aabc8530c7
								
							
						
					
					
						commit
						39f42439d0
					
				| 
						 | 
				
			
			@ -1955,6 +1955,19 @@
 | 
			
		|||
##
 | 
			
		||||
{ 'command': 'xen-save-devices-state', 'data': {'filename': 'str'} }
 | 
			
		||||
 | 
			
		||||
##
 | 
			
		||||
# @xen-set-global-dirty-log
 | 
			
		||||
#
 | 
			
		||||
# Enable or disable the global dirty log mode.
 | 
			
		||||
#
 | 
			
		||||
# @enable: true to enable, false to disable.
 | 
			
		||||
#
 | 
			
		||||
# Returns: nothing
 | 
			
		||||
#
 | 
			
		||||
# Since: 1.3
 | 
			
		||||
##
 | 
			
		||||
{ 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } }
 | 
			
		||||
 | 
			
		||||
##
 | 
			
		||||
# @device_del:
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -490,6 +490,30 @@ Example:
 | 
			
		|||
     "arguments": { "filename": "/tmp/save" } }
 | 
			
		||||
<- { "return": {} }
 | 
			
		||||
 | 
			
		||||
EQMP
 | 
			
		||||
 | 
			
		||||
    {
 | 
			
		||||
        .name       = "xen-set-global-dirty-log",
 | 
			
		||||
        .args_type  = "enable:b",
 | 
			
		||||
        .mhandler.cmd_new = qmp_marshal_input_xen_set_global_dirty_log,
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
SQMP
 | 
			
		||||
xen-set-global-dirty-log
 | 
			
		||||
-------
 | 
			
		||||
 | 
			
		||||
Enable or disable the global dirty log mode.
 | 
			
		||||
 | 
			
		||||
Arguments:
 | 
			
		||||
 | 
			
		||||
- "enable": Enable it or disable it.
 | 
			
		||||
 | 
			
		||||
Example:
 | 
			
		||||
 | 
			
		||||
-> { "execute": "xen-set-global-dirty-log",
 | 
			
		||||
     "arguments": { "enable": true } }
 | 
			
		||||
<- { "return": {} }
 | 
			
		||||
 | 
			
		||||
EQMP
 | 
			
		||||
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										15
									
								
								xen-all.c
								
								
								
								
							
							
						
						
									
										15
									
								
								xen-all.c
								
								
								
								
							| 
						 | 
				
			
			@ -14,6 +14,7 @@
 | 
			
		|||
#include "hw/pc.h"
 | 
			
		||||
#include "hw/xen_common.h"
 | 
			
		||||
#include "hw/xen_backend.h"
 | 
			
		||||
#include "qmp-commands.h"
 | 
			
		||||
 | 
			
		||||
#include "range.h"
 | 
			
		||||
#include "xen-mapcache.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -36,6 +37,7 @@
 | 
			
		|||
 | 
			
		||||
static MemoryRegion ram_memory, ram_640k, ram_lo, ram_hi;
 | 
			
		||||
static MemoryRegion *framebuffer;
 | 
			
		||||
static bool xen_in_migration;
 | 
			
		||||
 | 
			
		||||
/* Compatibility with older version */
 | 
			
		||||
#if __XEN_LATEST_INTERFACE_VERSION__ < 0x0003020a
 | 
			
		||||
| 
						 | 
				
			
			@ -552,10 +554,14 @@ static void xen_log_sync(MemoryListener *listener, MemoryRegionSection *section)
 | 
			
		|||
 | 
			
		||||
static void xen_log_global_start(MemoryListener *listener)
 | 
			
		||||
{
 | 
			
		||||
    if (xen_enabled()) {
 | 
			
		||||
        xen_in_migration = true;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void xen_log_global_stop(MemoryListener *listener)
 | 
			
		||||
{
 | 
			
		||||
    xen_in_migration = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void xen_eventfd_add(MemoryListener *listener,
 | 
			
		||||
| 
						 | 
				
			
			@ -588,6 +594,15 @@ static MemoryListener xen_memory_listener = {
 | 
			
		|||
    .priority = 10,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void qmp_xen_set_global_dirty_log(bool enable, Error **errp)
 | 
			
		||||
{
 | 
			
		||||
    if (enable) {
 | 
			
		||||
        memory_global_dirty_log_start();
 | 
			
		||||
    } else {
 | 
			
		||||
        memory_global_dirty_log_stop();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* VCPU Operations, MMIO, IO ring ... */
 | 
			
		||||
 | 
			
		||||
static void xen_reset_vcpu(void *opaque)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,7 @@
 | 
			
		|||
#include "qemu-common.h"
 | 
			
		||||
#include "hw/xen.h"
 | 
			
		||||
#include "memory.h"
 | 
			
		||||
#include "qmp-commands.h"
 | 
			
		||||
 | 
			
		||||
void xenstore_store_pv_console_info(int i, CharDriverState *chr)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -54,3 +55,7 @@ int xen_init(void)
 | 
			
		|||
void xen_register_framebuffer(MemoryRegion *mr)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void qmp_xen_set_global_dirty_log(bool enable, Error **errp)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue