From owner-p4-projects@FreeBSD.ORG Thu Jan 3 23:33:29 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BF8E716A46E; Thu, 3 Jan 2008 23:33:29 +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 847FD16A469 for ; Thu, 3 Jan 2008 23:33:29 +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 7477513C461 for ; Thu, 3 Jan 2008 23:33:29 +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 m03NXTjb073514 for ; Thu, 3 Jan 2008 23:33:29 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m03NXT0N073511 for perforce@freebsd.org; Thu, 3 Jan 2008 23:33:29 GMT (envelope-from jb@freebsd.org) Date: Thu, 3 Jan 2008 23:33:29 GMT Message-Id: <200801032333.m03NXT0N073511@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 132440 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: Thu, 03 Jan 2008 23:33:30 -0000 http://perforce.freebsd.org/chv.cgi?CH=132440 Change 132440 by jb@jb_freebsd1 on 2008/01/03 23:33:11 Add a simple test for the cyclic_add_omni() call to fire timers on all CPUs. Affected files ... .. //depot/projects/dtrace/src/sys/cddl/kern/cyclic_test.c#3 edit Differences ... ==== //depot/projects/dtrace/src/sys/cddl/kern/cyclic_test.c#3 (text+ko) ==== @@ -45,7 +45,7 @@ nanotime(&ts); timespecsub(&ts,&test_001_start); - printf("%s: called after %lu.%09lu\n",__func__,(u_long) ts.tv_sec,(u_long) ts.tv_nsec); + printf("%s: called after %lu.%09lu on curcpu %d\n",__func__,(u_long) ts.tv_sec,(u_long) ts.tv_nsec, curcpu); } static void @@ -60,7 +60,6 @@ hdlr.cyh_func = (cyc_func_t) cyclic_test_001_func; hdlr.cyh_arg = 0; - hdlr.cyh_level = CY_LOW_LEVEL; when.cyt_when = 0; when.cyt_interval = 1000000000; @@ -84,13 +83,63 @@ printf("%s: %s\n",__func__, error == 0 ? "passed":"failed"); } +static struct timespec test_002_start; + +static void +cyclic_test_002_func(void *arg) +{ + struct timespec ts; + + nanotime(&ts); + timespecsub(&ts,&test_002_start); + printf("%s: called after %lu.%09lu on curcpu %d\n",__func__,(u_long) ts.tv_sec,(u_long) ts.tv_nsec, curcpu); +} + +static void +cyclic_test_002_online(void *arg, cpu_t *c, cyc_handler_t *hdlr, cyc_time_t *t) +{ + printf("%s: online on curcpu %d\n",__func__, curcpu); + hdlr->cyh_func = cyclic_test_002_func; + hdlr->cyh_arg = NULL; + t->cyt_when = 0; + t->cyt_interval = 1000000000; +} + +static void +cyclic_test_002_offline(void *arg, cpu_t *c, void *arg1) +{ + printf("%s: offline on curcpu %d\n",__func__, curcpu); +} + static void cyclic_test_002(void) { int error = 0; + cyc_omni_handler_t hdlr; + cyclic_id_t id; printf("%s: starting\n",__func__); - DELAY(60000000); + + hdlr.cyo_online = cyclic_test_002_online; + hdlr.cyo_offline = cyclic_test_002_offline; + hdlr.cyo_arg = NULL; + + nanotime(&test_002_start); + + mutex_enter(&cpu_lock); + + id = cyclic_add_omni(&hdlr); + + mutex_exit(&cpu_lock); + + DELAY(1200000); + + mutex_enter(&cpu_lock); + + cyclic_remove(id); + + mutex_exit(&cpu_lock); + printf("%s: %s\n",__func__, error == 0 ? "passed":"failed"); } @@ -180,3 +229,4 @@ DEV_MODULE(cyclic_test, cyclic_test_modevent, NULL); MODULE_VERSION(cyclic_test, 1); MODULE_DEPEND(cyclic_test, cyclic, 1, 1, 1); +MODULE_DEPEND(cyclic_test, opensolaris, 1, 1, 1);