svn commit: r310788 - stable/11/sys/x86/x86

Mark Johnston markj at FreeBSD.org
Thu Dec 29 21:06:33 UTC 2016


Author: markj
Date: Thu Dec 29 21:06:31 2016
New Revision: 310788
URL: https://svnweb.freebsd.org/changeset/base/310788

Log:
  MFC r309657:
  Require the STACK option for code that captures stacks of running threads.

Modified:
  stable/11/sys/x86/x86/stack_machdep.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/x86/x86/stack_machdep.c
==============================================================================
--- stable/11/sys/x86/x86/stack_machdep.c	Thu Dec 29 21:03:00 2016	(r310787)
+++ stable/11/sys/x86/x86/stack_machdep.c	Thu Dec 29 21:06:31 2016	(r310788)
@@ -28,6 +28,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include "opt_stack.h"
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -59,6 +61,7 @@ typedef struct i386_frame *x86_frame_t;
 typedef struct amd64_frame *x86_frame_t;
 #endif
 
+#ifdef STACK
 static struct stack *nmi_stack;
 static volatile struct thread *nmi_pending;
 
@@ -66,6 +69,7 @@ static volatile struct thread *nmi_pendi
 static struct mtx nmi_lock;
 MTX_SYSINIT(nmi_lock, &nmi_lock, "stack_nmi", MTX_SPIN);
 #endif
+#endif
 
 static void
 stack_capture(struct thread *td, struct stack *st, register_t fp)
@@ -95,6 +99,7 @@ int
 stack_nmi_handler(struct trapframe *tf)
 {
 
+#ifdef STACK
 	/* Don't consume an NMI that wasn't meant for us. */
 	if (nmi_stack == NULL || curthread != nmi_pending)
 		return (0);
@@ -107,6 +112,9 @@ stack_nmi_handler(struct trapframe *tf)
 
 	atomic_store_rel_ptr((long *)&nmi_pending, (long)NULL);
 	return (1);
+#else
+	return (0);
+#endif
 }
 
 void
@@ -125,6 +133,7 @@ int
 stack_save_td_running(struct stack *st, struct thread *td)
 {
 
+#ifdef STACK
 	THREAD_LOCK_ASSERT(td, MA_OWNED);
 	MPASS(TD_IS_RUNNING(td));
 
@@ -148,10 +157,13 @@ stack_save_td_running(struct stack *st, 
 	if (st->depth == 0)
 		/* We interrupted a thread in user mode. */
 		return (EAGAIN);
-#else
+#else /* !SMP */
 	KASSERT(0, ("curthread isn't running"));
-#endif
+#endif /* SMP */
 	return (0);
+#else /* !STACK */
+	return (EOPNOTSUPP);
+#endif /* STACK */
 }
 
 void


More information about the svn-src-all mailing list