xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ross Lagerwall <ross.lagerwall@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Ross Lagerwall <ross.lagerwall@citrix.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v2 2/6] sched: Remove dependency on __LINE__ for release builds
Date: Wed, 8 Mar 2017 17:46:51 +0000	[thread overview]
Message-ID: <1488995215-7647-3-git-send-email-ross.lagerwall@citrix.com> (raw)
In-Reply-To: <1488995215-7647-1-git-send-email-ross.lagerwall@citrix.com>

When using LivePatch, use of __LINE__ can generate spurious changes in
functions due to embedded line numbers.  For release builds with
LivePatch enabled, 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>
---

Changes in v2:
* Simply macros.
* Use %pS.

 xen/include/xen/sched.h | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

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


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-03-08 17:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-08 17:46 [PATCH v2 0/6] Remove dependency on __LINE__ Ross Lagerwall
2017-03-08 17:46 ` [PATCH v2 1/6] lib: Add a generic implementation of current_text_addr() Ross Lagerwall
2017-03-09  8:52   ` Dario Faggioli
2017-03-09 10:29   ` Jan Beulich
2017-03-08 17:46 ` Ross Lagerwall [this message]
2017-03-09  9:03   ` [PATCH v2 2/6] sched: Remove dependency on __LINE__ for release builds Dario Faggioli
2017-03-08 17:46 ` [PATCH v2 3/6] mm: Use statically defined locking order Ross Lagerwall
2017-03-20 13:52   ` George Dunlap
2017-03-08 17:46 ` [PATCH v2 4/6] iommu: Remove dependency on __LINE__ for release builds Ross Lagerwall
2017-03-09 10:42   ` Jan Beulich
2017-03-15 10:07   ` Tian, Kevin
     [not found]   ` <5940F13702000000000EA4B6@prv-mh.provo.novell.com>
2017-12-07 11:00     ` Jan Beulich
2017-03-08 17:46 ` [PATCH v2 5/6] x86_emulate: " Ross Lagerwall
2017-03-09 10:45   ` Jan Beulich
2017-03-08 17:46 ` [PATCH v2 6/6] xen/arm: " Ross Lagerwall
2017-03-09 10:34 ` [PATCH v2 0/6] Remove dependency on __LINE__ Jan Beulich
2017-03-10  8:29   ` Ross Lagerwall
2017-03-10  8:50     ` Jan Beulich
2017-03-17  8:57       ` Ross Lagerwall
2017-03-17  9:10         ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1488995215-7647-3-git-send-email-ross.lagerwall@citrix.com \
    --to=ross.lagerwall@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).