diff mbox

[v1,2/7] sched: Remove dependency on __LINE__ for release builds

Message ID 1462549688-29263-3-git-send-email-ross.lagerwall@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ross Lagerwall May 6, 2016, 3:48 p.m. UTC
When using xsplice, use of __LINE__ can generate spurious changes in
functions due to embedded line numbers.  For release builds, remove the
use of these line numbers in domain_crash*() and print the current text
address instead.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 xen/include/xen/sched.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Jan Beulich May 10, 2016, 2:39 p.m. UTC | #1
>>> On 06.05.16 at 17:48, <ross.lagerwall@citrix.com> wrote:
> When using xsplice, use of __LINE__ can generate spurious changes in
> functions due to embedded line numbers.  For release builds, remove the
> use of these line numbers in domain_crash*() and print the current text
> address instead.

Which makes it more cumbersome to look up the origin. At the very
least ...

> --- a/xen/include/xen/sched.h
> +++ b/xen/include/xen/sched.h
> @@ -611,20 +611,34 @@ void vcpu_end_shutdown_deferral(struct vcpu *v);
>   * from any processor.
>   */
>  void __domain_crash(struct domain *d);
> +#ifdef NDEBUG

... should this imo become "defined(NDEBUG) &&
defined(CONFIG_XSPLICE)" then.

> +#define domain_crash(d) do {                                              \
> +    printk("domain_crash called from %p\n", current_text_addr());         \

And I'd really expect %ps or %pS to be used here.

> +    __domain_crash(d);                                                    \
> +} while (0)
> +#else
>  #define domain_crash(d) do {                                              \
>      printk("domain_crash called from %s:%d\n", __FILE__, __LINE__);       \
>      __domain_crash(d);                                                    \
>  } while (0)
> +#endif

Furthermore, considering this basically repeats ...

> +#ifdef NDEBUG
> +#define domain_crash_synchronous() do {                                   \
> +    printk("domain_crash_sync called from %p\n", current_text_addr());    \
> +    __domain_crash_synchronous();                                         \
> +} while (0)
> +#else
>  #define domain_crash_synchronous() do {                                   \
>      printk("domain_crash_sync called from %s:%d\n", __FILE__, __LINE__);  \
>      __domain_crash_synchronous();                                         \
>  } while (0)
> +#endif

... here, please limit the #ifdef-ery by abstracting just the
printk() invocation in a way that makes it possible to be used in
both places.

Jan
diff mbox

Patch

diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index fe15e9c..b282671 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -611,20 +611,34 @@  void vcpu_end_shutdown_deferral(struct vcpu *v);
  * from any processor.
  */
 void __domain_crash(struct domain *d);
+#ifdef NDEBUG
+#define domain_crash(d) do {                                              \
+    printk("domain_crash called from %p\n", current_text_addr());         \
+    __domain_crash(d);                                                    \
+} while (0)
+#else
 #define domain_crash(d) do {                                              \
     printk("domain_crash called from %s:%d\n", __FILE__, __LINE__);       \
     __domain_crash(d);                                                    \
 } while (0)
+#endif
 
 /*
  * Mark current domain as crashed and synchronously deschedule from the local
  * processor. This function never returns.
  */
 void noreturn __domain_crash_synchronous(void);
+#ifdef NDEBUG
+#define domain_crash_synchronous() do {                                   \
+    printk("domain_crash_sync called from %p\n", current_text_addr());    \
+    __domain_crash_synchronous();                                         \
+} while (0)
+#else
 #define domain_crash_synchronous() do {                                   \
     printk("domain_crash_sync called from %s:%d\n", __FILE__, __LINE__);  \
     __domain_crash_synchronous();                                         \
 } while (0)
+#endif
 
 /*
  * Called from assembly code, with an optional address to help indicate why