From owner-svn-src-projects@FreeBSD.ORG Wed Nov 12 14:29:24 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73DCE1065691; Wed, 12 Nov 2008 14:29:24 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6CFE78FC0C; Wed, 12 Nov 2008 14:29:24 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mACETOhX032747; Wed, 12 Nov 2008 14:29:24 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mACETODr032746; Wed, 12 Nov 2008 14:29:24 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200811121429.mACETODr032746@svn.freebsd.org> From: Ulf Lilleengen Date: Wed, 12 Nov 2008 14:29:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184884 - projects/csup_cvsmode/contrib/csup X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Nov 2008 14:29:24 -0000 Author: lulf Date: Wed Nov 12 14:29:24 2008 New Revision: 184884 URL: http://svn.freebsd.org/changeset/base/184884 Log: - Fix idiotic rcsnum_cmp and compare the revision numbers without allocating any memory. Modified: projects/csup_cvsmode/contrib/csup/misc.c Modified: projects/csup_cvsmode/contrib/csup/misc.c ============================================================================== --- projects/csup_cvsmode/contrib/csup/misc.c Wed Nov 12 14:16:39 2008 (r184883) +++ projects/csup_cvsmode/contrib/csup/misc.c Wed Nov 12 14:29:24 2008 (r184884) @@ -578,44 +578,24 @@ bt_free(struct backoff_timer *bt) int rcsnum_cmp(char *revision1, char *revision2) { - char *rev1, *rev2, *rev1orig, *rev2orig; - char *tmp1, *tmp2; - long num1, num2; - int retval; - - rev1orig = xstrdup(revision1); - rev2orig = xstrdup(revision2); - retval = 0; - - rev1 = rev1orig; - rev2 = rev2orig; - tmp1 = strsep(&rev1, "."); - tmp2 = strsep(&rev2, "."); - while (tmp1 != NULL && tmp2 != NULL) { - num1 = strtol(tmp1, NULL, 10); - num2 = strtol(tmp2, NULL, 10); - if (num1 > num2) { - retval = 1; - goto done; - } else if (num1 < num2) { - retval = -1; - goto done; - } - tmp1 = strsep(&rev1, "."); - tmp2 = strsep(&rev2, "."); - } - - /* If one of them is longer (not null), the shortest is the highest - * ranked. */ - if (tmp2 != NULL && tmp1 == NULL) - retval = -1; - else if (tmp2 == NULL && tmp1 != NULL) - retval = 1; - -done: - free(rev1orig); - free(rev2orig); - return (retval); + char *ptr1, *ptr2; + + ptr1 = revision1; + ptr2 = revision2; + while (*ptr1 != '\0' && *ptr2 != '\0') { + if (*ptr1 > *ptr2) + return (1); + else if (*ptr1 < *ptr2) + return (-1); + ptr1++; + ptr2++; + }; + + if (*ptr1 != '\0' && *ptr2 == '\0') + return (1); + if (*ptr1 == '\0' && *ptr2 != '\0') + return (-1); + return (0); } /* Returns 0 if a rcsrev is not a trunk revision number. */ From owner-svn-src-projects@FreeBSD.ORG Wed Nov 12 20:25:37 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 118731065676; Wed, 12 Nov 2008 20:25:37 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from bene1.itea.ntnu.no (bene1.itea.ntnu.no [IPv6:2001:700:300:3::56]) by mx1.freebsd.org (Postfix) with ESMTP id BBF908FC17; Wed, 12 Nov 2008 20:25:36 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by bene1.itea.ntnu.no (Postfix) with ESMTP id E969F174007; Wed, 12 Nov 2008 21:25:35 +0100 (CET) Received: from carrot.studby.ntnu.no (unknown [IPv6:2001:700:300:3::184]) by bene1.itea.ntnu.no (Postfix) with ESMTP id 965D016C89D; Wed, 12 Nov 2008 21:25:35 +0100 (CET) Date: Wed, 12 Nov 2008 22:25:58 +0100 From: Ulf Lilleengen To: src-committers@freebsd.org, svn-src-projects@freebsd.org Message-ID: <20081112212557.GB1581@carrot.studby.ntnu.no> References: <200811121429.mACETODr032746@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200811121429.mACETODr032746@svn.freebsd.org> User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: Debian amavisd-new at bene1.itea.ntnu.no Cc: Subject: Re: svn commit: r184884 - projects/csup_cvsmode/contrib/csup X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Nov 2008 20:25:37 -0000 On ons, nov 12, 2008 at 02:29:24pm +0000, Ulf Lilleengen wrote: > Author: lulf > Date: Wed Nov 12 14:29:24 2008 > New Revision: 184884 > URL: http://svn.freebsd.org/changeset/base/184884 > > Log: > - Fix idiotic rcsnum_cmp and compare the revision numbers without allocating any > memory. > Please note that it was my old work that was idiotic, in case more people misunderstand this. -- Ulf Lilleengen From owner-svn-src-projects@FreeBSD.ORG Thu Nov 13 10:14:30 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC5921065670; Thu, 13 Nov 2008 10:14:30 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7535A8FC16; Thu, 13 Nov 2008 10:14:30 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mADAEUUV055405; Thu, 13 Nov 2008 10:14:30 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mADAEUnH055404; Thu, 13 Nov 2008 10:14:30 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <200811131014.mADAEUnH055404@svn.freebsd.org> From: Lawrence Stewart Date: Thu, 13 Nov 2008 10:14:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184915 - projects/tcp_cc_8.x/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Nov 2008 10:14:31 -0000 Author: lstewart Date: Thu Nov 13 10:14:30 2008 New Revision: 184915 URL: http://svn.freebsd.org/changeset/base/184915 Log: - Remove an unnecessary printf and malloc type - Clean up some white space Modified: projects/tcp_cc_8.x/sys/netinet/cc.c Modified: projects/tcp_cc_8.x/sys/netinet/cc.c ============================================================================== --- projects/tcp_cc_8.x/sys/netinet/cc.c Thu Nov 13 09:53:53 2008 (r184914) +++ projects/tcp_cc_8.x/sys/netinet/cc.c Thu Nov 13 10:14:30 2008 (r184915) @@ -59,9 +59,6 @@ struct cc_head cc_list = STAILQ_HEAD_INI struct rwlock cc_list_lock; -MALLOC_DECLARE(M_STRING); -MALLOC_DEFINE(M_STRING, "string", "a string"); - /* create a struct to point to our newreno functions */ struct cc_algo newreno_cc_algo = { .name = "newreno", @@ -248,7 +245,6 @@ cc_register_algorithm(struct cc_algo *ad int newreno_init(struct tcpcb *tp) { - printf("initialising tcp connection with newreno congestion control\n"); return 0; } @@ -349,10 +345,10 @@ newreno_ack_received(struct tcpcb *tp, s /* * update the value of ssthresh before entering FR */ -void +void newreno_pre_fr(struct tcpcb *tp, struct tcphdr *th) { - newreno_ssthresh_update(tp); + newreno_ssthresh_update(tp); } /* @@ -360,7 +356,7 @@ newreno_pre_fr(struct tcpcb *tp, struct * th can be null, in which case cwnd will be set according to reno instead * of new reno. */ -void +void newreno_post_fr(struct tcpcb *tp, struct tcphdr *th) { /* From owner-svn-src-projects@FreeBSD.ORG Thu Nov 13 11:07:17 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAA7D106567B; Thu, 13 Nov 2008 11:07:17 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9BE4A8FC18; Thu, 13 Nov 2008 11:07:17 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mADB7HdY057452; Thu, 13 Nov 2008 11:07:17 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mADB7HXE057451; Thu, 13 Nov 2008 11:07:17 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <200811131107.mADB7HXE057451@svn.freebsd.org> From: Lawrence Stewart Date: Thu, 13 Nov 2008 11:07:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184919 - projects/tcp_ffcaia2008_8.x X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Nov 2008 11:07:17 -0000 Author: lstewart Date: Thu Nov 13 11:07:17 2008 New Revision: 184919 URL: http://svn.freebsd.org/changeset/base/184919 Log: Create a home for the FreeBSD Foundation sponsored "Enhancing the FreeBSD TCP Implementation" project. This project is being hosted at Swinburne University's Centre for Advanced Internet Architectures (CAIA), Melbourne, Australia, as part of the NewTCP research project. More information is available at: http://www.freebsdfoundation.org/ http://caia.swin.edu.au/urp/newtcp This project aims to implement: - Appropriate byte counting (RFC3465) support - Per-connection dynamic tuning of the TCP reassembly queue - Enhanced TCP data logging infrastructure for improving our TCP debugging and development capabilities More details will be officially announced by the FreeBSD Foundation shortly. Added: projects/tcp_ffcaia2008_8.x/ - copied from r184918, head/ From owner-svn-src-projects@FreeBSD.ORG Fri Nov 14 05:01:11 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4C2C1065673; Fri, 14 Nov 2008 05:01:11 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A87008FC14; Fri, 14 Nov 2008 05:01:11 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAE51Bxr078990; Fri, 14 Nov 2008 05:01:11 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAE51BfR078989; Fri, 14 Nov 2008 05:01:11 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200811140501.mAE51BfR078989@svn.freebsd.org> From: Kip Macy Date: Fri, 14 Nov 2008 05:01:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184954 - projects/release_6_3_xen/sys/xen/xenbus X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Nov 2008 05:01:11 -0000 Author: kmacy Date: Fri Nov 14 05:01:11 2008 New Revision: 184954 URL: http://svn.freebsd.org/changeset/base/184954 Log: Convert suspend_mutex from semaphore to sx lock - avoid recursion in inline watch handling Modified: projects/release_6_3_xen/sys/xen/xenbus/xenbus_xs.c Modified: projects/release_6_3_xen/sys/xen/xenbus/xenbus_xs.c ============================================================================== --- projects/release_6_3_xen/sys/xen/xenbus/xenbus_xs.c Fri Nov 14 03:37:15 2008 (r184953) +++ projects/release_6_3_xen/sys/xen/xenbus/xenbus_xs.c Fri Nov 14 05:01:11 2008 (r184954) @@ -107,7 +107,7 @@ struct xs_handle { struct sx request_mutex; /* Protect transactions against save/restore. */ - struct rw_semaphore suspend_mutex; + struct sx suspend_mutex; }; static struct xs_handle xs_state; @@ -231,7 +231,7 @@ void *xenbus_dev_request_and_reply(struc int err; if (req_msg.type == XS_TRANSACTION_START) - down_read(&xs_state.suspend_mutex); + sx_slock(&xs_state.suspend_mutex); sx_xlock(&xs_state.request_mutex); @@ -248,11 +248,13 @@ void *xenbus_dev_request_and_reply(struc if ((msg->type == XS_TRANSACTION_END) || ((req_msg.type == XS_TRANSACTION_START) && (msg->type == XS_ERROR))) - up_read(&xs_state.suspend_mutex); + sx_sunlock(&xs_state.suspend_mutex); return ret; } +static int xenwatch_inline; + /* Send message to xs, get kmalloc'ed reply. ERR_PTR() on error. */ static void *xs_talkv(struct xenbus_transaction t, enum xsd_sockmsg_type type, @@ -305,17 +307,24 @@ static void *xs_talkv(struct xenbus_tran return ERR_PTR(-err); } - if (xenwatch_running == 0) { - while (!TAILQ_EMPTY(&watch_events)) { + if ((xenwatch_running == 0) && (xenwatch_inline == 0)) { + xenwatch_inline = 1; + while (!TAILQ_EMPTY(&watch_events) + && xenwatch_running == 0) { + struct xs_stored_msg *wmsg = TAILQ_FIRST(&watch_events); list_del(&watch_events, wmsg); - wmsg->u.watch.handle->callback( + printf("handling %p ...", wmsg->u.watch.handle->callback); + + wmsg->u.watch.handle->callback( wmsg->u.watch.handle, (const char **)wmsg->u.watch.vec, wmsg->u.watch.vec_size); - kfree(wmsg->u.watch.vec); + printf("... %p done\n", wmsg->u.watch.handle->callback); + kfree(wmsg->u.watch.vec); kfree(wmsg); } + xenwatch_inline = 0; } BUG_ON(msg.type != type); @@ -521,11 +530,10 @@ int xenbus_transaction_start(struct xenb { char *id_str; - down_read(&xs_state.suspend_mutex); - + sx_slock(&xs_state.suspend_mutex); id_str = xs_single(XBT_NIL, XS_TRANSACTION_START, "", NULL); if (IS_ERR(id_str)) { - up_read(&xs_state.suspend_mutex); + sx_sunlock(&xs_state.suspend_mutex); return PTR_ERR(id_str); } @@ -551,8 +559,8 @@ int xenbus_transaction_end(struct xenbus printf("xenbus_transaction_end "); err = xs_error(xs_single(t, XS_TRANSACTION_END, abortstr, NULL)); - - up_read(&xs_state.suspend_mutex); + + sx_sunlock(&xs_state.suspend_mutex); return err; } @@ -691,7 +699,7 @@ int register_xenbus_watch(struct xenbus_ sprintf(token, "%lX", (long)watch); - down_read(&xs_state.suspend_mutex); + sx_slock(&xs_state.suspend_mutex); mtx_lock(&watches_lock); BUG_ON(find_watch(token) != NULL); @@ -699,7 +707,7 @@ int register_xenbus_watch(struct xenbus_ mtx_unlock(&watches_lock); err = xs_watch(watch->node, token); - + /* Ignore errors due to multiple registration. */ if ((err != 0) && (err != -EEXIST)) { mtx_lock(&watches_lock); @@ -707,7 +715,7 @@ int register_xenbus_watch(struct xenbus_ mtx_unlock(&watches_lock); } - up_read(&xs_state.suspend_mutex); + sx_sunlock(&xs_state.suspend_mutex); return err; } @@ -720,8 +728,8 @@ void unregister_xenbus_watch(struct xenb int err; sprintf(token, "%lX", (long)watch); - - down_read(&xs_state.suspend_mutex); + + sx_slock(&xs_state.suspend_mutex); mtx_lock(&watches_lock); BUG_ON(!find_watch(token)); @@ -733,7 +741,7 @@ void unregister_xenbus_watch(struct xenb log(LOG_WARNING, "XENBUS Failed to release watch %s: %i\n", watch->node, err); - up_read(&xs_state.suspend_mutex); + sx_sunlock(&xs_state.suspend_mutex); /* Cancel pending watch events. */ mtx_lock(&watch_events_lock); @@ -755,8 +763,8 @@ void unregister_xenbus_watch(struct xenb EXPORT_SYMBOL(unregister_xenbus_watch); void xs_suspend(void) -{ - down_write(&xs_state.suspend_mutex); +{ + sx_xlock(&xs_state.suspend_mutex); sx_xlock(&xs_state.request_mutex); } @@ -773,15 +781,22 @@ void xs_resume(void) xs_watch(watch->node, token); } - up_write(&xs_state.suspend_mutex); + sx_xunlock(&xs_state.suspend_mutex); } static void xenwatch_thread(void *unused) { struct xs_stored_msg *msg; - DELAY(10000); xenwatch_running = 1; + + DELAY(100000); + while (xenwatch_inline) { + printf("xenwatch inline still running\n"); + DELAY(100000); + } + + for (;;) { while (list_empty(&watch_events)) @@ -797,7 +812,6 @@ static void xenwatch_thread(void *unused mtx_unlock(&watch_events_lock); if (msg != NULL) { - printf("handling watch\n"); msg->u.watch.handle->callback( msg->u.watch.handle, (const char **)msg->u.watch.vec, @@ -906,7 +920,7 @@ int xs_init(void) mtx_init(&xs_state.reply_lock, "state reply", NULL, MTX_DEF); sx_init(&xs_state.request_mutex, "xenstore request"); - sema_init(&xs_state.suspend_mutex, 1, "xenstore suspend"); + sx_init(&xs_state.suspend_mutex, "xenstore suspend"); #if 0 From owner-svn-src-projects@FreeBSD.ORG Fri Nov 14 06:34:01 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 991D21065672; Fri, 14 Nov 2008 06:34:01 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A6DC8FC14; Fri, 14 Nov 2008 06:34:01 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAE6Y13j080553; Fri, 14 Nov 2008 06:34:01 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAE6Y1Es080552; Fri, 14 Nov 2008 06:34:01 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200811140634.mAE6Y1Es080552@svn.freebsd.org> From: Kip Macy Date: Fri, 14 Nov 2008 06:34:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184955 - projects/releng_7_xen/sys/xen/xenbus X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Nov 2008 06:34:01 -0000 Author: kmacy Date: Fri Nov 14 06:34:01 2008 New Revision: 184955 URL: http://svn.freebsd.org/changeset/base/184955 Log: merge fix for boot-time hang on centos' xen Modified: projects/releng_7_xen/sys/xen/xenbus/xenbus_xs.c Modified: projects/releng_7_xen/sys/xen/xenbus/xenbus_xs.c ============================================================================== --- projects/releng_7_xen/sys/xen/xenbus/xenbus_xs.c Fri Nov 14 05:01:11 2008 (r184954) +++ projects/releng_7_xen/sys/xen/xenbus/xenbus_xs.c Fri Nov 14 06:34:01 2008 (r184955) @@ -107,7 +107,7 @@ struct xs_handle { struct sx request_mutex; /* Protect transactions against save/restore. */ - struct rw_semaphore suspend_mutex; + struct sx suspend_mutex; }; static struct xs_handle xs_state; @@ -231,7 +231,7 @@ void *xenbus_dev_request_and_reply(struc int err; if (req_msg.type == XS_TRANSACTION_START) - down_read(&xs_state.suspend_mutex); + sx_slock(&xs_state.suspend_mutex); sx_xlock(&xs_state.request_mutex); @@ -248,11 +248,13 @@ void *xenbus_dev_request_and_reply(struc if ((msg->type == XS_TRANSACTION_END) || ((req_msg.type == XS_TRANSACTION_START) && (msg->type == XS_ERROR))) - up_read(&xs_state.suspend_mutex); + sx_sunlock(&xs_state.suspend_mutex); return ret; } +static int xenwatch_inline; + /* Send message to xs, get kmalloc'ed reply. ERR_PTR() on error. */ static void *xs_talkv(struct xenbus_transaction t, enum xsd_sockmsg_type type, @@ -305,17 +307,24 @@ static void *xs_talkv(struct xenbus_tran return ERR_PTR(-err); } - if (xenwatch_running == 0) { - while (!TAILQ_EMPTY(&watch_events)) { + if ((xenwatch_running == 0) && (xenwatch_inline == 0)) { + xenwatch_inline = 1; + while (!TAILQ_EMPTY(&watch_events) + && xenwatch_running == 0) { + struct xs_stored_msg *wmsg = TAILQ_FIRST(&watch_events); list_del(&watch_events, wmsg); - wmsg->u.watch.handle->callback( + printf("handling %p ...", wmsg->u.watch.handle->callback); + + wmsg->u.watch.handle->callback( wmsg->u.watch.handle, (const char **)wmsg->u.watch.vec, wmsg->u.watch.vec_size); - kfree(wmsg->u.watch.vec); + printf("... %p done\n", wmsg->u.watch.handle->callback); + kfree(wmsg->u.watch.vec); kfree(wmsg); } + xenwatch_inline = 0; } BUG_ON(msg.type != type); @@ -521,11 +530,10 @@ int xenbus_transaction_start(struct xenb { char *id_str; - down_read(&xs_state.suspend_mutex); - + sx_slock(&xs_state.suspend_mutex); id_str = xs_single(XBT_NIL, XS_TRANSACTION_START, "", NULL); if (IS_ERR(id_str)) { - up_read(&xs_state.suspend_mutex); + sx_sunlock(&xs_state.suspend_mutex); return PTR_ERR(id_str); } @@ -551,8 +559,8 @@ int xenbus_transaction_end(struct xenbus printf("xenbus_transaction_end "); err = xs_error(xs_single(t, XS_TRANSACTION_END, abortstr, NULL)); - - up_read(&xs_state.suspend_mutex); + + sx_sunlock(&xs_state.suspend_mutex); return err; } @@ -691,7 +699,7 @@ int register_xenbus_watch(struct xenbus_ sprintf(token, "%lX", (long)watch); - down_read(&xs_state.suspend_mutex); + sx_slock(&xs_state.suspend_mutex); mtx_lock(&watches_lock); BUG_ON(find_watch(token) != NULL); @@ -699,7 +707,7 @@ int register_xenbus_watch(struct xenbus_ mtx_unlock(&watches_lock); err = xs_watch(watch->node, token); - + /* Ignore errors due to multiple registration. */ if ((err != 0) && (err != -EEXIST)) { mtx_lock(&watches_lock); @@ -707,7 +715,7 @@ int register_xenbus_watch(struct xenbus_ mtx_unlock(&watches_lock); } - up_read(&xs_state.suspend_mutex); + sx_sunlock(&xs_state.suspend_mutex); return err; } @@ -720,8 +728,8 @@ void unregister_xenbus_watch(struct xenb int err; sprintf(token, "%lX", (long)watch); - - down_read(&xs_state.suspend_mutex); + + sx_slock(&xs_state.suspend_mutex); mtx_lock(&watches_lock); BUG_ON(!find_watch(token)); @@ -733,7 +741,7 @@ void unregister_xenbus_watch(struct xenb log(LOG_WARNING, "XENBUS Failed to release watch %s: %i\n", watch->node, err); - up_read(&xs_state.suspend_mutex); + sx_sunlock(&xs_state.suspend_mutex); /* Cancel pending watch events. */ mtx_lock(&watch_events_lock); @@ -755,8 +763,8 @@ void unregister_xenbus_watch(struct xenb EXPORT_SYMBOL(unregister_xenbus_watch); void xs_suspend(void) -{ - down_write(&xs_state.suspend_mutex); +{ + sx_xlock(&xs_state.suspend_mutex); sx_xlock(&xs_state.request_mutex); } @@ -773,15 +781,22 @@ void xs_resume(void) xs_watch(watch->node, token); } - up_write(&xs_state.suspend_mutex); + sx_xunlock(&xs_state.suspend_mutex); } static void xenwatch_thread(void *unused) { struct xs_stored_msg *msg; - DELAY(10000); xenwatch_running = 1; + + DELAY(100000); + while (xenwatch_inline) { + printf("xenwatch inline still running\n"); + DELAY(100000); + } + + for (;;) { while (list_empty(&watch_events)) @@ -797,7 +812,6 @@ static void xenwatch_thread(void *unused mtx_unlock(&watch_events_lock); if (msg != NULL) { - printf("handling watch\n"); msg->u.watch.handle->callback( msg->u.watch.handle, (const char **)msg->u.watch.vec, @@ -906,7 +920,7 @@ int xs_init(void) mtx_init(&xs_state.reply_lock, "state reply", NULL, MTX_DEF); sx_init(&xs_state.request_mutex, "xenstore request"); - sema_init(&xs_state.suspend_mutex, 1, "xenstore suspend"); + sx_init(&xs_state.suspend_mutex, "xenstore suspend"); #if 0 From owner-svn-src-projects@FreeBSD.ORG Fri Nov 14 06:40:43 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 947E51065686; Fri, 14 Nov 2008 06:40:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75B5A8FC08; Fri, 14 Nov 2008 06:40:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAE6eh9x080709; Fri, 14 Nov 2008 06:40:43 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAE6ehhl080708; Fri, 14 Nov 2008 06:40:43 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200811140640.mAE6ehhl080708@svn.freebsd.org> From: Kip Macy Date: Fri, 14 Nov 2008 06:40:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184956 - projects/releng_6_xen/sys/xen/xenbus X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Nov 2008 06:40:43 -0000 Author: kmacy Date: Fri Nov 14 06:40:43 2008 New Revision: 184956 URL: http://svn.freebsd.org/changeset/base/184956 Log: merge fix for boot-time hang on centos' xen Modified: projects/releng_6_xen/sys/xen/xenbus/xenbus_xs.c Modified: projects/releng_6_xen/sys/xen/xenbus/xenbus_xs.c ============================================================================== --- projects/releng_6_xen/sys/xen/xenbus/xenbus_xs.c Fri Nov 14 06:34:01 2008 (r184955) +++ projects/releng_6_xen/sys/xen/xenbus/xenbus_xs.c Fri Nov 14 06:40:43 2008 (r184956) @@ -107,7 +107,7 @@ struct xs_handle { struct sx request_mutex; /* Protect transactions against save/restore. */ - struct rw_semaphore suspend_mutex; + struct sx suspend_mutex; }; static struct xs_handle xs_state; @@ -231,7 +231,7 @@ void *xenbus_dev_request_and_reply(struc int err; if (req_msg.type == XS_TRANSACTION_START) - down_read(&xs_state.suspend_mutex); + sx_slock(&xs_state.suspend_mutex); sx_xlock(&xs_state.request_mutex); @@ -248,11 +248,13 @@ void *xenbus_dev_request_and_reply(struc if ((msg->type == XS_TRANSACTION_END) || ((req_msg.type == XS_TRANSACTION_START) && (msg->type == XS_ERROR))) - up_read(&xs_state.suspend_mutex); + sx_sunlock(&xs_state.suspend_mutex); return ret; } +static int xenwatch_inline; + /* Send message to xs, get kmalloc'ed reply. ERR_PTR() on error. */ static void *xs_talkv(struct xenbus_transaction t, enum xsd_sockmsg_type type, @@ -305,17 +307,24 @@ static void *xs_talkv(struct xenbus_tran return ERR_PTR(-err); } - if (xenwatch_running == 0) { - while (!TAILQ_EMPTY(&watch_events)) { + if ((xenwatch_running == 0) && (xenwatch_inline == 0)) { + xenwatch_inline = 1; + while (!TAILQ_EMPTY(&watch_events) + && xenwatch_running == 0) { + struct xs_stored_msg *wmsg = TAILQ_FIRST(&watch_events); list_del(&watch_events, wmsg); - wmsg->u.watch.handle->callback( + printf("handling %p ...", wmsg->u.watch.handle->callback); + + wmsg->u.watch.handle->callback( wmsg->u.watch.handle, (const char **)wmsg->u.watch.vec, wmsg->u.watch.vec_size); - kfree(wmsg->u.watch.vec); + printf("... %p done\n", wmsg->u.watch.handle->callback); + kfree(wmsg->u.watch.vec); kfree(wmsg); } + xenwatch_inline = 0; } BUG_ON(msg.type != type); @@ -521,11 +530,10 @@ int xenbus_transaction_start(struct xenb { char *id_str; - down_read(&xs_state.suspend_mutex); - + sx_slock(&xs_state.suspend_mutex); id_str = xs_single(XBT_NIL, XS_TRANSACTION_START, "", NULL); if (IS_ERR(id_str)) { - up_read(&xs_state.suspend_mutex); + sx_sunlock(&xs_state.suspend_mutex); return PTR_ERR(id_str); } @@ -551,8 +559,8 @@ int xenbus_transaction_end(struct xenbus printf("xenbus_transaction_end "); err = xs_error(xs_single(t, XS_TRANSACTION_END, abortstr, NULL)); - - up_read(&xs_state.suspend_mutex); + + sx_sunlock(&xs_state.suspend_mutex); return err; } @@ -691,7 +699,7 @@ int register_xenbus_watch(struct xenbus_ sprintf(token, "%lX", (long)watch); - down_read(&xs_state.suspend_mutex); + sx_slock(&xs_state.suspend_mutex); mtx_lock(&watches_lock); BUG_ON(find_watch(token) != NULL); @@ -699,7 +707,7 @@ int register_xenbus_watch(struct xenbus_ mtx_unlock(&watches_lock); err = xs_watch(watch->node, token); - + /* Ignore errors due to multiple registration. */ if ((err != 0) && (err != -EEXIST)) { mtx_lock(&watches_lock); @@ -707,7 +715,7 @@ int register_xenbus_watch(struct xenbus_ mtx_unlock(&watches_lock); } - up_read(&xs_state.suspend_mutex); + sx_sunlock(&xs_state.suspend_mutex); return err; } @@ -720,8 +728,8 @@ void unregister_xenbus_watch(struct xenb int err; sprintf(token, "%lX", (long)watch); - - down_read(&xs_state.suspend_mutex); + + sx_slock(&xs_state.suspend_mutex); mtx_lock(&watches_lock); BUG_ON(!find_watch(token)); @@ -733,7 +741,7 @@ void unregister_xenbus_watch(struct xenb log(LOG_WARNING, "XENBUS Failed to release watch %s: %i\n", watch->node, err); - up_read(&xs_state.suspend_mutex); + sx_sunlock(&xs_state.suspend_mutex); /* Cancel pending watch events. */ mtx_lock(&watch_events_lock); @@ -755,8 +763,8 @@ void unregister_xenbus_watch(struct xenb EXPORT_SYMBOL(unregister_xenbus_watch); void xs_suspend(void) -{ - down_write(&xs_state.suspend_mutex); +{ + sx_xlock(&xs_state.suspend_mutex); sx_xlock(&xs_state.request_mutex); } @@ -773,15 +781,22 @@ void xs_resume(void) xs_watch(watch->node, token); } - up_write(&xs_state.suspend_mutex); + sx_xunlock(&xs_state.suspend_mutex); } static void xenwatch_thread(void *unused) { struct xs_stored_msg *msg; - DELAY(10000); xenwatch_running = 1; + + DELAY(100000); + while (xenwatch_inline) { + printf("xenwatch inline still running\n"); + DELAY(100000); + } + + for (;;) { while (list_empty(&watch_events)) @@ -797,7 +812,6 @@ static void xenwatch_thread(void *unused mtx_unlock(&watch_events_lock); if (msg != NULL) { - printf("handling watch\n"); msg->u.watch.handle->callback( msg->u.watch.handle, (const char **)msg->u.watch.vec, @@ -906,7 +920,7 @@ int xs_init(void) mtx_init(&xs_state.reply_lock, "state reply", NULL, MTX_DEF); sx_init(&xs_state.request_mutex, "xenstore request"); - sema_init(&xs_state.suspend_mutex, 1, "xenstore suspend"); + sx_init(&xs_state.suspend_mutex, "xenstore suspend"); #if 0