Date: Thu, 17 Mar 2016 01:05:53 +0000 (UTC) From: "Conrad E. Meyer" <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r296973 - in head/sys: kern sys Message-ID: <201603170105.u2H15rck092019@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cem Date: Thu Mar 17 01:05:53 2016 New Revision: 296973 URL: https://svnweb.freebsd.org/changeset/base/296973 Log: fail(9): Only gather/print stacks if STACK is enabled This is a follow-up fix to the earlier r296927. Reported by: bz Sponsored by: EMC / Isilon Storage Division Modified: head/sys/kern/kern_fail.c head/sys/kern/subr_sleepqueue.c head/sys/sys/sleepqueue.h Modified: head/sys/kern/kern_fail.c ============================================================================== --- head/sys/kern/kern_fail.c Thu Mar 17 01:02:34 2016 (r296972) +++ head/sys/kern/kern_fail.c Thu Mar 17 01:05:53 2016 (r296973) @@ -52,6 +52,8 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_stack.h" + #include <sys/ctype.h> #include <sys/errno.h> #include <sys/fail.h> @@ -708,6 +710,7 @@ fail_point_get(struct fail_point *fp, st fp_free(fp_entry_cpy); if (verbose) { +#ifdef STACK /* Print number of sleeping threads. queue=0 is the argument * used by msleep when sending our threads to sleep. */ sbuf_printf(sb, "\nsleeping_thread_stacks = {\n"); @@ -715,14 +718,17 @@ fail_point_get(struct fail_point *fp, st &cnt_sleeping); sbuf_printf(sb, "},\n"); +#endif sbuf_printf(sb, "sleeping_thread_count = %d,\n", cnt_sleeping); +#ifdef STACK sbuf_printf(sb, "paused_thread_stacks = {\n"); sleepq_sbuf_print_stacks(sb, FP_PAUSE_CHANNEL(fp), 0, &cnt_sleeping); sbuf_printf(sb, "},\n"); +#endif sbuf_printf(sb, "paused_thread_count = %d\n", cnt_sleeping); } Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Thu Mar 17 01:02:34 2016 (r296972) +++ head/sys/kern/subr_sleepqueue.c Thu Mar 17 01:05:53 2016 (r296973) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include "opt_sleepqueue_profiling.h" #include "opt_ddb.h" #include "opt_sched.h" +#include "opt_stack.h" #include <sys/param.h> #include <sys/systm.h> @@ -1042,6 +1043,7 @@ sleepq_abort(struct thread *td, int intr * printed. Typically, this will equal the number of threads sleeping on the * queue, but may be less if sb overflowed before all stacks were printed. */ +#ifdef STACK int sleepq_sbuf_print_stacks(struct sbuf *sb, void *wchan, int queue, int *count_stacks_printed) @@ -1149,6 +1151,7 @@ loop_end: return (error); } +#endif #ifdef SLEEPQUEUE_PROFILING #define SLEEPQ_PROF_LOCATIONS 1024 Modified: head/sys/sys/sleepqueue.h ============================================================================== --- head/sys/sys/sleepqueue.h Thu Mar 17 01:02:34 2016 (r296972) +++ head/sys/sys/sleepqueue.h Thu Mar 17 01:05:53 2016 (r296973) @@ -107,9 +107,11 @@ int sleepq_type(void *wchan); void sleepq_wait(void *wchan, int pri); int sleepq_wait_sig(void *wchan, int pri); -#include <sys/sbuf.h> +#ifdef STACK +struct sbuf; int sleepq_sbuf_print_stacks(struct sbuf *sb, void *wchan, int queue, int *count_stacks_printed); +#endif #endif /* _KERNEL */ #endif /* !_SYS_SLEEPQUEUE_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603170105.u2H15rck092019>