From owner-p4-projects@FreeBSD.ORG Sun Dec 23 04:32:18 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E40B116A41A; Sun, 23 Dec 2007 04:32:17 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C7F416A418 for ; Sun, 23 Dec 2007 04:32:17 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 5DCD613C45D for ; Sun, 23 Dec 2007 04:32:17 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lBN4WHpf089638 for ; Sun, 23 Dec 2007 04:32:17 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lBN4WHuH089635 for perforce@freebsd.org; Sun, 23 Dec 2007 04:32:17 GMT (envelope-from jb@freebsd.org) Date: Sun, 23 Dec 2007 04:32:17 GMT Message-Id: <200712230432.lBN4WHuH089635@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 131454 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: Sun, 23 Dec 2007 04:32:18 -0000 http://perforce.freebsd.org/chv.cgi?CH=131454 Change 131454 by jb@jb_freebsd1 on 2007/12/23 04:32:07 Fix the test-and-set. The return type is inverted. Oops. Enable the mp_init() function so that it can be called via a SYSINIT at the end of SI_SUB_SMP after the APs are launched. This case occurs if the cyclic module is loaded from the boot loader, in which case it initialises itself as early as possible to support tracing what happens on cpu0, in proc0 and thread0. Affected files ... .. //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/os/cyclic.c#8 edit Differences ... ==== //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/os/cyclic.c#8 (text) ==== @@ -610,7 +610,11 @@ break; if (cyc_coverage[ndx].cyv_why != NULL || - casptr(&cyc_coverage[ndx].cyv_why, NULL, why) != 0) { +#if defined(sun) + casptr(&cyc_coverage[ndx].cyv_why, NULL, why) != NULL) { +#else + atomic_cmpset_ptr((volatile uintptr_t *) &cyc_coverage[ndx].cyv_why, (uintptr_t) NULL, (uintptr_t) why) == 0) { +#endif if (++ndx == CY_NCOVERAGE) ndx = 0; @@ -2866,7 +2870,11 @@ return (cyclic_resolution); } +#if defined(sun) void +#else +static void +#endif cyclic_init(cyc_backend_t *be, hrtime_t resolution) { ASSERT(MUTEX_HELD(&cpu_lock)); @@ -2900,8 +2908,12 @@ * find the already initialized CPU, and initialize every other CPU with the * same backend. Finally, we register a cpu_setup function. */ +#if defined(sun) void -cyclic_mp_init() +#else +static void +#endif +cyclic_mp_init(void) { cpu_t *c; #if !defined(sun) @@ -2926,13 +2938,11 @@ } #if defined(sun) } while ((c = c->cpu_next) != cpu_list); + + register_cpu_setup_func((cpu_setup_func_t *)cyclic_cpu_setup, NULL); #else } #endif - -#if defined(sun) - register_cpu_setup_func((cpu_setup_func_t *)cyclic_cpu_setup, NULL); -#endif mutex_exit(&cpu_lock); } @@ -2948,7 +2958,10 @@ if ((pc = pcpu_find(id)) == NULL) continue; - c = &cyclic_cpu[pc->pc_cpuid]; + c = &cyclic_cpu[id]; + + if (c->cpu_cyclic == NULL) + continue; cyclic_offline(c); cyclic_unconfigure(c); @@ -3115,7 +3128,9 @@ cyc_id_t *idp; CYC_PTRACE1("online", cpu); +#if defined(sun) ASSERT(c->cpu_flags & CPU_ENABLE); +#endif ASSERT(MUTEX_HELD(&cpu_lock)); ASSERT(cpu->cyp_state == CYS_OFFLINE);