From e7b975b0b62724bea7160c59e6f73f54f6d3a37e Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Mon, 14 Nov 2005 11:05:34 +0100 Subject: If /sbin/ isn't in the path, udev rules will erroneously not get installed. Signed-off-by: Nivedita Singhvi --- install.sh | 2 +- linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c | 16 +++++++++++++--- linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c | 7 ++----- tools/check/check_hotplug | 2 +- tools/examples/Makefile | 2 +- tools/libxc/xc_linux_build.c | 4 +++- tools/libxc/xc_linux_restore.c | 2 -- tools/libxc/xc_private.c | 13 +++++++++++++ tools/libxc/xc_vmx_build.c | 3 +++ tools/libxc/xenctrl.h | 3 +++ 10 files changed, 40 insertions(+), 14 deletions(-) diff --git a/install.sh b/install.sh index 49e88a2556..46e22abe6c 100755 --- a/install.sh +++ b/install.sh @@ -27,7 +27,7 @@ echo "Installing Xen from '$src' to '$dst'..." cp -fdRL $src/etc/init.d/* $dst/etc/init.d/ echo "All done." -if [ -x /sbin/udev ] && [ ! -z `udev -V` ] && [ `/sbin/udev -V` -ge 059 ]; then +if [ -x /sbin/udev ] && [ ! -z `/sbin/udev -V` ] && [ `/sbin/udev -V` -ge 059 ]; then cp -f $src/etc/udev/rules.d/*.rules $dst/etc/udev/rules.d/ else cp -f $src/etc/hotplug/*.agent $dst/etc/hotplug/ diff --git a/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c b/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c index ccbcf5e7db..2d6eb044b6 100644 --- a/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c +++ b/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c @@ -30,6 +30,12 @@ static inline struct xencons_interface *xencons_interface(void) return mfn_to_virt(xen_start_info->console_mfn); } +static inline void notify_daemon(void) +{ + /* Use evtchn: this is called early, before irq is set up. */ + notify_remote_via_evtchn(xen_start_info->console_evtchn); +} + int xencons_ring_send(const char *data, unsigned len) { int sent = 0; @@ -47,8 +53,7 @@ int xencons_ring_send(const char *data, unsigned len) wmb(); intf->out_prod = prod; - /* Use evtchn: this is called early, before irq is set up. */ - notify_remote_via_evtchn(xen_start_info->console_evtchn); + notify_daemon(); return sent; } @@ -70,9 +75,11 @@ static irqreturn_t handle_input(int irq, void *unused, struct pt_regs *regs) 1, regs); } - wmb(); + mb(); intf->in_cons = cons; + notify_daemon(); + return IRQ_HANDLED; } @@ -102,6 +109,9 @@ int xencons_ring_init(void) xencons_irq = err; + /* In case we have in-flight data after save/restore... */ + notify_daemon(); + return 0; } diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c index 9e301a620f..82f656d462 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c @@ -36,7 +36,7 @@ #include #include "xenbus_comms.h" -static int xenbus_irq = 0; +static int xenbus_irq; extern void xenbus_probe(void *); extern int xenstored_ready; @@ -51,7 +51,7 @@ static inline struct xenstore_domain_interface *xenstore_domain_interface(void) static irqreturn_t wake_waiting(int irq, void *unused, struct pt_regs *regs) { - if(unlikely(xenstored_ready == 0)) { + if (unlikely(xenstored_ready == 0)) { xenstored_ready = 1; schedule_work(&probe_work); } @@ -189,9 +189,6 @@ int xb_init_comms(void) xenbus_irq = err; - /* FIXME zero out page -- domain builder should probably do this*/ - memset(mfn_to_virt(xen_start_info->store_mfn), 0, PAGE_SIZE); - return 0; } diff --git a/tools/check/check_hotplug b/tools/check/check_hotplug index df8a328096..61feb4c6a6 100644 --- a/tools/check/check_hotplug +++ b/tools/check/check_hotplug @@ -7,7 +7,7 @@ function error { exit 1 } -if [ -x /sbin/udev ] && [ ! -z `udev -V` ] && [ `udev -V` -ge 059 ]; then +if [ -x /sbin/udev ] && [ ! -z `/sbin/udev -V` ] && [ `/sbin/udev -V` -ge 059 ]; then exit 0 fi diff --git a/tools/examples/Makefile b/tools/examples/Makefile index 844a7f7330..39223bd41d 100644 --- a/tools/examples/Makefile +++ b/tools/examples/Makefile @@ -41,7 +41,7 @@ DE = $(shell readlink -f $(DESTDIR)) ifeq ($(findstring $(DI),$(DE)),$(DI)) HOTPLUGS=install-hotplug install-udev else -ifeq ($(shell [ -x /sbin/udev ] && [ ! -z `udev -V` ] && [ `/sbin/udev -V` -ge 059 ] && echo 1),1) +ifeq ($(shell [ -x /sbin/udev ] && [ ! -z `/sbin/udev -V` ] && [ `/sbin/udev -V` -ge 059 ] && echo 1),1) HOTPLUGS=install-udev else HOTPLUGS=install-hotplug diff --git a/tools/libxc/xc_linux_build.c b/tools/libxc/xc_linux_build.c index ff3ecf84f6..fc6fc9d904 100644 --- a/tools/libxc/xc_linux_build.c +++ b/tools/libxc/xc_linux_build.c @@ -619,7 +619,9 @@ static int setup_guest(int xc_handle, *store_mfn = page_array[(vstoreinfo_start-dsi.v_start) >> PAGE_SHIFT]; *console_mfn = page_array[(vconsole_start-dsi.v_start) >> PAGE_SHIFT]; - + if ( xc_clear_domain_page(xc_handle, dom, *store_mfn) || + xc_clear_domain_page(xc_handle, dom, *console_mfn) ) + goto error_out; start_info = xc_map_foreign_range( xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, diff --git a/tools/libxc/xc_linux_restore.c b/tools/libxc/xc_linux_restore.c index 9abd19a5c2..198628ab97 100644 --- a/tools/libxc/xc_linux_restore.c +++ b/tools/libxc/xc_linux_restore.c @@ -12,8 +12,6 @@ #include "xg_private.h" #include "xg_save_restore.h" - - /* max mfn of the whole machine */ static uint32_t max_mfn; diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c index 75e179a7c7..e5a9c566d5 100644 --- a/tools/libxc/xc_private.c +++ b/tools/libxc/xc_private.c @@ -336,6 +336,19 @@ int xc_copy_to_domain_page(int xc_handle, return 0; } +int xc_clear_domain_page(int xc_handle, + uint32_t domid, + unsigned long dst_pfn) +{ + void *vaddr = xc_map_foreign_range( + xc_handle, domid, PAGE_SIZE, PROT_WRITE, dst_pfn); + if ( vaddr == NULL ) + return -1; + memset(vaddr, 0, PAGE_SIZE); + munmap(vaddr, PAGE_SIZE); + return 0; +} + unsigned long xc_get_filesz(int fd) { uint16_t sig; diff --git a/tools/libxc/xc_vmx_build.c b/tools/libxc/xc_vmx_build.c index ea83366813..47cc1271cb 100644 --- a/tools/libxc/xc_vmx_build.c +++ b/tools/libxc/xc_vmx_build.c @@ -495,6 +495,9 @@ static int setup_guest(int xc_handle, } *store_mfn = page_array[(v_end-2) >> PAGE_SHIFT]; + if ( xc_clear_domain_page(xc_handle, dom, *store_mfn) ) + goto error_out; + shared_page_frame = (v_end - PAGE_SIZE) >> PAGE_SHIFT; if ((e820_page = xc_map_foreign_range( diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index 66f7eff875..8afd5b01b2 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -424,6 +424,9 @@ int xc_ia64_get_pfn_list(int xc_handle, uint32_t domid, int xc_copy_to_domain_page(int xc_handle, uint32_t domid, unsigned long dst_pfn, void *src_page); +int xc_clear_domain_page(int xc_handle, uint32_t domid, + unsigned long dst_pfn); + int xc_ia64_copy_to_domain_pages(int xc_handle, uint32_t domid, void* src_page, unsigned long dst_pfn, int nr_pages); -- cgit v1.2.3