[kernel] Move definition of DLOG_KERNEL_OOPS to debug.h
Move the definition of DLOG_KERNEL_OOPS to debug.h so that it's closer
to panic() and rename to KERNEL_OOPS.
Add comment for KERNEL_OOPS to clarify that an OOPS does not
necessarily indidate the fault lies with the kernel.
Change-Id: I9fcf406b8bc7720f19edb024095beb76836896d0
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/396903
Reviewed-by: Corey Tabaka <eieio@google.com>
Reviewed-by: John Grossman <johngro@google.com>
Reviewed-by: Travis Geiselbrecht <travisg@google.com>
Testability-Review: Corey Tabaka <eieio@google.com>
Commit-Queue: Nick Maniscalco <maniscalco@google.com>
diff --git a/zircon/kernel/include/debug.h b/zircon/kernel/include/debug.h
index bba1d63..f92d29d 100644
--- a/zircon/kernel/include/debug.h
+++ b/zircon/kernel/include/debug.h
@@ -55,6 +55,15 @@
/* spin the cpu for a certain number of cpu cycles */
void spin_cycles(uint32_t usecs);
+// A printf-like macro which prepend's the user's message with the special
+// "ZIRCON KERNEL OOPS" tag. zbi_test bots look for tags like this and consider
+// their presence to indicate test failures, even if the higher level test
+// framework code thinks the test passed.
+//
+// A KERNEL_OOPS indicates the presence of a bug, however, the bug may not be in
+// the kernel itself.
+#define KERNEL_OOPS(fmt, ...) printf("\nZIRCON KERNEL OOPS\n" fmt, ##__VA_ARGS__)
+
__END_CDECLS
#endif // ZIRCON_KERNEL_INCLUDE_DEBUG_H_
diff --git a/zircon/kernel/lib/debuglog/include/lib/debuglog.h b/zircon/kernel/lib/debuglog/include/lib/debuglog.h
index a2a80d7..8dc7225 100644
--- a/zircon/kernel/lib/debuglog/include/lib/debuglog.h
+++ b/zircon/kernel/lib/debuglog/include/lib/debuglog.h
@@ -123,10 +123,4 @@
void dlog_bypass_init(void);
bool dlog_bypass(void);
-// A printf-like macro which prepend's the user's message with the special
-// "ZIRCON KERNEL OOPS" tag. zbi_test bots look for tags like this and consider
-// their presence to indicate test failures, even if the higher level test
-// framework code thinks the test passed.
-#define DLOG_KERNEL_OOPS(fmt, ...) printf("\nZIRCON KERNEL OOPS\n" fmt, ##__VA_ARGS__)
-
#endif // ZIRCON_KERNEL_LIB_DEBUGLOG_INCLUDE_LIB_DEBUGLOG_H_
diff --git a/zircon/kernel/lib/lockdep/BUILD.zircon.gn b/zircon/kernel/lib/lockdep/BUILD.zircon.gn
index a7b0e96..ace321d 100644
--- a/zircon/kernel/lib/lockdep/BUILD.zircon.gn
+++ b/zircon/kernel/lib/lockdep/BUILD.zircon.gn
@@ -8,7 +8,6 @@
sources = [ "lock_dep.cc" ]
deps = [
"$zx/kernel/lib/console",
- "$zx/kernel/lib/debuglog",
"$zx/kernel/lib/init",
"$zx/kernel/lib/ktl",
]
diff --git a/zircon/kernel/lib/lockdep/lock_dep.cc b/zircon/kernel/lib/lockdep/lock_dep.cc
index e157600..a56b2633 100644
--- a/zircon/kernel/lib/lockdep/lock_dep.cc
+++ b/zircon/kernel/lib/lockdep/lock_dep.cc
@@ -7,7 +7,6 @@
#include <debug.h>
#include <inttypes.h>
#include <lib/console.h>
-#include <lib/debuglog.h>
#include <string.h>
#include <new>
@@ -138,9 +137,8 @@
const uint64_t user_pid = current_thread->user_pid();
const uint64_t user_tid = current_thread->user_tid();
- DLOG_KERNEL_OOPS("Lock validation failed for thread %p pid %" PRIu64 " tid %" PRIu64
- " (%s:%s):\n",
- current_thread, user_pid, user_tid, owner_name, current_thread->name());
+ KERNEL_OOPS("Lock validation failed for thread %p pid %" PRIu64 " tid %" PRIu64 " (%s:%s):\n",
+ current_thread, user_pid, user_tid, owner_name, current_thread->name());
printf("Reason: %s\n", ToString(result));
printf("Bad lock: name=%s order=%" PRIu64 "\n", LockClassState::GetName(bad_entry->id()),
bad_entry->order());
@@ -161,7 +159,7 @@
// Prints a kernel oops when a circular lock dependency is detected.
void SystemCircularLockDependencyDetected(LockClassState* connected_set_root) {
- DLOG_KERNEL_OOPS("Circular lock dependency detected:\n");
+ KERNEL_OOPS("Circular lock dependency detected:\n");
for (auto& node : lockdep::LockClassState::Iter()) {
if (node.connected_set() == connected_set_root)
diff --git a/zircon/kernel/object/bus_transaction_initiator_dispatcher.cc b/zircon/kernel/object/bus_transaction_initiator_dispatcher.cc
index 3c48faa..bd99436 100644
--- a/zircon/kernel/object/bus_transaction_initiator_dispatcher.cc
+++ b/zircon/kernel/object/bus_transaction_initiator_dispatcher.cc
@@ -148,6 +148,6 @@
num_entries++;
}
- DLOG_KERNEL_OOPS("Bus Transaction Initiator 0x%lx has leaked %" PRIu64 " pages in %zu VMOs\n",
- bti_id_, leaked_pages, num_entries);
+ KERNEL_OOPS("Bus Transaction Initiator 0x%lx has leaked %" PRIu64 " pages in %zu VMOs\n", bti_id_,
+ leaked_pages, num_entries);
}