[Skiboot] [PATCH RFC v2 00/12] opal-prd updates for p9
Daniel M Crowell
dcrowell at us.ibm.com
Wed Jun 7 01:55:41 AEST 2017
We can decode the assert line with our symbols. I suspect the traces
might have clues too. I assume you are using a custom op-build though?
--
Dan Crowell
Senior Software Engineer - Power Systems Enablement Firmware
IBM Rochester: t/l 553-2987
dcrowell at us.ibm.com
From: Stewart Smith <stewart at linux.vnet.ibm.com>
To: Daniel M Crowell/Rochester/IBM at IBMUS
Cc: Jeremy Kerr <jk at ozlabs.org>, skiboot at lists.ozlabs.org, William G
Hoffa/Rochester/IBM at IBMUS
Date: 06/06/2017 03:56 AM
Subject: Re: [Skiboot] [PATCH RFC v2 00/12] opal-prd updates for p9
Daniel M Crowell <dcrowell at us.ibm.com> writes:
> I thought things were working now so that is new news to me.
weirdly, if I build a statically linked opal-prd, it does work... well,
fails somewhere deeper in HBRT with:
HBRT: Assertion failed @0x3fffa6f60e2c on line 96.
Which isn't so clear...
Here's a (completely untested) patch that would make the assert notice
from HB/HBRT also include source file name and line number. Feel free to
grab/try or I could probably clean it up a bit and submit upstream if
that'd help.
diff --git a/src/include/assert.h b/src/include/assert.h
index c3f7ea0c4b1d..39372b928bc0 100644
--- a/src/include/assert.h
+++ b/src/include/assert.h
@@ -93,7 +93,11 @@ enum AssertBehavior
* user-space dispatching.
*/
NO_RETURN
-void __assert(AssertBehavior i_assertb, int i_line);
+void __assert(AssertBehavior i_assertb, int i_line, const char *msg);
+
+#define stringify(expr) stringify_1(expr)
+/* Double-indirection required to stringify expansions */
+#define stringify_1(expr) #expr
#ifdef __HOSTBOOT_MODULE // Only allow traced assert in module code.
@@ -132,7 +136,8 @@ void __assert(AssertBehavior i_assertb, int i_line);
__ASSERT_DO_TRACE(expr, __VA_ARGS__); \
__assert((__ASSERT_HAS_TRACE(__VA_ARGS__) ? \
ASSERT_TRACE_DONE : ASSERT_TRACE_NOTDONE),\
- __LINE__);\
+ __LINE__,
+ __FILE__ ":" stringify(__LINE__) ":"
stringify(expr));\
}\
}
@@ -147,7 +152,7 @@ void __assert(AssertBehavior i_assertb, int i_line);
{\
if (unlikely(!(expr)))\
{\
- __assert(ASSERT_KERNEL, __LINE__);\
+ __assert(ASSERT_KERNEL, __LINE__, __FILE__ ":"
stringify(__LINE__) ":" stringify(expr));\
}\
}
diff --git a/src/lib/assert.C b/src/lib/assert.C
index 953393c314f5..fe48a8ee290f 100644
--- a/src/lib/assert.C
+++ b/src/lib/assert.C
@@ -41,7 +41,7 @@
/** Hook location for trace module to set up when loaded. */
namespace TRACE { void (*traceCallback)(void*, size_t) = NULL; };
-extern "C" void __assert(AssertBehavior i_assertb, int i_line)
+extern "C" void __assert(AssertBehavior i_assertb, int i_line, const char
*msg)
{
if ((i_assertb == ASSERT_CRITICAL) && (KernelMisc::in_kernel_mode()))
{
@@ -61,23 +61,23 @@ extern "C" void __assert(AssertBehavior i_assertb, int
i_line)
}
else
{
- printk("Assertion failed @%p on line %d.\n",
- linkRegister(), i_line);
+ printk("Assertion failed @%p: %s\n",
+ linkRegister(), msg);
}
task_crash();
break;
case ASSERT_CRITICAL: // Critical task, trace not available.
- printk("Assertion failed @%p on line %d.(Crit_Assert)\n",
- linkRegister(), i_line);
+ printk("Assertion failed @%p (Crit_Assert): %s\n",
+ linkRegister(), msg);
// Need to call the external CritAssert system call
cpu_crit_assert(reinterpret_cast<uint64_t>(linkRegister()));
break;
case ASSERT_KERNEL: // Kernel assert called.
- printk("Assertion failed @%p on line %d. (kassert)\n",
- linkRegister(), i_line);
+ printk("Assertion failed @%p (kassert): %s\n",
+ linkRegister(), msg);
/*@
* @errortype
diff --git a/src/runtime/rt_assert.C b/src/runtime/rt_assert.C
index a22fe461a10f..4e8a787b4a70 100644
--- a/src/runtime/rt_assert.C
+++ b/src/runtime/rt_assert.C
@@ -28,12 +28,13 @@
/** Hook location for trace module to set up when loaded. */
namespace TRACE { void (*traceCallback)(void*, size_t) = NULL; };
-extern "C" void __assert(AssertBehavior i_assertb, int i_line)
+extern "C" void __assert(AssertBehavior i_assertb, int i_line, const char
*msg)
{
+ (void)i_line;
if (i_assertb != ASSERT_TRACE_DONE)
{
- printk("Assertion failed @%p on line %d.\n",
- linkRegister(), i_line);
+ printk("Assertion failed @%p: %s.\n",
+ linkRegister(), msg);
}
g_hostInterfaces->assert();
--
Stewart Smith
OPAL Architect, IBM.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/skiboot/attachments/20170606/500aaf20/attachment-0001.html>
More information about the Skiboot
mailing list