From patchwork Wed Mar 8 17:46:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Lagerwall X-Patchwork-Id: 9611737 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 3CE5B602B4 for ; Wed, 8 Mar 2017 17:49:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28F4A28618 for ; Wed, 8 Mar 2017 17:49:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1AED628624; Wed, 8 Mar 2017 17:49:30 +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 74FD728618 for ; Wed, 8 Mar 2017 17:49:29 +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 1clfgM-0004Zz-OK; Wed, 08 Mar 2017 17:47:26 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clfgL-0004ZC-6Y for xen-devel@lists.xen.org; Wed, 08 Mar 2017 17:47:25 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id 22/0D-16497-CA340C85; Wed, 08 Mar 2017 17:47:24 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmkeJIrShJLcpLzFFi42JxWrrBXneN84E Ig6kPpS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ozJPzrZC7r4K87fWMHewHics4uRk0NCwF+i 7946dhCbTcBA4tal78wgtoiAusTpjousIDazQCOjxJR3il2MHBzCAoESnYu9QMIsAioSez8sY wOxeQU8JFZ/WsQIMVJO4ua5TrAxnAKeEgsbpzODtAoB1bQ8MAcJCwmoSbxdfoYFolVQ4uTMJy wQmyQkDr54wTyBkXcWktQsJKkFjEyrGDWKU4vKUot0DS31kooy0zNKchMzc3QNDUz1clOLixP TU3MSk4r1kvNzNzECA6eegYFxB+Ojfr9DjJIcTEqivG7L9kYI8SXlp1RmJBZnxBeV5qQWH2KU 4eBQkuDdsRUoJ1iUmp5akZaZAwxhmLQEB4+SCO+XLUBp3uKCxNzizHSI1ClGRSlxXj+QPgGQR EZpHlwbLG4uMcpKCfMyMjAwCPEUpBblZpagyr9iFOdgVBLmLQWZwpOZVwI3/RXQYiagxdquYI tLEhFSUg2MK2fqv7t+/XSmtsfGTIkevRt2l/0uKR9Ia0s8M7OlaObrNXWaVgede9NX1a4+t6P jrE1ebfLnTE2NC9urFhzNN14usGWa+C/2xrSTPwtXfDlftjFhZ3rGm+rAPhb2Jjtn9vWPHlz8 8fT5tz9uqXfWJuVP2Cb6v3rDxJ//jfeUP+t6tMfk1ZUjQkosxRmJhlrMRcWJAFrsmnSWAgAA X-Env-Sender: prvs=233b396aa=ross.lagerwall@citrix.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1488995240!86865657!3 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57382 invoked from network); 8 Mar 2017 17:47:24 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-5.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 8 Mar 2017 17:47:24 -0000 X-IronPort-AV: E=Sophos;i="5.36,265,1486425600"; d="scan'208";a="421279781" From: Ross Lagerwall To: Xen-devel Date: Wed, 8 Mar 2017 17:46:55 +0000 Message-ID: <1488995215-7647-7-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: Ross Lagerwall , Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH v2 6/6] xen/arm: 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 and print the current text address instead. Signed-off-by: Ross Lagerwall --- xen/arch/arm/traps.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 614501f..059afe7 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -82,14 +82,28 @@ static inline void check_stack_alignment_constraints(void) { * Compared with regular BUG_ON it dumps the guest vcpu state instead * of Xen's state. */ +#if defined(NDEBUG) && defined(CONFIG_LIVEPATCH) +#define guest_bug_on_failed(p) \ +do { \ + panic("Guest Bug: %pv: '%s', address %pS\n", \ + current, p, current_text_addr()); \ +} while (0) +#else #define guest_bug_on_failed(p) \ do { \ - show_execution_state(guest_cpu_user_regs()); \ panic("Guest Bug: %pv: '%s', line %d, file %s\n", \ current, p, __LINE__, __FILE__); \ } while (0) -#define GUEST_BUG_ON(p) \ - do { if ( unlikely(p) ) guest_bug_on_failed(#p); } while (0) +#endif + +#define GUEST_BUG_ON(p) \ +do { \ + if ( unlikely(p) ) \ + { \ + show_execution_state(guest_cpu_user_regs()); \ + guest_bug_on_failed(#p); \ + } \ +} while (0) #ifdef CONFIG_ARM_32 static int debug_stack_lines = 20;