xen: handle inbound migration of VMs without ioreq server pages
PATCH 1/1 xen: handle inbound migration of VMs without ioreq server pages
VMs created on older versions on Xen will not have been provisioned with pages to support creation of non-default ioreq servers. In this case the ioreq server API is not supported and QEMU's only option is to fall back to using the default ioreq server pages as it did prior to commit 3996e85c ("Xen: Use the ioreq-server API when available").
This patch therefore changes the code in xen_common.h to stop considering a failure of xc_hvm_create_ioreq_server() as a hard failure but simply as an indication that the guest is too old to support the ioreq server API. Instead a boolean is set to cause reversion to old behaviour such that the default ioreq server is then used.
--- include/hw/xen/xen_common.h | 123 +++++++++++++++++++++++++++++++------------- trace-events | 1 + xen-hvm.c | 6 +-- 3 files changed, 90 insertions(+), 40 deletions(-)
include/hw/xen/xen_common.h +88 -35
@@ -107,6 +107,42 @@ static inline int xen_get_vmport_regs_pfn(xc_interface *xc, domid_t dom,#endif +static inline int xen_get_default_ioreq_server_info (xc_interface *xc,domid_t dom, +xen_pfn_t *ioreq_pfn, +xen_pfn_t *bufioreq_pfn, +evtchn_port_t *bufioreq_evtchn) +{ +unsigned long param; +int rc; + + rc =xc_get_hvm_param (xc, dom,HVM_PARAM_IOREQ_PFN , ¶m); +if (rc <0 ) { +fprintf (stderr,"failed to get HVM_PARAM_IOREQ_PFN\n" ); +return -1 ; + } + + *ioreq_pfn = param; + + rc =xc_get_hvm_param (xc, dom,HVM_PARAM_BUFIOREQ_PFN , ¶m); +if (rc <0 ) { +fprintf (stderr,"failed to get HVM_PARAM_BUFIOREQ_PFN\n" ); +return -1 ; + } + + *bufioreq_pfn = param; + + rc =xc_get_hvm_param (xc, dom,HVM_PARAM_BUFIOREQ_EVTCHN , + ¶m); +if (rc <0 ) { +fprintf (stderr,"failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n" ); +return -1 ; + } + + *bufioreq_evtchn = param; + +return 0 ; +} +/* Xen before 4.5 */ #if CONFIG_XEN_CTRL_INTERFACE_VERSION <450
@@ -154,10 +190,9 @@ static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom, { } -static inline int xen_create_ioreq_server (xc_interface *xc,domid_t dom, -ioservid_t *ioservid) +static inline void xen_create_ioreq_server (xc_interface *xc,domid_t dom, +ioservid_t *ioservid) { -return 0 ; } static inline void xen_destroy_ioreq_server(xc_interface *xc, domid_t dom,
@@ -171,35 +206,8 @@ static inline int xen_get_ioreq_server_info(xc_interface *xc, domid_t dom, xen_pfn_t *bufioreq_pfn, evtchn_port_t *bufioreq_evtchn) { -unsigned long param; -int rc; - - rc =xc_get_hvm_param (xc, dom,HVM_PARAM_IOREQ_PFN , ¶m); -if (rc <0 ) { -fprintf (stderr,"failed to get HVM_PARAM_IOREQ_PFN\n" ); -return -1 ; - } - - *ioreq_pfn = param; - - rc =xc_get_hvm_param (xc, dom,HVM_PARAM_BUFIOREQ_PFN , ¶m); -if (rc <0 ) { -fprintf (stderr,"failed to get HVM_PARAM_BUFIOREQ_PFN\n" ); -return -1 ; - } - - *bufioreq_pfn = param; - - rc =xc_get_hvm_param (xc, dom,HVM_PARAM_BUFIOREQ_EVTCHN , - ¶m); -if (rc <0 ) { -fprintf (stderr,"failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n" ); -return -1 ; - } - - *bufioreq_evtchn = param; - -return 0 ; +return xen_get_default_ioreq_server_info (xc, dom, ioreq_pfn, bufioreq_pfn, + bufioreq_evtchn); } static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom,
@@ -212,6 +220,8 @@ static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom,/* Xen 4.5 */ #else +static bool use_default_ioreq_server; +static inline void xen_map_memory_section (xc_interface *xc,domid_t dom,ioservid_t ioservid,MemoryRegionSection *section)
@@ -220,6 +230,10 @@ static inline void xen_map_memory_section(xc_interface *xc, domid_t dom,ram_addr_t size =int128_get64 (section->size);hwaddr end_addr = start_addr + size -1 ; +if (use_default_ioreq_server) { +return ; + } +trace_xen_map_mmio_range (ioservid, start_addr, end_addr);xc_hvm_map_io_range_to_ioreq_server (xc, dom, ioservid,1 , start_addr, end_addr);
@@ -233,6 +247,11 @@ static inline void xen_unmap_memory_section(xc_interface *xc, domid_t dom,ram_addr_t size =int128_get64 (section->size);hwaddr end_addr = start_addr + size -1 ; +if (use_default_ioreq_server) { +return ; + } + +trace_xen_unmap_mmio_range (ioservid, start_addr, end_addr);xc_hvm_unmap_io_range_from_ioreq_server (xc, dom, ioservid,1 , start_addr, end_addr);
@@ -246,6 +265,11 @@ static inline void xen_map_io_section(xc_interface *xc, domid_t dom,ram_addr_t size =int128_get64 (section->size);hwaddr end_addr = start_addr + size -1 ; +if (use_default_ioreq_server) { +return ; + } + +trace_xen_map_portio_range (ioservid, start_addr, end_addr);xc_hvm_map_io_range_to_ioreq_server (xc, dom, ioservid,0 , start_addr, end_addr);
@@ -259,6 +283,10 @@ static inline void xen_unmap_io_section(xc_interface *xc, domid_t dom,ram_addr_t size =int128_get64 (section->size);hwaddr end_addr = start_addr + size -1 ; +if (use_default_ioreq_server) { +return ; + } +trace_xen_unmap_portio_range (ioservid, start_addr, end_addr);xc_hvm_unmap_io_range_from_ioreq_server (xc, dom, ioservid,0 , start_addr, end_addr);
@@ -268,6 +296,10 @@ static inline void xen_map_pcidev(xc_interface *xc, domid_t dom, ioservid_t ioservid, PCIDevice *pci_dev) { + if (use_default_ioreq_server) { +return ; + } +trace_xen_map_pcidev (ioservid,pci_bus_num (pci_dev->bus),PCI_SLOT (pci_dev->devfn),PCI_FUNC (pci_dev->devfn)); xc_hvm_map_pcidev_to_ioreq_server(xc, dom, ioservid,
@@ -280,6 +312,10 @@ static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom, ioservid_t ioservid, PCIDevice *pci_dev) { + if (use_default_ioreq_server) { +return ; + } +trace_xen_unmap_pcidev (ioservid,pci_bus_num (pci_dev->bus),PCI_SLOT (pci_dev->devfn),PCI_FUNC (pci_dev->devfn)); xc_hvm_unmap_pcidev_from_ioreq_server(xc, dom, ioservid,
@@ -288,22 +324,29 @@ static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom, PCI_FUNC(pci_dev->devfn)); } -static inline int xen_create_ioreq_server (xc_interface *xc,domid_t dom, -ioservid_t *ioservid) +static inline void xen_create_ioreq_server (xc_interface *xc,domid_t dom, +ioservid_t *ioservid) {int rc =xc_hvm_create_ioreq_server (xc, dom,HVM_IOREQSRV_BUFIOREQ_ATOMIC , ioservid);if (rc ==0 ) {trace_xen_ioreq_server_create (*ioservid); +return ; } -return rc; + *ioservid =0 ; + use_default_ioreq_server = true; +trace_xen_default_ioreq_server (); }static inline void xen_destroy_ioreq_server (xc_interface *xc,domid_t dom,ioservid_t ioservid) { +if (use_default_ioreq_server) { +return ; + } +trace_xen_ioreq_server_destroy (ioservid);xc_hvm_destroy_ioreq_server (xc, dom, ioservid); }
@@ -314,6 +357,12 @@ static inline int xen_get_ioreq_server_info(xc_interface *xc, domid_t dom, xen_pfn_t *bufioreq_pfn, evtchn_port_t *bufioreq_evtchn) { +if (use_default_ioreq_server) { +return xen_get_default_ioreq_server_info (xc, dom, ioreq_pfn, + bufioreq_pfn, + bufioreq_evtchn); + } +return xc_hvm_get_ioreq_server_info (xc, dom, ioservid, ioreq_pfn, bufioreq_pfn, bufioreq_evtchn);
@@ -323,6 +372,10 @@ static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom, ioservid_t ioservid, bool enable) { + if (use_default_ioreq_server) { +return 0 ; + } +trace_xen_ioreq_server_state (ioservid, enable);return xc_hvm_set_ioreq_server_state (xc, dom, ioservid, enable); }
trace-events +1 -0
@@ -60,6 +60,7 @@ spice_vmc_event(int event) "spice vmc event %d" # xen-hvm.c xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: %#lx, size %#lx" xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_dirty) "%#"PRIx64" size %#lx, log_dirty %i" +xen_default_ioreq_server(void) "" xen_ioreq_server_create(uint32_t id) "id: %u" xen_ioreq_server_destroy(uint32_t id) "id: %u" xen_ioreq_server_state(uint32_t id, bool enable) "id: %u: enable: %i"
xen-hvm.c +1 -5
@@ -1203,11 +1203,7 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory) goto err; } - rc =xen_create_ioreq_server (xen_xc, xen_domid, &state->ioservid); -if (rc <0 ) { -perror ("xen: ioreq server create" ); - goto err; - } +xen_create_ioreq_server (xen_xc, xen_domid, &state->ioservid); state->exit.notify = xen_exit_notifier;qemu_add_exit_notifier (&state->exit);
Signature · 1 line
2.1.4
Quoted 20 lines
-----Original Message-----
From: Paul Durrant [mailto:[email protected]]
Sent: 01 August 2016 10:16
To: [email protected]; [email protected]
Cc: Paul Durrant; Stefano Stabellini; Anthony Perard
Subject: [PATCH] xen: handle inbound migration of VMs without ioreq server pagesVMs created on older versions on Xen will not have been provisioned with pages to support creation of non-default ioreq servers. In this case the ioreq server API is not supported and QEMU's only option is to fall back to using the default ioreq server pages as it did prior to commit
3996e85c("Xen: Use the ioreq-server API when available").This patch therefore changes the code in
xen_common.hto stop considering a failure ofxc_hvm_create_ioreq_server()as a hard failure but simply as an indication that the guest is too old to support the ioreq server API. Instead a boolean is set to cause reversion to old behaviour such that the default ioreq server is then used.
Quoted 3 lines
Signed-off-by Paul Durrant <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>
Apologies, this should also be
Quoted 291 lines
--- include/hw/xen/xen_common.h | 123 +++++++++++++++++++++++++++++++------------- trace-events | 1 + xen-hvm.c | 6 +-- 3 files changed, 90 insertions(+), 40 deletions(-)include/hw/xen/xen_common.h +36
-0@@ -107,6 +107,42 @@ static inline int xen_get_vmport_regs_pfn(xc_interface *xc, domid_t dom, #endif +static inline int xen_get_default_ioreq_server_info(xc_interface *xc, domid_t dom, + xen_pfn_t *ioreq_pfn, + xen_pfn_t *bufioreq_pfn, + evtchn_port_t *bufioreq_evtchn) +{ +unsigned long param; +int rc; + + rc =xc_get_hvm_param (xc, dom,HVM_PARAM_IOREQ_PFN , ¶m); +if (rc <0 ) { +fprintf (stderr,"failed to get HVM_PARAM_IOREQ_PFN\n" ); +return -1 ; + } + + *ioreq_pfn = param; + + rc =xc_get_hvm_param (xc, dom,HVM_PARAM_BUFIOREQ_PFN , ¶m); +if (rc <0 ) { +fprintf (stderr,"failed to get HVM_PARAM_BUFIOREQ_PFN\n" ); +return -1 ; + } + + *bufioreq_pfn = param; + + rc =xc_get_hvm_param (xc, dom,HVM_PARAM_BUFIOREQ_EVTCHN , + ¶m); +if (rc <0 ) { +fprintf (stderr,"failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n" ); +return -1 ; + } + + *bufioreq_evtchn = param; + +return 0 ; +} +/* Xen before 4.5 */
#ifCONFIG_XEN_CTRL_INTERFACE_VERSION< 450include/hw/xen/xen_common.h +2
-3@@ -154,10 +190,9 @@ static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom, { } -static inline int xen_create_ioreq_server (xc_interface *xc,domid_t dom, -ioservid_t *ioservid) +static inline void xen_create_ioreq_server (xc_interface *xc,domid_t dom, +ioservid_t *ioservid) { -return 0 ; }static inline void xen_destroy_ioreq_server(xc_interface *xc,
domid_tdom,include/hw/xen/xen_common.h +2
-29@@ -171,35 +206,8 @@ static inline int xen_get_ioreq_server_info(xc_interface *xc, domid_t dom, xen_pfn_t *bufioreq_pfn, evtchn_port_t *bufioreq_evtchn) { -unsigned long param; -int rc; - - rc =xc_get_hvm_param (xc, dom,HVM_PARAM_IOREQ_PFN , ¶m); -if (rc <0 ) { -fprintf (stderr,"failed to get HVM_PARAM_IOREQ_PFN\n" ); -return -1 ; - } - - *ioreq_pfn = param; - - rc =xc_get_hvm_param (xc, dom,HVM_PARAM_BUFIOREQ_PFN , ¶m); -if (rc <0 ) { -fprintf (stderr,"failed to get HVM_PARAM_BUFIOREQ_PFN\n" ); -return -1 ; - } - - *bufioreq_pfn = param; - - rc =xc_get_hvm_param (xc, dom,HVM_PARAM_BUFIOREQ_EVTCHN , - ¶m); -if (rc <0 ) { -fprintf (stderr,"failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n" ); -return -1 ; - } - - *bufioreq_evtchn = param; - -return 0 ; +return xen_get_default_ioreq_server_info (xc, dom, ioreq_pfn, bufioreq_pfn, + bufioreq_evtchn);}
static inline int xen_set_ioreq_server_state(xc_interface *xc,
domid_tdom,include/hw/xen/xen_common.h +2
-0@@ -212,6 +220,8 @@ static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom,/* Xen 4.5 */ #else +static bool use_default_ioreq_server; + static inline void xen_map_memory_section(xc_interface *xc, domid_t dom,
ioservid_tioservid, MemoryRegionSection *section)include/hw/xen/xen_common.h +4
-0@@ -220,6 +230,10 @@ static inline void xen_map_memory_section(xc_interface *xc, domid_t dom, ram_addr_t size = int128_get64(section->size);hwaddr end_addr = start_addr + size -1 ; +if (use_default_ioreq_server) { +return ; + } +trace_xen_map_mmio_range (ioservid, start_addr, end_addr); xc_hvm_map_io_range_to_ioreq_server(xc, dom, ioservid, 1,start_addr, end_addr);include/hw/xen/xen_common.h +5
-0@@ -233,6 +247,11 @@ static inline void xen_unmap_memory_section(xc_interface *xc, domid_t dom, ram_addr_t size = int128_get64(section->size);hwaddr end_addr = start_addr + size -1 ; +if (use_default_ioreq_server) { +return ; + } + +trace_xen_unmap_mmio_range (ioservid, start_addr, end_addr); xc_hvm_unmap_io_range_from_ioreq_server(xc, dom, ioservid, 1,start_addr, end_addr);include/hw/xen/xen_common.h +5
-0@@ -246,6 +265,11 @@ static inline void xen_map_io_section(xc_interface *xc, domid_t dom, ram_addr_t size = int128_get64(section->size);hwaddr end_addr = start_addr + size -1 ; +if (use_default_ioreq_server) { +return ; + } + +trace_xen_map_portio_range (ioservid, start_addr, end_addr); xc_hvm_map_io_range_to_ioreq_server(xc, dom, ioservid, 0,start_addr, end_addr);include/hw/xen/xen_common.h +4
-0@@ -259,6 +283,10 @@ static inline void xen_unmap_io_section(xc_interface *xc, domid_t dom, ram_addr_t size = int128_get64(section->size);hwaddr end_addr = start_addr + size -1 ; +if (use_default_ioreq_server) { +return ; + } +trace_xen_unmap_portio_range (ioservid, start_addr, end_addr); xc_hvm_unmap_io_range_from_ioreq_server(xc, dom, ioservid, 0,start_addr, end_addr);include/hw/xen/xen_common.h +4
-0@@ -268,6 +296,10 @@ static inline void xen_map_pcidev(xc_interface *xc,domid_t dom, ioservid_t ioservid, PCIDevice *pci_dev) { + if (use_default_ioreq_server) { + return; + } +trace_xen_map_pcidev (ioservid,pci_bus_num (pci_dev->bus),PCI_SLOT (pci_dev->devfn),PCI_FUNC (pci_dev->devfn));xc_hvm_map_pcidev_to_ioreq_server(xc, dom, ioservid,
include/hw/xen/xen_common.h +4
-0@@ -280,6 +312,10 @@ static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom, ioservid_t ioservid, PCIDevice *pci_dev) { +if (use_default_ioreq_server) { +return ; + } +trace_xen_unmap_pcidev (ioservid,pci_bus_num (pci_dev->bus),PCI_SLOT (pci_dev->devfn),PCI_FUNC (pci_dev->devfn));xc_hvm_unmap_pcidev_from_ioreq_server(xc, dom, ioservid,
include/hw/xen/xen_common.h +10
-3@@ -288,22 +324,29 @@ static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom, PCI_FUNC(pci_dev->devfn)); } -static inline int xen_create_ioreq_server (xc_interface *xc,domid_t dom, -ioservid_t *ioservid) +static inline void xen_create_ioreq_server (xc_interface *xc,domid_t dom, +ioservid_t *ioservid) {int rc =xc_hvm_create_ioreq_server (xc, dom,HVM_IOREQSRV_BUFIOREQ_ATOMIC , ioservid);if (rc ==0 ) {trace_xen_ioreq_server_create (*ioservid); +return ; } -return rc; + *ioservid =0 ; + use_default_ioreq_server = true; +trace_xen_default_ioreq_server (); }static inline void xen_destroy_ioreq_server (xc_interface *xc,domid_t dom,ioservid_t ioservid) { +if (use_default_ioreq_server) { +return ; + } +trace_xen_ioreq_server_destroy (ioservid);xc_hvm_destroy_ioreq_server(xc, dom, ioservid);}
include/hw/xen/xen_common.h +6
-0@@ -314,6 +357,12 @@ static inline int xen_get_ioreq_server_info(xc_interface *xc, domid_t dom, xen_pfn_t *bufioreq_pfn, evtchn_port_t *bufioreq_evtchn) { +if (use_default_ioreq_server) { +return xen_get_default_ioreq_server_info (xc, dom, ioreq_pfn, + bufioreq_pfn, + bufioreq_evtchn); + } + return xc_hvm_get_ioreq_server_info(xc, dom, ioservid, ioreq_pfn, bufioreq_pfn,bufioreq_evtchn);include/hw/xen/xen_common.h +4
-0@@ -323,6 +372,10 @@ static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom, ioservid_t ioservid, bool enable) { +if (use_default_ioreq_server) { +return 0 ; + } +trace_xen_ioreq_server_state (ioservid, enable);return xc_hvm_set_ioreq_server_state (xc, dom, ioservid, enable);}
trace-events +0
-0@@ -60,6 +60,7 @@ spice_vmc_event(int event) "spice vmc event %d" # xen-hvm.c xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested:%#lx, size %#lx"
xen_client_set_memory(uint64_tstart_addr, unsigned long size, boollog_dirty) "%#"PRIx64" size %#lx,log_dirty%i"trace-events +1
-0+xen_default_ioreq_server(void) "" xen_ioreq_server_create(uint32_t id) "id: %u" xen_ioreq_server_destroy(uint32_t id) "id: %u" xen_ioreq_server_state(uint32_t id, bool enable) "id: %u: enable: %i"xen-hvm.c +1
-5@@ -1203,11 +1203,7 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory) goto err; } - rc =xen_create_ioreq_server (xen_xc, xen_domid, &state->ioservid); -if (rc <0 ) { -perror ("xen: ioreq server create" ); - goto err; - } +xen_create_ioreq_server (xen_xc, xen_domid, &state->ioservid); state->exit.notify = xen_exit_notifier;qemu_add_exit_notifier(&state->exit);
Quoted 2 lines
--
2.1.4
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 20 lines
-----Original Message-----
From: Paul Durrant [mailto:[email protected]]
Sent: 01 August 2016 10:16
To: [email protected]; [email protected]
Cc: Paul Durrant; Stefano Stabellini; Anthony Perard
Subject: [PATCH] xen: handle inbound migration of VMs without ioreq server pagesVMs created on older versions on Xen will not have been provisioned with pages to support creation of non-default ioreq servers. In this case the ioreq server API is not supported and QEMU's only option is to fall back to using the default ioreq server pages as it did prior to commit
3996e85c("Xen: Use the ioreq-server API when available").This patch therefore changes the code in
xen_common.hto stop considering a failure ofxc_hvm_create_ioreq_server()as a hard failure but simply as an indication that the guest is too old to support the ioreq server API. Instead a boolean is set to cause reversion to old behaviour such that the default ioreq server is then used.
Quoted 3 lines
Signed-off-by Paul Durrant <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>
Apologies, this should also be
Quoted 293 lines
--- include/hw/xen/xen_common.h | 123 +++++++++++++++++++++++++++++++------------- trace-events | 1 + xen-hvm.c | 6 +-- 3 files changed, 90 insertions(+), 40 deletions(-)include/hw/xen/xen_common.h +36
-0@@ -107,6 +107,42 @@ static inline int xen_get_vmport_regs_pfn(xc_interface *xc, domid_t dom, #endif +static inline int xen_get_default_ioreq_server_info(xc_interface *xc, domid_t dom, + xen_pfn_t *ioreq_pfn, + xen_pfn_t *bufioreq_pfn, + evtchn_port_t *bufioreq_evtchn) +{ +unsigned long param; +int rc; + + rc =xc_get_hvm_param (xc, dom,HVM_PARAM_IOREQ_PFN , ¶m); +if (rc <0 ) { +fprintf (stderr,"failed to get HVM_PARAM_IOREQ_PFN\n" ); +return -1 ; + } + + *ioreq_pfn = param; + + rc =xc_get_hvm_param (xc, dom,HVM_PARAM_BUFIOREQ_PFN , ¶m); +if (rc <0 ) { +fprintf (stderr,"failed to get HVM_PARAM_BUFIOREQ_PFN\n" ); +return -1 ; + } + + *bufioreq_pfn = param; + + rc =xc_get_hvm_param (xc, dom,HVM_PARAM_BUFIOREQ_EVTCHN , + ¶m); +if (rc <0 ) { +fprintf (stderr,"failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n" ); +return -1 ; + } + + *bufioreq_evtchn = param; + +return 0 ; +} +/* Xen before 4.5 */
#ifCONFIG_XEN_CTRL_INTERFACE_VERSION< 450include/hw/xen/xen_common.h +2
-3@@ -154,10 +190,9 @@ static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom, { } -static inline int xen_create_ioreq_server (xc_interface *xc,domid_t dom, -ioservid_t *ioservid) +static inline void xen_create_ioreq_server (xc_interface *xc,domid_t dom, +ioservid_t *ioservid) { -return 0 ; }static inline void xen_destroy_ioreq_server(xc_interface *xc,
domid_tdom,include/hw/xen/xen_common.h +2
-29@@ -171,35 +206,8 @@ static inline int xen_get_ioreq_server_info(xc_interface *xc, domid_t dom, xen_pfn_t *bufioreq_pfn, evtchn_port_t *bufioreq_evtchn) { -unsigned long param; -int rc; - - rc =xc_get_hvm_param (xc, dom,HVM_PARAM_IOREQ_PFN , ¶m); -if (rc <0 ) { -fprintf (stderr,"failed to get HVM_PARAM_IOREQ_PFN\n" ); -return -1 ; - } - - *ioreq_pfn = param; - - rc =xc_get_hvm_param (xc, dom,HVM_PARAM_BUFIOREQ_PFN , ¶m); -if (rc <0 ) { -fprintf (stderr,"failed to get HVM_PARAM_BUFIOREQ_PFN\n" ); -return -1 ; - } - - *bufioreq_pfn = param; - - rc =xc_get_hvm_param (xc, dom,HVM_PARAM_BUFIOREQ_EVTCHN , - ¶m); -if (rc <0 ) { -fprintf (stderr,"failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n" ); -return -1 ; - } - - *bufioreq_evtchn = param; - -return 0 ; +return xen_get_default_ioreq_server_info (xc, dom, ioreq_pfn, bufioreq_pfn, + bufioreq_evtchn);}
static inline int xen_set_ioreq_server_state(xc_interface *xc,
domid_tdom,include/hw/xen/xen_common.h +2
-0@@ -212,6 +220,8 @@ static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom,/* Xen 4.5 */ #else +static bool use_default_ioreq_server; + static inline void xen_map_memory_section(xc_interface *xc, domid_t dom,
ioservid_tioservid, MemoryRegionSection *section)include/hw/xen/xen_common.h +4
-0@@ -220,6 +230,10 @@ static inline void xen_map_memory_section(xc_interface *xc, domid_t dom, ram_addr_t size = int128_get64(section->size);hwaddr end_addr = start_addr + size -1 ; +if (use_default_ioreq_server) { +return ; + } +trace_xen_map_mmio_range (ioservid, start_addr, end_addr); xc_hvm_map_io_range_to_ioreq_server(xc, dom, ioservid, 1,start_addr, end_addr);include/hw/xen/xen_common.h +5
-0@@ -233,6 +247,11 @@ static inline void xen_unmap_memory_section(xc_interface *xc, domid_t dom, ram_addr_t size = int128_get64(section->size);hwaddr end_addr = start_addr + size -1 ; +if (use_default_ioreq_server) { +return ; + } + +trace_xen_unmap_mmio_range (ioservid, start_addr, end_addr); xc_hvm_unmap_io_range_from_ioreq_server(xc, dom, ioservid, 1,start_addr, end_addr);include/hw/xen/xen_common.h +5
-0@@ -246,6 +265,11 @@ static inline void xen_map_io_section(xc_interface *xc, domid_t dom, ram_addr_t size = int128_get64(section->size);hwaddr end_addr = start_addr + size -1 ; +if (use_default_ioreq_server) { +return ; + } + +trace_xen_map_portio_range (ioservid, start_addr, end_addr); xc_hvm_map_io_range_to_ioreq_server(xc, dom, ioservid, 0,start_addr, end_addr);include/hw/xen/xen_common.h +4
-0@@ -259,6 +283,10 @@ static inline void xen_unmap_io_section(xc_interface *xc, domid_t dom, ram_addr_t size = int128_get64(section->size);hwaddr end_addr = start_addr + size -1 ; +if (use_default_ioreq_server) { +return ; + } +trace_xen_unmap_portio_range (ioservid, start_addr, end_addr); xc_hvm_unmap_io_range_from_ioreq_server(xc, dom, ioservid, 0,start_addr, end_addr);include/hw/xen/xen_common.h +4
-0@@ -268,6 +296,10 @@ static inline void xen_map_pcidev(xc_interface *xc,domid_t dom, ioservid_t ioservid, PCIDevice *pci_dev) { + if (use_default_ioreq_server) { + return; + } +trace_xen_map_pcidev (ioservid,pci_bus_num (pci_dev->bus),PCI_SLOT (pci_dev->devfn),PCI_FUNC (pci_dev->devfn));xc_hvm_map_pcidev_to_ioreq_server(xc, dom, ioservid,
include/hw/xen/xen_common.h +4
-0@@ -280,6 +312,10 @@ static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom, ioservid_t ioservid, PCIDevice *pci_dev) { +if (use_default_ioreq_server) { +return ; + } +trace_xen_unmap_pcidev (ioservid,pci_bus_num (pci_dev->bus),PCI_SLOT (pci_dev->devfn),PCI_FUNC (pci_dev->devfn));xc_hvm_unmap_pcidev_from_ioreq_server(xc, dom, ioservid,
include/hw/xen/xen_common.h +10
-3@@ -288,22 +324,29 @@ static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom, PCI_FUNC(pci_dev->devfn)); } -static inline int xen_create_ioreq_server (xc_interface *xc,domid_t dom, -ioservid_t *ioservid) +static inline void xen_create_ioreq_server (xc_interface *xc,domid_t dom, +ioservid_t *ioservid) {int rc =xc_hvm_create_ioreq_server (xc, dom,HVM_IOREQSRV_BUFIOREQ_ATOMIC , ioservid);if (rc ==0 ) {trace_xen_ioreq_server_create (*ioservid); +return ; } -return rc; + *ioservid =0 ; + use_default_ioreq_server = true; +trace_xen_default_ioreq_server (); }static inline void xen_destroy_ioreq_server (xc_interface *xc,domid_t dom,ioservid_t ioservid) { +if (use_default_ioreq_server) { +return ; + } +trace_xen_ioreq_server_destroy (ioservid);xc_hvm_destroy_ioreq_server(xc, dom, ioservid);}
include/hw/xen/xen_common.h +6
-0@@ -314,6 +357,12 @@ static inline int xen_get_ioreq_server_info(xc_interface *xc, domid_t dom, xen_pfn_t *bufioreq_pfn, evtchn_port_t *bufioreq_evtchn) { +if (use_default_ioreq_server) { +return xen_get_default_ioreq_server_info (xc, dom, ioreq_pfn, + bufioreq_pfn, + bufioreq_evtchn); + } + return xc_hvm_get_ioreq_server_info(xc, dom, ioservid, ioreq_pfn, bufioreq_pfn,bufioreq_evtchn);include/hw/xen/xen_common.h +4
-0@@ -323,6 +372,10 @@ static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom, ioservid_t ioservid, bool enable) { +if (use_default_ioreq_server) { +return 0 ; + } +trace_xen_ioreq_server_state (ioservid, enable);return xc_hvm_set_ioreq_server_state (xc, dom, ioservid, enable);}
trace-events +0
-0@@ -60,6 +60,7 @@ spice_vmc_event(int event) "spice vmc event %d" # xen-hvm.c xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested:%#lx, size %#lx"
xen_client_set_memory(uint64_tstart_addr, unsigned long size, boollog_dirty) "%#"PRIx64" size %#lx,log_dirty%i"trace-events +1
-0+xen_default_ioreq_server(void) "" xen_ioreq_server_create(uint32_t id) "id: %u" xen_ioreq_server_destroy(uint32_t id) "id: %u" xen_ioreq_server_state(uint32_t id, bool enable) "id: %u: enable: %i"xen-hvm.c +1
-5@@ -1203,11 +1203,7 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory) goto err; } - rc =xen_create_ioreq_server (xen_xc, xen_domid, &state->ioservid); -if (rc <0 ) { -perror ("xen: ioreq server create" ); - goto err; - } +xen_create_ioreq_server (xen_xc, xen_domid, &state->ioservid); state->exit.notify = xen_exit_notifier;qemu_add_exit_notifier(&state->exit);--
2.1.4
Quoted 12 lines · Paul Durrant
VMs created on older versions on Xen will not have been provisioned with pages to support creation of non-default ioreq servers. In this case the ioreq server API is not supported and QEMU's only option is to fall back to using the default ioreq server pages as it did prior to commit
3996e85c("Xen: Use the ioreq-server API when available").This patch therefore changes the code in
xen_common.hto stop considering a failure ofxc_hvm_create_ioreq_server()as a hard failure but simply as an indication that the guest is too old to support the ioreq server API. Instead a boolean is set to cause reversion to old behaviour such that the default ioreq server is then used.
Quoted 3 lines
Signed-off-by Paul Durrant <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>
There are just two lines too long:
WARNING: line over 80 characters
#31: FILE: include/hw/xen/xen_common.h:110:
+static inline int xen_get_default_ioreq_server_info(xc_interface *xc, domid_t dom,
WARNING: line over 80 characters
#34: FILE: include/hw/xen/xen_common.h:113:
+ evtchn_port_t *bufioreq_evtchn)
With that fixed: Acked-by: Anthony PERARD <[email protected]>
Thanks,
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 12 lines · Paul Durrant
VMs created on older versions on Xen will not have been provisioned with pages to support creation of non-default ioreq servers. In this case the ioreq server API is not supported and QEMU's only option is to fall back to using the default ioreq server pages as it did prior to commit
3996e85c("Xen: Use the ioreq-server API when available").This patch therefore changes the code in
xen_common.hto stop considering a failure ofxc_hvm_create_ioreq_server()as a hard failure but simply as an indication that the guest is too old to support the ioreq server API. Instead a boolean is set to cause reversion to old behaviour such that the default ioreq server is then used.
Quoted 3 lines
Signed-off-by Paul Durrant <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>
There are just two lines too long:
WARNING: line over 80 characters
#31: FILE: include/hw/xen/xen_common.h:110:
+static inline int xen_get_default_ioreq_server_info(xc_interface *xc, domid_t dom,
WARNING: line over 80 characters
#34: FILE: include/hw/xen/xen_common.h:113:
+ evtchn_port_t *bufioreq_evtchn)
With that fixed: Acked-by: Anthony PERARD <[email protected]>
Thanks,
Signature · 1 line
Anthony PERARD
Quoted 34 lines
-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: 09 August 2016 16:19
To: Paul Durrant
Cc: [email protected]; [email protected]; Stefano Stabellini
Subject: Re: [PATCH] xen: handle inbound migration of VMs without ioreq server pagesQuoted 7 lines · Paul Durrant
VMs created on older versions on Xen will not have been provisioned with pages to support creation of non-default ioreq servers. In this case the ioreq server API is not supported and QEMU's only option is to fall back to using the default ioreq server pages as it did prior to commit
3996e85c("Xen: Use the ioreq-server API when available").This patch therefore changes the code in
xen_common.hto stopconsidering
Quoted 8 lines
a failure of
xc_hvm_create_ioreq_server()as a hard failure but simply as an indication that the guest is too old to support the ioreq server API. Instead a boolean is set to cause reversion to old behaviour such that the default ioreq server is then used.Signed-off-by Paul Durrant <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>There are just two lines too long:
WARNING: line over 80 characters
#31: FILE:include/hw/xen/xen_common.h:110:
+static inline int xen_get_default_ioreq_server_info(xc_interface *xc,domid_tdom,
Quoted 8 lines
WARNING: line over 80 characters
#34: FILE:include/hw/xen/xen_common.h:113:
+evtchn_port_t*bufioreq_evtchn)With that fixed: Acked-by: Anthony PERARD <[email protected]>
Thanks,
Ok, I'll post v2 with those fixes and your ack. Thanks,
Paul
Quoted 2 lines
--
Anthony PERARD
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 34 lines
-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: 09 August 2016 16:19
To: Paul Durrant
Cc: [email protected]; [email protected]; Stefano Stabellini
Subject: Re: [PATCH] xen: handle inbound migration of VMs without ioreq server pagesQuoted 7 lines · Paul Durrant
VMs created on older versions on Xen will not have been provisioned with pages to support creation of non-default ioreq servers. In this case the ioreq server API is not supported and QEMU's only option is to fall back to using the default ioreq server pages as it did prior to commit
3996e85c("Xen: Use the ioreq-server API when available").This patch therefore changes the code in
xen_common.hto stopconsidering
Quoted 8 lines
a failure of
xc_hvm_create_ioreq_server()as a hard failure but simply as an indication that the guest is too old to support the ioreq server API. Instead a boolean is set to cause reversion to old behaviour such that the default ioreq server is then used.Signed-off-by Paul Durrant <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>There are just two lines too long:
WARNING: line over 80 characters
#31: FILE:include/hw/xen/xen_common.h:110:
+static inline int xen_get_default_ioreq_server_info(xc_interface *xc,domid_tdom,
Quoted 8 lines
WARNING: line over 80 characters
#34: FILE:include/hw/xen/xen_common.h:113:
+evtchn_port_t*bufioreq_evtchn)With that fixed: Acked-by: Anthony PERARD <[email protected]>
Thanks,
Ok, I'll post v2 with those fixes and your ack. Thanks,
Paul
Quoted 2 lines
--
Anthony PERARD
Quoted 38 lines · Paul Durrant
Quoted 38 lines
-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: 09 August 2016 16:19
To: Paul Durrant
Cc: [email protected]; [email protected]; Stefano Stabellini
Subject: Re: [PATCH] xen: handle inbound migration of VMs without ioreq server pagesQuoted 7 lines · Paul Durrant
VMs created on older versions on Xen will not have been provisioned with pages to support creation of non-default ioreq servers. In this case the ioreq server API is not supported and QEMU's only option is to fall back to using the default ioreq server pages as it did prior to commit
3996e85c("Xen: Use the ioreq-server API when available").This patch therefore changes the code in
xen_common.hto stopconsidering
Quoted 8 lines
a failure of
xc_hvm_create_ioreq_server()as a hard failure but simply as an indication that the guest is too old to support the ioreq server API. Instead a boolean is set to cause reversion to old behaviour such that the default ioreq server is then used.Signed-off-by Paul Durrant <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>There are just two lines too long:
WARNING: line over 80 characters
#31: FILE:include/hw/xen/xen_common.h:110:
+static inline int xen_get_default_ioreq_server_info(xc_interface *xc,domid_tdom,WARNING: line over 80 characters
#34: FILE:include/hw/xen/xen_common.h:113:
+evtchn_port_t*bufioreq_evtchn)
Quoted 6 lines
Quoted 4 lines
With that fixed: Acked-by: Anthony PERARD <[email protected]>
Thanks,
Ok, I'll post v2 with those fixes and your ack. Thanks,
Thank you for fixing this bug and Thanks Anthony for the review.
I was about to commit it but my sense of style rebelled: I really don't like all the if statements. Too many! Sorry for coming in so late in commenting on a patch, I realize that it is unfair.
Would you be up for rewriting the fix so that instead of introducing
if (use_default_ioreq_server) {
return;
}in many functions, we turn xc_hvm_* calls into function pointers calls that get set to the right behavior depending on the success of xc_hvm_create_ioreq_server?
The call sites would be something like:
ioreq_server->unmap_io_range_from_ioreq_server(xc, dom, ioservid, 0,
start_addr, end_addr);At boot time, if xc_hvm_create_ioreq_server returns error:
ioreq_server = empty_stubs_functions;
else
ioreq_server = useful_functions;
What do you guys think?
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 38 lines · Paul Durrant
Quoted 38 lines
-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: 09 August 2016 16:19
To: Paul Durrant
Cc: [email protected]; [email protected]; Stefano Stabellini
Subject: Re: [PATCH] xen: handle inbound migration of VMs without ioreq server pagesQuoted 7 lines · Paul Durrant
VMs created on older versions on Xen will not have been provisioned with pages to support creation of non-default ioreq servers. In this case the ioreq server API is not supported and QEMU's only option is to fall back to using the default ioreq server pages as it did prior to commit
3996e85c("Xen: Use the ioreq-server API when available").This patch therefore changes the code in
xen_common.hto stopconsidering
Quoted 8 lines
a failure of
xc_hvm_create_ioreq_server()as a hard failure but simply as an indication that the guest is too old to support the ioreq server API. Instead a boolean is set to cause reversion to old behaviour such that the default ioreq server is then used.Signed-off-by Paul Durrant <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>There are just two lines too long:
WARNING: line over 80 characters
#31: FILE:include/hw/xen/xen_common.h:110:
+static inline int xen_get_default_ioreq_server_info(xc_interface *xc,domid_tdom,WARNING: line over 80 characters
#34: FILE:include/hw/xen/xen_common.h:113:
+evtchn_port_t*bufioreq_evtchn)
Quoted 6 lines
Quoted 4 lines
With that fixed: Acked-by: Anthony PERARD <[email protected]>
Thanks,
Ok, I'll post v2 with those fixes and your ack. Thanks,
Thank you for fixing this bug and Thanks Anthony for the review.
I was about to commit it but my sense of style rebelled: I really don't like all the if statements. Too many! Sorry for coming in so late in commenting on a patch, I realize that it is unfair.
Would you be up for rewriting the fix so that instead of introducing
if (use_default_ioreq_server) {
return;
}in many functions, we turn xc_hvm_* calls into function pointers calls that get set to the right behavior depending on the success of xc_hvm_create_ioreq_server?
The call sites would be something like:
ioreq_server->unmap_io_range_from_ioreq_server(xc, dom, ioservid, 0,
start_addr, end_addr);At boot time, if xc_hvm_create_ioreq_server returns error:
ioreq_server = empty_stubs_functions;
else
ioreq_server = useful_functions;
What do you guys think?
Quoted 82 lines
-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: 11 August 2016 21:07
To: Paul Durrant
Cc: Anthony Perard; [email protected]; qemu- [email protected]; Stefano Stabellini
Subject: RE: [PATCH] xen: handle inbound migration of VMs without ioreq server pagesQuoted 7 lines · Paul Durrant
Quoted 7 lines
-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: 09 August 2016 16:19
To: Paul Durrant
Cc: [email protected]; [email protected]; Stefano Stabellini
Subject: Re: [PATCH] xen: handle inbound migration of VMs withoutioreq
Quoted 4 lines
Quoted 4 lines
server pages
Quoted 1 line · Paul Durrant
VMs created on older versions on Xen will not have been provisioned
with
Quoted 23 lines
Quoted 23 lines
Quoted 6 lines
pages to support creation of non-default ioreq servers. In this case the ioreq server API is not supported and QEMU's only option is to fall back to using the default ioreq server pages as it did prior to commit
3996e85c("Xen: Use the ioreq-server API when available").This patch therefore changes the code in
xen_common.hto stopconsidering
Quoted 8 lines
a failure of
xc_hvm_create_ioreq_server()as a hard failure but simply as an indication that the guest is too old to support the ioreq server API. Instead a boolean is set to cause reversion to old behaviour such that the default ioreq server is then used.Signed-off-by Paul Durrant <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>There are just two lines too long:
WARNING: line over 80 characters
#31: FILE:include/hw/xen/xen_common.h:110:
+static inline int xen_get_default_ioreq_server_info(xc_interface *xc,domid_tdom,Quoted 5 lines
Quoted 5 lines
WARNING: line over 80 characters
#34: FILE:include/hw/xen/xen_common.h:113:
+evtchn_port_t*bufioreq_evtchn)With that fixed: Acked-by: Anthony PERARD
Quoted 5 lines
Quoted 3 lines
Thanks,
Ok, I'll post v2 with those fixes and your ack. Thanks,
Thank you for fixing this bug and Thanks Anthony for the review.
I was about to commit it but my sense of style rebelled: I really don't like all the if statements. Too many! Sorry for coming in so late in commenting on a patch, I realize that it is unfair.
Would you be up for rewriting the fix so that instead of introducing
if (use_default_ioreq_server) { return; }in many functions, we turn xc_hvm_* calls into function pointers calls that get set to the right behavior depending on the success of
xc_hvm_create_ioreq_server?The call sites would be something like:
ioreq_server->unmap_io_range_from_ioreq_server(xc, dom, ioservid, 0, start_addr, end_addr);At boot time, if
xc_hvm_create_ioreq_serverreturns error:
Quoted 8 lines
ioreq_server = empty_stubs_functions;else
ioreq_server = useful_functions;What do you guys think?
Personally I don't think it's worth it. This is not a performance critical codepath but if you insist I will re-factor the code.
Paul
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 84 lines · Paul Durrant
Quoted 84 lines
-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: 11 August 2016 21:07
To: Paul Durrant
Cc: Anthony Perard; [email protected]; qemu- [email protected]; Stefano Stabellini
Subject: RE: [PATCH] xen: handle inbound migration of VMs without ioreq server pagesQuoted 7 lines · Paul Durrant
Quoted 7 lines
-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: 09 August 2016 16:19
To: Paul Durrant
Cc: [email protected]; [email protected]; Stefano Stabellini
Subject: Re: [PATCH] xen: handle inbound migration of VMs withoutioreq
Quoted 4 lines
Quoted 4 lines
server pages
Quoted 1 line · Paul Durrant
VMs created on older versions on Xen will not have been provisioned
with
Quoted 23 lines
Quoted 23 lines
Quoted 6 lines
pages to support creation of non-default ioreq servers. In this case the ioreq server API is not supported and QEMU's only option is to fall back to using the default ioreq server pages as it did prior to commit
3996e85c("Xen: Use the ioreq-server API when available").This patch therefore changes the code in
xen_common.hto stopconsidering
Quoted 8 lines
a failure of
xc_hvm_create_ioreq_server()as a hard failure but simply as an indication that the guest is too old to support the ioreq server API. Instead a boolean is set to cause reversion to old behaviour such that the default ioreq server is then used.Signed-off-by Paul Durrant <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>There are just two lines too long:
WARNING: line over 80 characters
#31: FILE:include/hw/xen/xen_common.h:110:
+static inline int xen_get_default_ioreq_server_info(xc_interface *xc,domid_tdom,Quoted 5 lines
Quoted 5 lines
WARNING: line over 80 characters
#34: FILE:include/hw/xen/xen_common.h:113:
+evtchn_port_t*bufioreq_evtchn)With that fixed: Acked-by: Anthony PERARD
Quoted 5 lines
Quoted 3 lines
Thanks,
Ok, I'll post v2 with those fixes and your ack. Thanks,
Thank you for fixing this bug and Thanks Anthony for the review.
I was about to commit it but my sense of style rebelled: I really don't like all the if statements. Too many! Sorry for coming in so late in commenting on a patch, I realize that it is unfair.
Would you be up for rewriting the fix so that instead of introducing
if (use_default_ioreq_server) { return; }in many functions, we turn xc_hvm_* calls into function pointers calls that get set to the right behavior depending on the success of
xc_hvm_create_ioreq_server?The call sites would be something like:
ioreq_server->unmap_io_range_from_ioreq_server(xc, dom, ioservid, 0, start_addr, end_addr);At boot time, if
xc_hvm_create_ioreq_serverreturns error:ioreq_server = empty_stubs_functions;
Quoted 8 lines
Quoted 6 lines
else
ioreq_server = useful_functions;What do you guys think?
Personally I don't think it's worth it. This is not a performance critical codepath but if you insist I will re-factor the code.
All right, given that Anthony already acked it, it's two vs. one. I'll commit it as is.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 84 lines · Paul Durrant
Quoted 84 lines
-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: 11 August 2016 21:07
To: Paul Durrant
Cc: Anthony Perard; [email protected]; qemu- [email protected]; Stefano Stabellini
Subject: RE: [PATCH] xen: handle inbound migration of VMs without ioreq server pagesQuoted 7 lines · Paul Durrant
Quoted 7 lines
-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: 09 August 2016 16:19
To: Paul Durrant
Cc: [email protected]; [email protected]; Stefano Stabellini
Subject: Re: [PATCH] xen: handle inbound migration of VMs withoutioreq
Quoted 4 lines
Quoted 4 lines
server pages
Quoted 1 line · Paul Durrant
VMs created on older versions on Xen will not have been provisioned
with
Quoted 23 lines
Quoted 23 lines
Quoted 6 lines
pages to support creation of non-default ioreq servers. In this case the ioreq server API is not supported and QEMU's only option is to fall back to using the default ioreq server pages as it did prior to commit
3996e85c("Xen: Use the ioreq-server API when available").This patch therefore changes the code in
xen_common.hto stopconsidering
Quoted 8 lines
a failure of
xc_hvm_create_ioreq_server()as a hard failure but simply as an indication that the guest is too old to support the ioreq server API. Instead a boolean is set to cause reversion to old behaviour such that the default ioreq server is then used.Signed-off-by Paul Durrant <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>There are just two lines too long:
WARNING: line over 80 characters
#31: FILE:include/hw/xen/xen_common.h:110:
+static inline int xen_get_default_ioreq_server_info(xc_interface *xc,domid_tdom,Quoted 5 lines
Quoted 5 lines
WARNING: line over 80 characters
#34: FILE:include/hw/xen/xen_common.h:113:
+evtchn_port_t*bufioreq_evtchn)With that fixed: Acked-by: Anthony PERARD
Quoted 5 lines
Quoted 3 lines
Thanks,
Ok, I'll post v2 with those fixes and your ack. Thanks,
Thank you for fixing this bug and Thanks Anthony for the review.
I was about to commit it but my sense of style rebelled: I really don't like all the if statements. Too many! Sorry for coming in so late in commenting on a patch, I realize that it is unfair.
Would you be up for rewriting the fix so that instead of introducing
if (use_default_ioreq_server) { return; }in many functions, we turn xc_hvm_* calls into function pointers calls that get set to the right behavior depending on the success of
xc_hvm_create_ioreq_server?The call sites would be something like:
ioreq_server->unmap_io_range_from_ioreq_server(xc, dom, ioservid, 0, start_addr, end_addr);At boot time, if
xc_hvm_create_ioreq_serverreturns error:ioreq_server = empty_stubs_functions;
Quoted 8 lines
Quoted 6 lines
else
ioreq_server = useful_functions;What do you guys think?
Personally I don't think it's worth it. This is not a performance critical codepath but if you insist I will re-factor the code.
All right, given that Anthony already acked it, it's two vs. one. I'll commit it as is.