direct-io.hg

changeset 7786:20bd6f55b813

Clean up xenstore/console shared page initialisation, which is
now handled solely by the domain builder.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Nov 14 11:36:42 2005 +0100 (2005-11-14)
parents 8ee7df2c18d1
children 3842ebd7d480
files linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c tools/libxc/xc_linux_build.c tools/libxc/xc_linux_restore.c tools/libxc/xc_private.c tools/libxc/xc_vmx_build.c tools/libxc/xenctrl.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c	Mon Nov 14 11:35:50 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c	Mon Nov 14 11:36:42 2005 +0100
     1.3 @@ -30,6 +30,12 @@ static inline struct xencons_interface *
     1.4  	return mfn_to_virt(xen_start_info->console_mfn);
     1.5  }
     1.6  
     1.7 +static inline void notify_daemon(void)
     1.8 +{
     1.9 +	/* Use evtchn: this is called early, before irq is set up. */
    1.10 +	notify_remote_via_evtchn(xen_start_info->console_evtchn);
    1.11 +}
    1.12 +
    1.13  int xencons_ring_send(const char *data, unsigned len)
    1.14  {
    1.15  	int sent = 0;
    1.16 @@ -47,8 +53,7 @@ int xencons_ring_send(const char *data, 
    1.17  	wmb();
    1.18  	intf->out_prod = prod;
    1.19  
    1.20 -	/* Use evtchn: this is called early, before irq is set up. */
    1.21 -	notify_remote_via_evtchn(xen_start_info->console_evtchn);
    1.22 +	notify_daemon();
    1.23  
    1.24  	return sent;
    1.25  }	
    1.26 @@ -70,9 +75,11 @@ static irqreturn_t handle_input(int irq,
    1.27  				1, regs);
    1.28  	}
    1.29  
    1.30 -	wmb();
    1.31 +	mb();
    1.32  	intf->in_cons = cons;
    1.33  
    1.34 +	notify_daemon();
    1.35 +
    1.36  	return IRQ_HANDLED;
    1.37  }
    1.38  
    1.39 @@ -102,6 +109,9 @@ int xencons_ring_init(void)
    1.40  
    1.41  	xencons_irq = err;
    1.42  
    1.43 +	/* In case we have in-flight data after save/restore... */
    1.44 +	notify_daemon();
    1.45 +
    1.46  	return 0;
    1.47  }
    1.48  
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c	Mon Nov 14 11:35:50 2005 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c	Mon Nov 14 11:36:42 2005 +0100
     2.3 @@ -36,7 +36,7 @@
     2.4  #include <asm-xen/xenbus.h>
     2.5  #include "xenbus_comms.h"
     2.6  
     2.7 -static int xenbus_irq      = 0;
     2.8 +static int xenbus_irq;
     2.9  
    2.10  extern void xenbus_probe(void *); 
    2.11  extern int xenstored_ready; 
    2.12 @@ -51,7 +51,7 @@ static inline struct xenstore_domain_int
    2.13  
    2.14  static irqreturn_t wake_waiting(int irq, void *unused, struct pt_regs *regs)
    2.15  {
    2.16 -	if(unlikely(xenstored_ready == 0)) {
    2.17 +	if (unlikely(xenstored_ready == 0)) {
    2.18  		xenstored_ready = 1; 
    2.19  		schedule_work(&probe_work); 
    2.20  	} 
    2.21 @@ -189,9 +189,6 @@ int xb_init_comms(void)
    2.22  
    2.23  	xenbus_irq = err;
    2.24  
    2.25 -	/* FIXME zero out page -- domain builder should probably do this*/
    2.26 -	memset(mfn_to_virt(xen_start_info->store_mfn), 0, PAGE_SIZE);
    2.27 -
    2.28  	return 0;
    2.29  }
    2.30  
     3.1 --- a/tools/libxc/xc_linux_build.c	Mon Nov 14 11:35:50 2005 +0100
     3.2 +++ b/tools/libxc/xc_linux_build.c	Mon Nov 14 11:36:42 2005 +0100
     3.3 @@ -619,7 +619,9 @@ static int setup_guest(int xc_handle,
     3.4  
     3.5      *store_mfn = page_array[(vstoreinfo_start-dsi.v_start) >> PAGE_SHIFT];
     3.6      *console_mfn = page_array[(vconsole_start-dsi.v_start) >> PAGE_SHIFT];
     3.7 -
     3.8 +    if ( xc_clear_domain_page(xc_handle, dom, *store_mfn) ||
     3.9 +         xc_clear_domain_page(xc_handle, dom, *console_mfn) )
    3.10 +        goto error_out;
    3.11  
    3.12      start_info = xc_map_foreign_range(
    3.13          xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE,
     4.1 --- a/tools/libxc/xc_linux_restore.c	Mon Nov 14 11:35:50 2005 +0100
     4.2 +++ b/tools/libxc/xc_linux_restore.c	Mon Nov 14 11:36:42 2005 +0100
     4.3 @@ -12,8 +12,6 @@
     4.4  #include "xg_private.h"
     4.5  #include "xg_save_restore.h"
     4.6  
     4.7 -
     4.8 -
     4.9  /* max mfn of the whole machine */
    4.10  static uint32_t max_mfn; 
    4.11  
     5.1 --- a/tools/libxc/xc_private.c	Mon Nov 14 11:35:50 2005 +0100
     5.2 +++ b/tools/libxc/xc_private.c	Mon Nov 14 11:36:42 2005 +0100
     5.3 @@ -336,6 +336,19 @@ int xc_copy_to_domain_page(int xc_handle
     5.4      return 0;
     5.5  }
     5.6  
     5.7 +int xc_clear_domain_page(int xc_handle,
     5.8 +                         uint32_t domid,
     5.9 +                         unsigned long dst_pfn)
    5.10 +{
    5.11 +    void *vaddr = xc_map_foreign_range(
    5.12 +        xc_handle, domid, PAGE_SIZE, PROT_WRITE, dst_pfn);
    5.13 +    if ( vaddr == NULL )
    5.14 +        return -1;
    5.15 +    memset(vaddr, 0, PAGE_SIZE);
    5.16 +    munmap(vaddr, PAGE_SIZE);
    5.17 +    return 0;
    5.18 +}
    5.19 +
    5.20  unsigned long xc_get_filesz(int fd)
    5.21  {
    5.22      uint16_t sig;
     6.1 --- a/tools/libxc/xc_vmx_build.c	Mon Nov 14 11:35:50 2005 +0100
     6.2 +++ b/tools/libxc/xc_vmx_build.c	Mon Nov 14 11:36:42 2005 +0100
     6.3 @@ -495,6 +495,9 @@ static int setup_guest(int xc_handle,
     6.4      }
     6.5  
     6.6      *store_mfn = page_array[(v_end-2) >> PAGE_SHIFT];
     6.7 +    if ( xc_clear_domain_page(xc_handle, dom, *store_mfn) )
     6.8 +        goto error_out;
     6.9 +
    6.10      shared_page_frame = (v_end - PAGE_SIZE) >> PAGE_SHIFT;
    6.11  
    6.12      if ((e820_page = xc_map_foreign_range(
     7.1 --- a/tools/libxc/xenctrl.h	Mon Nov 14 11:35:50 2005 +0100
     7.2 +++ b/tools/libxc/xenctrl.h	Mon Nov 14 11:36:42 2005 +0100
     7.3 @@ -424,6 +424,9 @@ int xc_ia64_get_pfn_list(int xc_handle, 
     7.4  int xc_copy_to_domain_page(int xc_handle, uint32_t domid,
     7.5  			   unsigned long dst_pfn, void *src_page);
     7.6  
     7.7 +int xc_clear_domain_page(int xc_handle, uint32_t domid,
     7.8 +                         unsigned long dst_pfn);
     7.9 +
    7.10  int xc_ia64_copy_to_domain_pages(int xc_handle, uint32_t domid,
    7.11          void* src_page, unsigned long dst_pfn, int nr_pages);
    7.12