Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jan 2008 05:11:27 GMT
From:      John Birrell <jb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 132458 for review
Message-ID:  <200801040511.m045BR0l024742@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=132458

Change 132458 by jb@jb_freebsd1 on 2008/01/04 05:10:56

	Add another test to add a few cyclic to cause the arrays to be
	expanded and the old arrays to be freed.

Affected files ...

.. //depot/projects/dtrace/src/sys/cddl/kern/cyclic_test.c#4 edit

Differences ...

==== //depot/projects/dtrace/src/sys/cddl/kern/cyclic_test.c#4 (text+ko) ====

@@ -143,6 +143,71 @@
 	printf("%s: %s\n",__func__, error == 0 ? "passed":"failed");
 }
 
+static struct timespec test_003_start;
+
+static void
+cyclic_test_003_func(void *arg)
+{
+	struct timespec ts;
+
+	nanotime(&ts);
+	timespecsub(&ts,&test_003_start);
+	printf("%s: called after %lu.%09lu on curcpu %d id %ju\n",__func__,(u_long) ts.tv_sec,(u_long) ts.tv_nsec, curcpu, (uintmax_t) arg);
+}
+
+static void
+cyclic_test_003(void)
+{
+	int error = 0;
+	cyc_handler_t hdlr;
+	cyc_time_t when;
+	cyclic_id_t id;
+	cyclic_id_t id1;
+	cyclic_id_t id2;
+	cyclic_id_t id3;
+
+	printf("%s: starting\n",__func__);
+
+	hdlr.cyh_func = (cyc_func_t) cyclic_test_003_func;
+ 
+        when.cyt_when = 0;
+
+	nanotime(&test_003_start);
+
+	mutex_enter(&cpu_lock);
+
+        when.cyt_interval = 200000000;
+        hdlr.cyh_arg = (void *) 0UL;
+        id = cyclic_add(&hdlr, &when);
+
+        when.cyt_interval = 400000000;
+        hdlr.cyh_arg = (void *) 1UL;
+        id1 = cyclic_add(&hdlr, &when);
+
+        hdlr.cyh_arg = (void *) 2UL;
+        when.cyt_interval = 1000000000;
+        id2 = cyclic_add(&hdlr, &when);
+
+        hdlr.cyh_arg = (void *) 3UL;
+        when.cyt_interval = 1300000000;
+        id3 = cyclic_add(&hdlr, &when);
+
+	mutex_exit(&cpu_lock);
+
+	DELAY(1200000);
+
+	mutex_enter(&cpu_lock);
+
+	cyclic_remove(id);
+	cyclic_remove(id1);
+	cyclic_remove(id2);
+	cyclic_remove(id3);
+
+	mutex_exit(&cpu_lock);
+
+	printf("%s: %s\n",__func__, error == 0 ? "passed":"failed");
+}
+
 /* Kernel thread command routine. */
 static void
 cyclic_run_tests(void *arg)
@@ -156,9 +221,13 @@
 	case 2:
 		cyclic_test_002();
 		break;
+	case 3:
+		cyclic_test_003();
+		break;
 	default:
 		cyclic_test_001();
 		cyclic_test_002();
+		cyclic_test_003();
 		break;
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801040511.m045BR0l024742>