From owner-p4-projects@FreeBSD.ORG Fri Jul 14 18:49:17 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 210A216A4E1; Fri, 14 Jul 2006 18:49:17 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E781416A4DE for ; Fri, 14 Jul 2006 18:49:16 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9BF5C43D4C for ; Fri, 14 Jul 2006 18:49:16 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k6EInG7w025446 for ; Fri, 14 Jul 2006 18:49:16 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k6EInGRL025443 for perforce@freebsd.org; Fri, 14 Jul 2006 18:49:16 GMT (envelope-from jhb@freebsd.org) Date: Fri, 14 Jul 2006 18:49:16 GMT Message-Id: <200607141849.k6EInGRL025443@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 101582 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2006 18:49:17 -0000 http://perforce.freebsd.org/chv.cgi?CH=101582 Change 101582 by jhb@jhb_mutex on 2006/07/14 18:48:39 Assume that the only entry that's going to be removed while running the list of handlers is the current one. Affected files ... .. //depot/projects/smpng/sys/kern/subr_autoconf.c#8 edit Differences ... ==== //depot/projects/smpng/sys/kern/subr_autoconf.c#8 (text+ko) ==== @@ -55,14 +55,6 @@ TAILQ_HEAD_INITIALIZER(intr_config_hook_list); static struct mtx intr_config_hook_lock; MTX_SYSINIT(intr_config_hook, &intr_config_hook_lock, "intr config", MTX_DEF); -static struct sx intr_config_run_lock; -SX_SYSINIT(intr_config_run, &intr_config_run_lock, "intr config run"); - -/* - * The current location in the list when a thread is executing the current - * hooks. If this hook is removed we advance it to the next entry. - */ -static struct intr_config_hook *next_entry; /* ARGSUSED */ static void run_interrupt_driven_config_hooks(void *dummy); @@ -71,18 +63,11 @@ run_interrupt_driven_config_hooks(dummy) void *dummy; { - struct intr_config_hook *hook_entry; + struct intr_config_hook *hook_entry, *next_entry; - /* - * Because of the special care for next_entry, we can only allow one - * thread at a time to run through the list. - */ - sx_xlock(&intr_config_run_lock); - mtx_lock(&intr_config_hook_lock); - for (hook_entry = TAILQ_FIRST(&intr_config_hook_list); - hook_entry != NULL; - hook_entry = next_entry) { + TAILQ_FOREACH_SAFE(hook_entry, &intr_config_hook_list, ich_links, + next_entry) { next_entry = TAILQ_NEXT(hook_entry, ich_links); mtx_unlock(&intr_config_hook_lock); (*hook_entry->ich_func)(hook_entry->ich_arg); @@ -94,8 +79,6 @@ "conifhk", 0); } mtx_unlock(&intr_config_hook_lock); - - sx_xunlock(&intr_config_run_lock); } SYSINIT(intr_config_hooks, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_FIRST, run_interrupt_driven_config_hooks, NULL) @@ -143,12 +126,6 @@ panic("config_intrhook_disestablish: disestablishing an " "unestablished hook"); - /* - * If a thread is going to run this hook next, advance it's next - * pointer. - */ - if (hook == next_entry) - next_entry = TAILQ_NEXT(next_entry, ich_links); TAILQ_REMOVE(&intr_config_hook_list, hook, ich_links); /* Wakeup anyone watching the list */