From patchwork Wed Mar 8 17:46:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Lagerwall X-Patchwork-Id: 9611745 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 AC9A9602B4 for ; Wed, 8 Mar 2017 17:50:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B54C28618 for ; Wed, 8 Mar 2017 17:50:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 902B02862D; Wed, 8 Mar 2017 17:50:20 +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 7B74A28618 for ; Wed, 8 Mar 2017 17:50:19 +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-0004p4-Ky; 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 1clfhE-0004ns-0B for xen-devel@lists.xen.org; Wed, 08 Mar 2017 17:48:20 +0000 Received: from [85.158.143.35] by server-7.bemta-6.messagelabs.com id 3A/37-04817-3E340C85; Wed, 08 Mar 2017 17:48:19 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphkeJIrShJLcpLzFFi42JxWrohUveR84E Ig21fjS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oy3T3+xFkwTrTjTdI+tgbGRp4uRk0NCwF/i wZv5LCA2m4CBxK1L35lBbBEBdYnTHRdZQWxmgWqJAwv7GEFsYYFQid3XL4LVswioSHStvccEY vMKeEi0H53DBjFTTuLmuU6wOZwCnhILG6cD2RwcQkA1LQ/MQcJCAmoSb5efYYFoFZQ4OfMJC8 QqCYmDL14wT2DknYUkNQtJagEj0ypGjeLUorLUIl0jY72kosz0jJLcxMwcXUMDM73c1OLixPT UnMSkYr3k/NxNjMDQYQCCHYx/5gceYpTkYFIS5b2qeiBCiC8pP6UyI7E4I76oNCe1+BCjDAeH kgSvpRNQTrAoNT21Ii0zBxjEMGkJDh4lEd5kkDRvcUFibnFmOkTqFKOilDhvPEhCACSRUZoH1 waLnEuMslLCvIxAhwjxFKQW5WaWoMq/YhTnYFQS5l0NMoUnM68EbvoroMVMQIu1XfeCLC5JRE hJNTDay1veT7demC2Yazr5EteZrckxMvmKGVbPUxJ/f98tZt3jEr0rYca1U+W9aTe6nXX6Vxa c/Wl91NLh9TxhM5Ydh7s+ey//Z2HLNmX9AUWXg6dkZweLLjr+676Daua/uR0BO0p+s2xnmczn 8m7jwzy3cJbUiZPWH1NmvXbK5q0h40WXYsWNW7OUWIozEg21mIuKEwH6fJ+hlwIAAA== X-Env-Sender: prvs=233b396aa=ross.lagerwall@citrix.com X-Msg-Ref: server-15.tower-21.messagelabs.com!1488995294!61207479!3 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 4163 invoked from network); 8 Mar 2017 17:48:18 -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:18 -0000 X-IronPort-AV: E=Sophos;i="5.36,265,1486425600"; d="scan'208";a="412403704" From: Ross Lagerwall To: Xen-devel Date: Wed, 8 Mar 2017 17:46:54 +0000 Message-ID: <1488995215-7647-6-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 , Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH v2 5/6] x86_emulate: 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/x86/x86_emulate/x86_emulate.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index 613648e..cf05544 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -776,6 +776,22 @@ do{ asm volatile ( \ #define __emulate_1op_8byte(_op, _dst, _eflags) #endif /* __i386__ */ +#if defined(NDEBUG) && defined(CONFIG_LIVEPATCH) +#define invoke_stub_exception(trapnr, ec) \ + do { \ + gprintk(XENLOG_WARNING, \ + "exception %u (ec=%04x) in emulation stub (address %pS)\n", \ + trapnr, ec, current_text_addr()); \ + } while (0) +#else +#define invoke_stub_exception(trapnr, ec) \ + do { \ + gprintk(XENLOG_WARNING, \ + "exception %u (ec=%04x) in emulation stub (line %u)\n", \ + trapnr, ec, __LINE__); \ + } while (0) +#endif + #ifdef __XEN__ # define invoke_stub(pre, post, constraints...) do { \ union stub_exception_token res_ = { .raw = ~0 }; \ @@ -791,9 +807,7 @@ do{ asm volatile ( \ [stub] "rm" (stub.func) ); \ if ( unlikely(~res_.raw) ) \ { \ - gprintk(XENLOG_WARNING, \ - "exception %u (ec=%04x) in emulation stub (line %u)\n", \ - res_.fields.trapnr, res_.fields.ec, __LINE__); \ + invoke_stub_exception(res_.fields.trapnr, res_.fields.ec); \ gprintk(XENLOG_INFO, "stub: %"__stringify(MAX_INST_LEN)"ph\n", \ stub.func); \ generate_exception_if(res_.fields.trapnr == EXC_UD, EXC_UD); \