From patchwork Wed Mar 8 17:46:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Lagerwall X-Patchwork-Id: 9611747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DF57C602B4 for ; Wed, 8 Mar 2017 17:50:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE14928611 for ; Wed, 8 Mar 2017 17:50:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2B172861C; Wed, 8 Mar 2017 17:50:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7666C28611 for ; Wed, 8 Mar 2017 17:50:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clfhE-0004oA-8q; Wed, 08 Mar 2017 17:48:20 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clfhC-0004nF-QZ for xen-devel@lists.xen.org; Wed, 08 Mar 2017 17:48:18 +0000 Received: from [85.158.143.35] by server-4.bemta-6.messagelabs.com id D3/E9-25093-2E340C85; Wed, 08 Mar 2017 17:48:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmplkeJIrShJLcpLzFFi42JxWrohUveh84E Igx+P9C2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oxLT5rYC44LVvS33WJvYJzL08XIySEh4C8x 98JRNhCbTcBA4tal78wgtoiAusTpjousXYxcHMwCr5kkbrX8B0sIAzUcmDeDFcRmEVCR2DR3E hOIzSvgITHz219WiKFyEjfPdYLVcwp4SixsnA5kc3AIAdW0PDAHCQsJqEm8XX6GBaJVUOLkzC dgNrOAhMTBFy+YJzDyzkKSmoUktYCRaRWjRnFqUVlqka6RsV5SUWZ6RkluYmaOrqGBmV5uanF xYnpqTmJSsV5yfu4mRmDwMADBDsY/8wMPMUpyMCmJ8l5VPRAhxJeUn1KZkVicEV9UmpNafIhR hoNDSYLX0gkoJ1iUmp5akZaZAwxjmLQEB4+SCG8ySJq3uCAxtzgzHSJ1ilFRSpw3HiQhAJLIK M2Da4PFziVGWSlhXkagQ4R4ClKLcjNLUOVfMYpzMCoJ864GmcKTmVcCN/0V0GImoMXarntBFp ckIqSkGhgtbYwt9ykZnhKKORt0aVn14/WV4tNPiO0OP/l2VYeV1Y5zRZdef790Z0OK+Ym92zp Mepqyb9kKhFfa2G9eY7yMT8PDMPq1UHA8t2mfx9fS2cF6YnFvru2UCyi/ufS+/o/Y7trbU2dP PdCta/Pe6aJUpuJuudpLc7YK2dkyH4x9LdBo8l1fuFyJpTgj0VCLuag4EQA37kMXmAIAAA== X-Env-Sender: prvs=233b396aa=ross.lagerwall@citrix.com X-Msg-Ref: server-15.tower-21.messagelabs.com!1488995294!61207479!2 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 4032 invoked from network); 8 Mar 2017 17:48:17 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-15.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 8 Mar 2017 17:48:17 -0000 X-IronPort-AV: E=Sophos;i="5.36,265,1486425600"; d="scan'208";a="412403691" From: Ross Lagerwall To: Xen-devel Date: Wed, 8 Mar 2017 17:46:51 +0000 Message-ID: <1488995215-7647-3-git-send-email-ross.lagerwall@citrix.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488995215-7647-1-git-send-email-ross.lagerwall@citrix.com> References: <1488995215-7647-1-git-send-email-ross.lagerwall@citrix.com> MIME-Version: 1.0 Cc: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Ross Lagerwall , Jan Beulich Subject: [Xen-devel] [PATCH v2 2/6] sched: Remove dependency on __LINE__ for release builds X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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