Source-Changes-HG archive

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

[src/trunk]: src/sys/ddb Switch from kmem_intr_alloc(sz, KM_NOSLEEP) to kmem_...



details:   https://anonhg.NetBSD.org/src/rev/5349f7da3fb6
branches:  trunk
changeset: 1010666:5349f7da3fb6
user:      rin <rin%NetBSD.org@localhost>
date:      Sun May 31 23:34:34 2020 +0000

description:
Switch from kmem_intr_alloc(sz, KM_NOSLEEP) to kmem_alloc(sz, KM_SLEEP).

Clearly document these functions are *not* for DDB session, but for
permanent data storage when initializing DDB.

diffstat:

 sys/ddb/db_kernel.c |  21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diffs (58 lines):

diff -r 56a42060bf28 -r 5349f7da3fb6 sys/ddb/db_kernel.c
--- a/sys/ddb/db_kernel.c       Sun May 31 23:24:23 2020 +0000
+++ b/sys/ddb/db_kernel.c       Sun May 31 23:34:34 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_kernel.c,v 1.3 2020/05/31 09:42:46 rin Exp $        */
+/*     $NetBSD: db_kernel.c,v 1.4 2020/05/31 23:34:34 rin Exp $        */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_kernel.c,v 1.3 2020/05/31 09:42:46 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_kernel.c,v 1.4 2020/05/31 23:34:34 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
@@ -39,28 +39,33 @@
 
 /*
  * XXX
- * DDB can be running in the interrupt context, e.g., when activated from
- * console. Therefore, we use kmem_intr_alloc(9) and friends here to avoid
- * assertion failure.
+ * These routines are *not* intended for a DDB session:
+ *
+ * - It disturbes on-going debugged kernel datastructures.
+ *
+ * - DDB can be running in the interrupt context, e.g., when activated from
+ *   console. This results in assertion failures in the allocator.
+ *
+ * Use these only for permanent data storage when initializing DDB.
  */
 
 void *
 db_alloc(size_t sz)
 {
 
-       return kmem_intr_alloc(sz, KM_NOSLEEP);
+       return kmem_alloc(sz, KM_SLEEP);
 }
 
 void *
 db_zalloc(size_t sz)
 {
 
-       return kmem_intr_zalloc(sz, KM_NOSLEEP);
+       return kmem_zalloc(sz, KM_SLEEP);
 }
 
 void
 db_free(void *p, size_t sz)
 {
 
-       kmem_intr_free(p, sz);
+       kmem_free(p, sz);
 }



Home | Main Index | Thread Index | Old Index