Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern pmf(9): Conditionalize pmflock_debug output on PMFL...



details:   https://anonhg.NetBSD.org/src/rev/2369509b45c9
branches:  trunk
changeset: 359898:2369509b45c9
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Jan 29 20:35:11 2022 +0000

description:
pmf(9): Conditionalize pmflock_debug output on PMFLOCK_DEBUG.

This is really only helpful for debugging the software logic to
handle the trees of devices for suspend/resume, not for debugging the
drivers, which is most of what we need to do.  If anyone still finds
this useful they can make a sysctl knob for it or something, but for
now this substantially reduces the amount of debug output that's
getting in my way.

diffstat:

 sys/kern/subr_autoconf.c |  23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diffs (55 lines):

diff -r ba898374433d -r 2369509b45c9 sys/kern/subr_autoconf.c
--- a/sys/kern/subr_autoconf.c  Sat Jan 29 16:01:16 2022 +0000
+++ b/sys/kern/subr_autoconf.c  Sat Jan 29 20:35:11 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.291 2021/12/31 14:19:57 riastradh Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.292 2022/01/29 20:35:11 riastradh Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.291 2021/12/31 14:19:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.292 2022/01/29 20:35:11 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -2939,15 +2939,6 @@
        return true;
 }
 
-static const char *
-curlwp_name(void)
-{
-       if (curlwp->l_name != NULL)
-               return curlwp->l_name;
-       else
-               return curlwp->l_proc->p_comm;
-}
-
 void
 device_pmf_driver_deregister(device_t dev)
 {
@@ -2992,11 +2983,19 @@
 static void
 pmflock_debug(device_t dev, const char *func, int line)
 {
+#ifdef PMFLOCK_DEBUG
        device_lock_t dvl = device_getlock(dev);
+       const char *curlwp_name;
+
+       if (curlwp->l_name != NULL)
+               curlwp_name = curlwp->l_name;
+       else
+               curlwp_name = curlwp->l_proc->p_comm;
 
        aprint_debug_dev(dev,
            "%s.%d, %s dvl_nlock %d dvl_nwait %d dv_flags %x\n", func, line,
-           curlwp_name(), dvl->dvl_nlock, dvl->dvl_nwait, dev->dv_flags);
+           curlwp_name, dvl->dvl_nlock, dvl->dvl_nwait, dev->dv_flags);
+#endif /* PMFLOCK_DEBUG */
 }
 
 static bool



Home | Main Index | Thread Index | Old Index