Date: Wed, 20 Aug 2008 05:55:17 GMT From: Julian Elischer <julian@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 147887 for review Message-ID: <200808200555.m7K5tHPQ004338@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=147887 Change 147887 by julian@julian_trafmon1 on 2008/08/20 05:54:21 IFC@147886 to pick up a fix Affected files ... .. //depot/projects/vimage-commit3/src/sys/i386/i386/machdep.c#3 integrate .. //depot/projects/vimage-commit3/src/sys/net/if.c#7 integrate .. //depot/projects/vimage-commit3/src/sys/net/if_var.h#3 integrate .. //depot/projects/vimage-commit3/src/sys/xen/xenbus/xenbus_xs.c#3 integrate Differences ... ==== //depot/projects/vimage-commit3/src/sys/i386/i386/machdep.c#3 (text+ko) ==== @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/i386/machdep.c,v 1.672 2008/08/17 23:38:14 kmacy Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/machdep.c,v 1.673 2008/08/20 03:28:32 kmacy Exp $"); #include "opt_apic.h" #include "opt_atalk.h" @@ -1149,9 +1149,14 @@ HYPERVISOR_shutdown(SHUTDOWN_poweroff); } +int scheduler_running; + static void cpu_idle_hlt(int busy) { + + scheduler_running = 1; + enable_intr(); idle_block(); } @@ -1199,7 +1204,11 @@ return; } +#ifdef XEN +void (*cpu_idle_fn)(int) = cpu_idle_hlt; +#else void (*cpu_idle_fn)(int) = cpu_idle_acpi; +#endif void cpu_idle(int busy) ==== //depot/projects/vimage-commit3/src/sys/net/if.c#7 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)if.c 8.5 (Berkeley) 1/9/95 - * $FreeBSD: src/sys/net/if.c,v 1.283 2008/08/20 01:05:56 julian Exp $ + * $FreeBSD: src/sys/net/if.c,v 1.284 2008/08/20 05:00:18 thompsa Exp $ */ #include "opt_compat.h" @@ -177,7 +177,7 @@ return (ifp); } -void +static void ifnet_setbyindex(u_short idx, struct ifnet *ifp) { ==== //depot/projects/vimage-commit3/src/sys/net/if_var.h#3 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * From: @(#)if.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD: src/sys/net/if_var.h,v 1.119 2008/06/26 23:05:28 rwatson Exp $ + * $FreeBSD: src/sys/net/if_var.h,v 1.121 2008/08/20 05:00:18 thompsa Exp $ */ #ifndef _NET_IF_VAR_H_ @@ -646,6 +646,7 @@ }; struct ifnet *ifnet_byindex(u_short idx); + /* * Given the index, ifaddr_byindex() returns the one and only * link-level ifaddr for the interface. You are not supposed to use ==== //depot/projects/vimage-commit3/src/sys/xen/xenbus/xenbus_xs.c#3 (text+ko) ==== @@ -30,7 +30,7 @@ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/xen/xenbus/xenbus_xs.c,v 1.3 2008/08/20 02:42:08 kmacy Exp $"); +__FBSDID("$FreeBSD: src/sys/xen/xenbus/xenbus_xs.c,v 1.4 2008/08/20 03:27:12 kmacy Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -142,44 +142,67 @@ return xsd_errors[i].errnum; } -extern int scheduler_running; +extern void idle_block(void); +extern void kdb_backtrace(void); static void *read_reply(enum xsd_sockmsg_type *type, unsigned int *len) { struct xs_stored_msg *msg; char *body; - int i; - - if (scheduler_running == 0) { + int i, err; + enum xsd_sockmsg_type itype = *type; + + printf("read_reply "); + if (xenbus_running == 0) { /* * Give other domain time to run :-/ */ - for (i = 0; i < 100000; i++) + for (i = 0; i < 1000000 && (xenbus_running == 0); i++) { + err = xs_process_msg(type); + + if ((err == 0) + && (*type != XS_WATCH_EVENT)) + break; + HYPERVISOR_yield(); - xs_process_msg(); + } + + if (list_empty(&xs_state.reply_list)) { + printf("giving up and returning an error type=%d\n", + *type); + kdb_backtrace(); + return (ERR_PTR(-1)); + } + } - - spin_lock(&xs_state.reply_lock); - while (list_empty(&xs_state.reply_list)) { - spin_unlock(&xs_state.reply_lock); - wait_event_interruptible(&xs_state.reply_waitq, - !list_empty(&xs_state.reply_list)); - spin_lock(&xs_state.reply_lock); + mtx_lock(&xs_state.reply_lock); + if (xenbus_running) { + while (list_empty(&xs_state.reply_list)) { + mtx_unlock(&xs_state.reply_lock); + wait_event_interruptible(&xs_state.reply_waitq, + !list_empty(&xs_state.reply_list)); + + mtx_lock(&xs_state.reply_lock); + } } - + msg = TAILQ_FIRST(&xs_state.reply_list); list_del(&xs_state.reply_list, msg); - spin_unlock(&xs_state.reply_lock); + mtx_unlock(&xs_state.reply_lock); + printf("itype=%d htype=%d ", itype, msg->hdr.type); *type = msg->hdr.type; if (len) *len = msg->hdr.len; body = msg->u.reply.body; kfree(msg); - + if (len) + printf("len=%d\n", *len); + else + printf("len=NULL\n"); return body; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808200555.m7K5tHPQ004338>