PERFORCE change 552486 for review

Jonathan Anderson jonathan at FreeBSD.org
Mon Sep 2 10:22:30 UTC 2013


http://p4web.freebsd.org/@@552486?ac=10

Change 552486 by jonathan at jonathan-on-zenith on 2013/09/02 10:21:46

	Update TESLA P4 branch to latest TESLA parts (struct tesla_automaton, explicit symbol names, etc.).
	
	This builds a bootable kernel again.

Affected files ...

.. //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_class.c#9 edit
.. //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_debug.c#7 edit
.. //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_dtrace.c#10 edit
.. //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_internal.h#13 edit
.. //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_notification.c#17 edit
.. //depot/projects/ctsrd/tesla/src/sys/sys/tesla-kernel.h#8 edit

Differences ...

==== //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_class.c#9 (text+ko) ====

@@ -151,7 +151,7 @@
 		return (TESLA_SUCCESS);
 	}
 
-	tesla_assert(0 && ("no free instances but tc_free was > 0"));
+	tesla_assert(0, ("no free instances but tc_free was > 0"));
 	return (TESLA_ERROR_ENOMEM);
 }
 

==== //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_debug.c#7 (text+ko) ====

@@ -41,7 +41,7 @@
 #endif
 
 void
-print_transition(const char *debug, const struct tesla_transition *t)
+print_transition(__debug const char *debug, const struct tesla_transition *t)
 {
 	if (!tesla_debugging(debug))
 		return;
@@ -79,7 +79,8 @@
 }
 
 void
-print_transitions(const char *debug, const struct tesla_transitions *transp)
+print_transitions(__debug const char *debug,
+	const struct tesla_transitions *transp)
 {
 	if (!tesla_debugging(debug))
 		return;
@@ -126,11 +127,13 @@
 	return c;
 }
 
-#ifndef NDEBUG
 
 int32_t
 tesla_debugging(const char *name)
 {
+#ifdef NDEBUG
+	return 0;
+#endif
 #ifdef _KERNEL
 	/*
 	 * In the kernel, only print 'libtesla.{event,instance}*' output.
@@ -188,6 +191,7 @@
 #endif
 }
 
+#ifndef NDEBUG
 void
 assert_instanceof(struct tesla_instance *instance, struct tesla_class *tclass)
 {
@@ -204,10 +208,12 @@
 
 	tesla_assert(instance_belongs_to_class,
 		("tesla_instance %x not of class '%s'",
-		 instance, tclass->tc_name)
+		 instance, tclass->tc_automaton->ta_name)
 	       );
 }
 
+#endif
+
 void
 print_class(const struct tesla_class *c)
 {
@@ -242,7 +248,7 @@
 }
 
 void
-print_key(const char *debug_name, const struct tesla_key *key)
+print_key(__debug const char *debug_name, const struct tesla_key *key)
 {
 	if (!tesla_debugging(debug_name))
 		return;
@@ -251,17 +257,8 @@
 	char buffer[LEN];
 	char *end = buffer + LEN;
 
-	char *e = key_string(buffer, end, key);
+	__unused char *e = key_string(buffer, end, key);
 	assert(e < end);
 
 	print("%s", buffer);
 }
-
-#else
-
-#undef tesla_debugging
-int32_t
-tesla_debugging(const char *name) { return 0; }
-
-#endif /* !NDEBUG */
-

==== //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_dtrace.c#10 (text+ko) ====

@@ -40,25 +40,30 @@
 
 SDT_PROBE_DEFINE2(tesla, automata, instance, create, create,
     "struct tesla_class *", "struct tesla_instance *");
+
 SDT_PROBE_DEFINE3(tesla, automata, event, transition, state-transition,
     "struct tesla_class *", "struct tesla_instance *",
     "struct tesla_transition *");
+
 SDT_PROBE_DEFINE4(tesla, automata, instance, clone, clone,
     "struct tesla_class *", "struct tesla_instance *",
     "struct tesla_instance *", "struct tesla_transition *");
+
 SDT_PROBE_DEFINE4(tesla, automata, fail, no_instance, no-instance-match,
-    "struct tesla_class *", "const char *", "const char *",
-    "struct tesla_transitions *");
+    "struct tesla_class *", "const char *", "const char *", "int32_t");
+
 SDT_PROBE_DEFINE3(tesla, automata, fail, bad_transition, bad-transition,
-    "struct tesla_class *", "struct tesla_instance *",
-    "struct tesla_transitions *");
-SDT_PROBE_DEFINE3(tesla, automata, fail, other_err, other-error,
-    "struct tesla_class *", "int", "const char *");
+    "struct tesla_class *", "struct tesla_instance *", "int32_t");
+
+SDT_PROBE_DEFINE4(tesla, automata, fail, other_err, other-error,
+    "struct tesla_automaton *", "int32_t", "int32_t", "const char *");
+
 SDT_PROBE_DEFINE2(tesla, automata, success, accept, accept,
     "struct tesla_class *", "struct tesla_instance *");
+
 SDT_PROBE_DEFINE3(tesla, automata, event, ignored, ignored-event,
-    "struct tesla_class *", "struct tesla_key *",
-    "struct tesla_transitions *");
+    "struct tesla_class *", "int32_t", "struct tesla_key *");
+
 
 static void
 new_instance(struct tesla_class *tcp, struct tesla_instance *tip)
@@ -84,8 +89,8 @@
 }
 
 static void
-no_instance(struct tesla_class *tcp, const struct tesla_key *tkp,
-    const struct tesla_transitions *ttp)
+no_instance(struct tesla_class *tcp, int32_t symbol,
+	    const struct tesla_key *tkp)
 {
 	char instbuf[200];
 	char *c = instbuf;
@@ -108,22 +113,25 @@
 	key_string(keybuf, keybuf + sizeof(keybuf), tkp);
 
 	SDT_PROBE(tesla, automata, fail, no_instance,
-		tcp, instbuf, keybuf, ttp, 0);
+		tcp, instbuf, keybuf, symbol, 0);
 }
 
 static void
 bad_transition(struct tesla_class *tcp, struct tesla_instance *tip,
-    const struct tesla_transitions *ttp)
+    int32_t symbol)
 {
 
-	SDT_PROBE(tesla, automata, fail, bad_transition, tcp, tip, ttp, 0, 0);
+	SDT_PROBE(tesla, automata, fail, bad_transition,
+		tcp, tip, symbol, 0, 0);
 }
 
 static void
-err(struct tesla_class *tcp, int errno, const char *message)
+err(const struct tesla_automaton * tcp, int32_t symbol, int32_t errno,
+    const char *message)
 {
 
-	SDT_PROBE(tesla, automata, fail, other_err, tcp, errno, message, 0, 0);
+	SDT_PROBE(tesla, automata, fail, other_err,
+		tcp, symbol, errno, message, 0);
 }
 
 static void
@@ -134,11 +142,11 @@
 }
 
 static void
-ignored(const struct tesla_class *tcp, const struct tesla_key *tkp,
-    const struct tesla_transitions *ttp)
+ignored(const struct tesla_class *tcp,
+	    int32_t symbol, const struct tesla_key *tkp)
 {
 
-	SDT_PROBE(tesla, automata, event, ignored, tcp, tkp, ttp, 0, 0);
+	SDT_PROBE(tesla, automata, event, ignored, tcp, symbol, tkp, 0, 0);
 }
 
 const struct tesla_event_handlers dtrace_handlers = {

==== //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_internal.h#13 (text+ko) ====

@@ -372,14 +372,14 @@
 #include <stdio.h>
 #endif
 
+
+/** Are we in (verbose) debug mode? */
+int32_t	tesla_debugging(const char*);
+
 #ifndef NDEBUG
 
 #define __debug
 
-
-/** Are we in (verbose) debug mode? */
-int32_t	tesla_debugging(const char*);
-
 /** Emit debugging information with a debug name (e.g., libtesla.event). */
 #define DEBUG(dclass, ...) \
 	if (tesla_debugging(#dclass)) printf(__VA_ARGS__)
@@ -390,9 +390,6 @@
 #define __debug __unused
 
 #define DEBUG(...)
-#define tesla_debugging(...) 0
-#define print_key(...)
-#define print_class(...)
 
 #endif
 

==== //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_notification.c#17 (text+ko) ====

@@ -182,6 +182,7 @@
 }
 
 
+#ifndef NDEBUG
 /*
  * printf()-based event handlers:
  */
@@ -332,6 +333,7 @@
 	.teh_accept		= 0,
 	.teh_ignored		= 0,
 };
+#endif
 
 /*
  * Wrappers that panic on failure:
@@ -385,8 +387,8 @@
 const static struct tesla_event_handlers* const default_handlers[] = {
 #ifndef NDEBUG
 	&printf_handlers,
+	&printf_on_failure,
 #endif
-	&printf_on_failure,
 #if defined(_KERNEL) && defined(KDTRACE_HOOKS)
 	&dtrace_handlers,
 #endif
@@ -398,7 +400,7 @@
 #if defined(_KERNEL) && defined(KDTRACE_HOOKS)
 	.tem_mask = TESLA_KERN_DTRACE_EV,
 #else
-	.tem_mask = 0x5,
+	.tem_mask = 0xFF,
 #endif
 	.tem_handlers = default_handlers,
 };

==== //depot/projects/ctsrd/tesla/src/sys/sys/tesla-kernel.h#8 (text+ko) ====

@@ -43,7 +43,8 @@
  * FreeBSD kernel-specific TESLA macros.
  */
 
-#define	incallstack(fn)	TSEQUENCE(called(fn), TESLA_ASSERTION_SITE, returned(fn))
+#define	incallstack(fn)	\
+	TSEQUENCE(called(fn), TESLA_ASSERTION_SITE, returnfrom(fn))
 
 #if 0
 /* XXXRW: This doesn't yet work. */
@@ -66,6 +67,11 @@
 #define	TESLA_SYSCALL_EVENTUALLY(x)	TESLA_SYSCALL(eventually(x))
 
 /*
+ * XXXJA: figure out which of call()/called() to keep
+ */
+#define	called(...)		__tesla_call(((void) __VA_ARGS__, TIGNORE))
+
+/*
  * XXXRW: Not all architectures have a trap_pfault() function.  Can't use
  * vm_fault() as it is used in non-trap contexts -- e.g., PMAP initialisation.
  */


More information about the p4-projects mailing list