From patchwork Tue Jul 13 01:59:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bobby Eshleman X-Patchwork-Id: 12372685 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEF8AC11F66 for ; Tue, 13 Jul 2021 02:01:00 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5CF0961002 for ; Tue, 13 Jul 2021 02:01:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CF0961002 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.154938.286163 (Exim 4.92) (envelope-from ) id 1m37j9-0001Om-RA; Tue, 13 Jul 2021 02:00:51 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 154938.286163; Tue, 13 Jul 2021 02:00:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m37j9-0001Od-NF; Tue, 13 Jul 2021 02:00:51 +0000 Received: by outflank-mailman (input) for mailman id 154938; Tue, 13 Jul 2021 02:00:50 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m37j8-000176-2X for xen-devel@lists.xenproject.org; Tue, 13 Jul 2021 02:00:50 +0000 Received: from mail-pf1-x42b.google.com (unknown [2607:f8b0:4864:20::42b]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f6e1a125-b99f-41b4-8694-e9fac392ad66; Tue, 13 Jul 2021 02:00:45 +0000 (UTC) Received: by mail-pf1-x42b.google.com with SMTP id j199so18136688pfd.7 for ; Mon, 12 Jul 2021 19:00:45 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:4c02:4c00::1]) by smtp.gmail.com with ESMTPSA id o20sm19285728pgv.80.2021.07.12.19.00.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 19:00:43 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: f6e1a125-b99f-41b4-8694-e9fac392ad66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Apyk2EsaQkKzjgWc1lHDgAWxDVjQnXEaCPOUVZyL41s=; b=uKLbGF8kjX0PotsoBntlRXMQ1mdfytGQNDGsTrDOnRm+itBtYwLQmZMyhenIycQL/O mgU77BfZmXKU2RdIvK1MScxENdi9HAyjRrIkc17I66ODOLOFiTBqHBJVhwD/jXIOil6k WJi6lfBgc8fEmZP0lJq0aj8lXSzMWidbbSNvqqOEWy751OHexhMKH9zk3WLukM5r8Xq+ YNvQnU0EYMobNX9vyOoG5oP54ifoRy+XSrYfmRU7Muu2krrgossLA2V0x4ziSPhUy21S ZFBpPyxDr1pxJWHAYL8Z3ClmaKMbsYuqq5z5IzxjG1kW+boMIMkHoI4sWnUQ6bvo8+FF nm3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Apyk2EsaQkKzjgWc1lHDgAWxDVjQnXEaCPOUVZyL41s=; b=dQBYxc4M9b4XTM9DiUznsvd+CTDCfUPYdk+nuXlnWDX8DsAwDJdzA9dXJYES00SPMh 3tcj88zHUkNj+vduSpkLKRgffNy3BloZE5ijRCxUmqIpY0gnIDWJhmobJ7wxB1fF5J8c XSvZ4dW31/9IkFvXgH7H6cSaiSsgewscQp/lUZt86MKWtI4N4GS+0fwfmk08TSOgzMfR /7ofp96Rbgy68GpIqaMLQVMVfikULtEI7tpMrzKM2U7P7+n09FPcKO/6UUGagt4RYf1/ S/njmnWCeCRnuHZwdZR49qF2QoDbPT5VBzTpGne0LORQpl3XnbsVQ517vd1f0FOdZt9S m6Gg== X-Gm-Message-State: AOAM5323jvcXQK+la6V9x8mlnWm4CBAIdTnKv1az6nU86NN84sazdbfA PqqDu1wQjVA7CKBZjggMNYEDbGuuoQvQfMXJ X-Google-Smtp-Source: ABdhPJzLUz9cHsC/W0S2fJwDKf2SCR2CfHQ9KllaO9/lns1Evj2NCJQy6ZX2mL499BP38kMCO0KaVg== X-Received: by 2002:a63:1d41:: with SMTP id d1mr1975744pgm.199.1626141644242; Mon, 12 Jul 2021 19:00:44 -0700 (PDT) Sender: Bobby Eshleman From: Bobby Eshleman To: xen-devel@lists.xenproject.org Cc: Bobby Eshleman , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Wei Liu , Elena Ufimtseva , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= , Jun Nakajima , Kevin Tian Subject: [PATCH 1/4] build: use common stubs for debugger_trap_* functions if !CONFIG_CRASH_DEBUG Date: Mon, 12 Jul 2021 18:59:53 -0700 Message-Id: <2fc1a1416d37b5eed0ebfdeff8bb9dd61bc7acc7.1626136452.git.bobby.eshleman@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: References: MIME-Version: 1.0 Previously Xen required all architectures implement the debugger_trap_* functions whether or not it actually needs them. This commit makes debugger_trap* functions resolve to arch-specific function definitions if CONFIG_CRASH_DEBUG=y, but resolves to a set of common no-op stubs if !CONFIG_CRASH_DEBUG, which avoids requiring every arch to carry its own stubs. This means asm/debugger.h may also be dropped for architectures that do not need this functionality. Inside xen/debugger.h: * If !CONFIG_CRASH_DEBUG, use stubs. * Otherwise, include arch-specific Signed-off-by: Bobby Eshleman --- xen/arch/arm/traps.c | 2 +- xen/arch/x86/debug.c | 2 +- xen/arch/x86/domain.c | 5 +- xen/arch/x86/domctl.c | 2 +- xen/arch/x86/gdbstub.c | 4 +- xen/arch/x86/hvm/svm/svm.c | 2 +- xen/arch/x86/hvm/vmx/realmode.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/arch/x86/nmi.c | 2 +- xen/arch/x86/traps.c | 2 +- xen/arch/x86/x86_64/gdbstub.c | 3 +- xen/common/domain.c | 2 +- xen/common/gdbstub.c | 3 +- xen/common/keyhandler.c | 2 +- xen/common/shutdown.c | 2 +- xen/drivers/char/console.c | 2 +- xen/include/asm-arm/debugger.h | 15 ------ xen/include/asm-x86/debugger.h | 66 +++++---------------------- xen/include/xen/debugger.h | 81 +++++++++++++++++++++++++++++++++ 19 files changed, 115 insertions(+), 86 deletions(-) delete mode 100644 xen/include/asm-arm/debugger.h create mode 100644 xen/include/xen/debugger.h diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 4ccb6e7d18..5a0a5eff1d 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/xen/arch/x86/debug.c b/xen/arch/x86/debug.c index d90dc93056..4386e8d1b1 100644 --- a/xen/arch/x86/debug.c +++ b/xen/arch/x86/debug.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include typedef unsigned long dbgva_t; diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index ef1812dc14..47448f2f8c 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -2539,9 +2540,9 @@ static int __init init_vcpu_kick_softirq(void) } __initcall(init_vcpu_kick_softirq); +#ifdef CONFIG_CRASH_DEBUG void domain_pause_for_debugger(void) { -#ifdef CONFIG_CRASH_DEBUG struct vcpu *curr = current; struct domain *d = curr->domain; @@ -2550,8 +2551,8 @@ void domain_pause_for_debugger(void) /* if gdbsx active, we just need to pause the domain */ if ( curr->arch.gdbsx_vcpu_event == 0 ) send_global_virq(VIRQ_DEBUGGER); -#endif } +#endif /* * Local variables: diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 26a76d2be9..1bc8ba7251 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include diff --git a/xen/arch/x86/gdbstub.c b/xen/arch/x86/gdbstub.c index 8f4f49fd3b..f20cbf1f45 100644 --- a/xen/arch/x86/gdbstub.c +++ b/xen/arch/x86/gdbstub.c @@ -18,7 +18,9 @@ * You should have received a copy of the GNU General Public License * along with this program; If not, see . */ -#include +#include +#include +#include u16 gdb_arch_signal_num(struct cpu_user_regs *regs, unsigned long cookie) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 642a64b747..d7ec7c15f9 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/xen/arch/x86/hvm/vmx/realmode.c b/xen/arch/x86/hvm/vmx/realmode.c index cc23afa788..1f8513c132 100644 --- a/xen/arch/x86/hvm/vmx/realmode.c +++ b/xen/arch/x86/hvm/vmx/realmode.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index e09b7e3af9..1820e4be0c 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -51,7 +51,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c index ab94a96c4d..eaf404402d 100644 --- a/xen/arch/x86/nmi.c +++ b/xen/arch/x86/nmi.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index e60af16ddd..44811c9599 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -62,7 +62,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/xen/arch/x86/x86_64/gdbstub.c b/xen/arch/x86/x86_64/gdbstub.c index 2626519c89..126af03f50 100644 --- a/xen/arch/x86/x86_64/gdbstub.c +++ b/xen/arch/x86/x86_64/gdbstub.c @@ -17,7 +17,8 @@ * along with this program; If not, see . */ -#include +#include +#include #define GDB_REG64(r) gdb_write_to_packet_hex(r, sizeof(u64), ctx) #define GDB_REG32(r) gdb_write_to_packet_hex(r, sizeof(u32), ctx) diff --git a/xen/common/domain.c b/xen/common/domain.c index 6b71c6d6a9..88ba680fe7 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/xen/common/gdbstub.c b/xen/common/gdbstub.c index 848c1f4327..6f3d7ca72f 100644 --- a/xen/common/gdbstub.c +++ b/xen/common/gdbstub.c @@ -38,7 +38,8 @@ #include #include #include -#include +#include +#include #include #include #include diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index 8b9f378371..5c66ca0056 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include static unsigned char keypress_key; diff --git a/xen/common/shutdown.c b/xen/common/shutdown.c index abde48aa4c..c82a4999d9 100644 --- a/xen/common/shutdown.c +++ b/xen/common/shutdown.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include /* opt_noreboot: If true, machine will need manual reset on error. */ diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index 7d0a603d03..060d32757f 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include /* for do_console_io */ #include diff --git a/xen/include/asm-arm/debugger.h b/xen/include/asm-arm/debugger.h deleted file mode 100644 index ac776efa78..0000000000 --- a/xen/include/asm-arm/debugger.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __ARM_DEBUGGER_H__ -#define __ARM_DEBUGGER_H__ - -#define debugger_trap_fatal(v, r) (0) -#define debugger_trap_immediate() ((void) 0) - -#endif /* __ARM_DEBUGGER_H__ */ -/* - * Local variables: - * mode: C - * c-file-style: "BSD" - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/xen/include/asm-x86/debugger.h b/xen/include/asm-x86/debugger.h index 99803bfd0c..38359da0a1 100644 --- a/xen/include/asm-x86/debugger.h +++ b/xen/include/asm-x86/debugger.h @@ -1,44 +1,26 @@ /****************************************************************************** - * asm/debugger.h - * - * Generic hooks into arch-dependent Xen. - * - * Each debugger should define two functions here: - * - * 1. debugger_trap_entry(): - * Called at start of any synchronous fault or trap, before any other work - * is done. The idea is that if your debugger deliberately caused the trap - * (e.g. to implement breakpoints or data watchpoints) then you can take - * appropriate action and return a non-zero value to cause early exit from - * the trap function. - * - * 2. debugger_trap_fatal(): - * Called when Xen is about to give up and crash. Typically you will use this - * hook to drop into a debug session. It can also be used to hook off - * deliberately caused traps (which you then handle and return non-zero). + * x86 Debugger Hooks * - * 3. debugger_trap_immediate(): - * Called if we want to drop into a debugger now. This is essentially the - * same as debugger_trap_fatal, except that we use the current register state - * rather than the state which was in effect when we took the trap. - * For example: if we're dying because of an unhandled exception, we call - * debugger_trap_fatal; if we're dying because of a panic() we call - * debugger_trap_immediate(). + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; If not, see . */ - #ifndef __X86_DEBUGGER_H__ #define __X86_DEBUGGER_H__ -#include #include #include +#include +#include +#include +#include void domain_pause_for_debugger(void); -#ifdef CONFIG_CRASH_DEBUG - -#include - static inline bool debugger_trap_fatal( unsigned int vector, struct cpu_user_regs *regs) { @@ -74,28 +56,4 @@ static inline bool debugger_trap_entry( return false; } -#else - -static inline bool debugger_trap_fatal( - unsigned int vector, struct cpu_user_regs *regs) -{ - return false; -} - -#define debugger_trap_immediate() ((void)0) - -static inline bool debugger_trap_entry( - unsigned int vector, struct cpu_user_regs *regs) -{ - return false; -} - -#endif - -#ifdef CONFIG_GDBSX -unsigned int dbg_rw_mem(unsigned long gva, XEN_GUEST_HANDLE_PARAM(void) buf, - unsigned int len, domid_t domid, bool toaddr, - uint64_t pgd3); -#endif - #endif /* __X86_DEBUGGER_H__ */ diff --git a/xen/include/xen/debugger.h b/xen/include/xen/debugger.h new file mode 100644 index 0000000000..d6d820f4e5 --- /dev/null +++ b/xen/include/xen/debugger.h @@ -0,0 +1,81 @@ +/****************************************************************************** + * Generic hooks into arch-dependent Xen. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; If not, see . + * + * + * Each debugger should define three functions here: + * + * 1. debugger_trap_entry(): + * Called at start of any synchronous fault or trap, before any other work + * is done. The idea is that if your debugger deliberately caused the trap + * (e.g. to implement breakpoints or data watchpoints) then you can take + * appropriate action and return a non-zero value to cause early exit from + * the trap function. + * + * 2. debugger_trap_fatal(): + * Called when Xen is about to give up and crash. Typically you will use this + * hook to drop into a debug session. It can also be used to hook off + * deliberately caused traps (which you then handle and return non-zero). + * + * 3. debugger_trap_immediate(): + * Called if we want to drop into a debugger now. This is essentially the + * same as debugger_trap_fatal, except that we use the current register state + * rather than the state which was in effect when we took the trap. + * For example: if we're dying because of an unhandled exception, we call + * debugger_trap_fatal; if we're dying because of a panic() we call + * debugger_trap_immediate(). + */ + +#ifndef __XEN_DEBUGGER_H__ +#define __XEN_DEBUGGER_H__ + +/* Dummy value used by ARM stubs. */ +#ifndef TRAP_invalid_op +# define TRAP_invalid_op 6 +#endif + +#ifdef CONFIG_CRASH_DEBUG + +#include + +#else + +#include +#include + +static inline void domain_pause_for_debugger(void) +{ +} + +static inline bool debugger_trap_fatal( + unsigned int vector, const struct cpu_user_regs *regs) +{ + return false; +} + +static inline void debugger_trap_immediate(void) +{ +} + +static inline bool debugger_trap_entry( + unsigned int vector, const struct cpu_user_regs *regs) +{ + return false; +} + +#endif /* CONFIG_CRASH_DEBUG */ + +#ifdef CONFIG_GDBSX +unsigned int dbg_rw_mem(unsigned long gva, XEN_GUEST_HANDLE_PARAM(void) buf, + unsigned int len, domid_t domid, bool toaddr, + uint64_t pgd3); +#endif /* CONFIG_GDBSX */ + +#endif /* __XEN_DEBUGGER_H__ */ From patchwork Tue Jul 13 01:59:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bobby Eshleman X-Patchwork-Id: 12372687 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E034EC07E9A for ; Tue, 13 Jul 2021 02:01:03 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A84F761002 for ; Tue, 13 Jul 2021 02:01:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A84F761002 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.154939.286174 (Exim 4.92) (envelope-from ) id 1m37jF-0001jw-4b; Tue, 13 Jul 2021 02:00:57 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 154939.286174; Tue, 13 Jul 2021 02:00:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m37jF-0001jp-0m; Tue, 13 Jul 2021 02:00:57 +0000 Received: by outflank-mailman (input) for mailman id 154939; Tue, 13 Jul 2021 02:00:55 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m37jD-000176-2m for xen-devel@lists.xenproject.org; Tue, 13 Jul 2021 02:00:55 +0000 Received: from mail-pl1-x62d.google.com (unknown [2607:f8b0:4864:20::62d]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3ff32f20-1db9-4b45-af84-32f0c6ae204e; Tue, 13 Jul 2021 02:00:46 +0000 (UTC) Received: by mail-pl1-x62d.google.com with SMTP id v14so3328772plg.9 for ; Mon, 12 Jul 2021 19:00:46 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:4c02:4c00::1]) by smtp.gmail.com with ESMTPSA id o20sm19285728pgv.80.2021.07.12.19.00.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 19:00:45 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: 3ff32f20-1db9-4b45-af84-32f0c6ae204e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ETCvvoLrlGjCQWP7sohk1l4ug8oahZVh7nYA0Gt5aRs=; b=PN7qycbKZ9dR/LzS0glr8GMR+f2ztvIFGFwGqy786AT1CPnQZ5d/ZqRmShlGwfnlZb WPUbUl5kQJwWG4wMSfveXdJsGhwCrUYmAEeqtxnvju/vIQgTJpooLb72Hp2E6RGpJ3IU 6J+aHO7SQVmolBLsGEsq2SsaoMD1Bj6fNqOSKBoDNAAGz12g9wFoxg1bw7B7CGx78S5M f6iQw+XUD3BjExwNCBINCYhRO5XLVnX8JJZW2o9xzXAqnrVNTTixEKAIh06TLZhSHDRs 7YYdzHsdSs5nuA8CNviSy3BDOAPBv6KHuBHBizkgGxGywLOPu5wuFubdEw4oCizz3JBP ejfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ETCvvoLrlGjCQWP7sohk1l4ug8oahZVh7nYA0Gt5aRs=; b=QbFjMrssXo95fjtwnqlBGeBVKjBy75PNQrAPeLnCIgJZ9Rxh4UWnz6MnfwE10/IjJD 8OgpKt7pmql9duH2ImhGrHxgkNjH9HdTQ/xYJW6WrtzZyK1QuDjSQcwB/K91RSPHQ7fZ chsHq/okCE0tt8nWU9Kp0/+HfCjVH9gTZ/q6MffzSel7bvi8w/I8WkZl2Jp2WW6msTyq qY/oFBVrZluLh+FZiGFjwtjSRTE79V+XTn47+00yCX3lj8pKjmj6h7kq+xw+/uJEvjPt Ug3LafP7FwX0qf4zTmBAVd4VaM4V0kGuKlZf5ijtkOGdmDrNyNTgDvRwRBZ9IPyNLpFP oDZw== X-Gm-Message-State: AOAM531uUoYWQ6OeG2IBOAQb1YJs8kNDFFvuPfItdGrlO0d382FIEWeC veJb+nklTF1HKH5tFTOr5QKFxO8BkfqqpyZX X-Google-Smtp-Source: ABdhPJwtUvTf3MaX/Rj6pTO/MUDcJS9nQZwGhCK26AXxHrpEWNHwyBb/iqgG8KwGtRzIwudERf6BQw== X-Received: by 2002:a17:902:6b47:b029:129:ab4e:6407 with SMTP id g7-20020a1709026b47b0290129ab4e6407mr1570395plt.20.1626141645515; Mon, 12 Jul 2021 19:00:45 -0700 (PDT) Sender: Bobby Eshleman From: Bobby Eshleman To: xen-devel@lists.xenproject.org Cc: Bobby Eshleman , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Wei Liu , Elena Ufimtseva , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= , Jun Nakajima , Kevin Tian Subject: [PATCH 2/4] arm/traps: remove debugger_trap_fatal() calls Date: Mon, 12 Jul 2021 18:59:54 -0700 Message-Id: <53d50b747796d3ece965f872426dc311073775ab.1626136452.git.bobby.eshleman@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: References: MIME-Version: 1.0 ARM doesn't actually use debugger_trap_* anything, and is stubbed out. Simply remove the calls. This also renders TRAP_invalid_op unused in any common code, so remove that definition too. Signed-off-by: Bobby Eshleman --- xen/arch/arm/traps.c | 6 ------ xen/include/xen/debugger.h | 5 ----- 2 files changed, 11 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 5a0a5eff1d..0310bc91a0 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1266,10 +1266,6 @@ int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc) case BUGFRAME_bug: printk("Xen BUG at %s%s:%d\n", prefix, filename, lineno); - - if ( debugger_trap_fatal(TRAP_invalid_op, regs) ) - return 0; - show_execution_state(regs); panic("Xen BUG at %s%s:%d\n", prefix, filename, lineno); @@ -1281,8 +1277,6 @@ int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc) printk("Assertion '%s' failed at %s%s:%d\n", predicate, prefix, filename, lineno); - if ( debugger_trap_fatal(TRAP_invalid_op, regs) ) - return 0; show_execution_state(regs); panic("Assertion '%s' failed at %s%s:%d\n", predicate, prefix, filename, lineno); diff --git a/xen/include/xen/debugger.h b/xen/include/xen/debugger.h index d6d820f4e5..8297e582e4 100644 --- a/xen/include/xen/debugger.h +++ b/xen/include/xen/debugger.h @@ -36,11 +36,6 @@ #ifndef __XEN_DEBUGGER_H__ #define __XEN_DEBUGGER_H__ -/* Dummy value used by ARM stubs. */ -#ifndef TRAP_invalid_op -# define TRAP_invalid_op 6 -#endif - #ifdef CONFIG_CRASH_DEBUG #include From patchwork Tue Jul 13 01:59:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bobby Eshleman X-Patchwork-Id: 12372689 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08527C07E9A for ; Tue, 13 Jul 2021 02:01:09 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A29B9611CB for ; Tue, 13 Jul 2021 02:01:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A29B9611CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.154941.286185 (Exim 4.92) (envelope-from ) id 1m37jJ-00026d-JQ; Tue, 13 Jul 2021 02:01:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 154941.286185; Tue, 13 Jul 2021 02:01:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m37jJ-00026U-F1; Tue, 13 Jul 2021 02:01:01 +0000 Received: by outflank-mailman (input) for mailman id 154941; Tue, 13 Jul 2021 02:01:00 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m37jI-000176-2q for xen-devel@lists.xenproject.org; Tue, 13 Jul 2021 02:01:00 +0000 Received: from mail-pj1-x102f.google.com (unknown [2607:f8b0:4864:20::102f]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 6a4a83df-4f93-4d66-99d0-66d242d5a5c6; Tue, 13 Jul 2021 02:00:47 +0000 (UTC) Received: by mail-pj1-x102f.google.com with SMTP id cu14so5895987pjb.0 for ; Mon, 12 Jul 2021 19:00:47 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:4c02:4c00::1]) by smtp.gmail.com with ESMTPSA id o20sm19285728pgv.80.2021.07.12.19.00.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 19:00:46 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: 6a4a83df-4f93-4d66-99d0-66d242d5a5c6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IYB3iZHRXJw5EDQRJ886nEUR/jLEeGwphV4Z/nAkuoA=; b=vQ8b5kDFCqOCH0hWy6rT6p8nLejfhuuLpsltsXVzLAmuo5T987HMdrzKNAzs8zXx1I hj8NSaAWveXgYkkrhHv5Wbs9gdoDLBVdUiPLoqTv1puh84PAYCnh83910gsqPG4QFxmd 9aRYjWk3ARbB34GnYn7BGqaq/isfBFEYt3Sdt4j9m4BqHWN14ot01dR78yTZZXuY9jmJ ba58Cn3F/PET1RMzapZdti3pNaWxOaUFmyRrKwD9XDPEzBa0HTKgh7PSd9TwdNkOpEJv KnjMCjymALCnQtqBvl6F9hThvZl7+QmOVEmq6LwvE6/KTpmp9oPNgkVfgw6Q4o33Soyl nbbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=IYB3iZHRXJw5EDQRJ886nEUR/jLEeGwphV4Z/nAkuoA=; b=jj+zRYlyxpZfQP5TmWqLVjjfNxY63lRTR+L0PnOevQlVO6eONS9pk3+zEJxM4qz6zV iA8TpYTb3AMB6Ip4gXf86GwLGGXsU3Ov/kSYOLuLgPYCV31f/5emxJUT63TSV+vzQHAr JZN+tSmGN7Tf8AggsQsZheisRy+6ojedDlqBEEuUeiYtpiOdBjbZOZWxHcpUyjBiLYnT j+RRovKfkUmHeNBmSUj6l7Jq+uYcG9+bP2PXWlicGOhcSwfj1MbWR6vq3ezPULaY3Pz1 +Jp5y3BxKz4ASshXx0rlcGt6YpjPyKVvUPOAdwSyTA2ZC7JImuMfLa9GJS87TkdeQHZL J0/g== X-Gm-Message-State: AOAM531eUdVRYpkqEfIll0jeEW2B4fn4WSDRR85cs0ciYTfs7l12sXgD ZhghetxduHfY2Jlo9kUBYMrrOx2fKgRISqKl X-Google-Smtp-Source: ABdhPJzTADmqDU1sLjfzYDfb9vCVlvA29Sl+JJg1Q5nFHyy4feMy996dHxe//jyKECBphs6uEpqPKw== X-Received: by 2002:a17:902:650b:b029:129:9c6a:13d8 with SMTP id b11-20020a170902650bb02901299c6a13d8mr1661193plk.63.1626141646687; Mon, 12 Jul 2021 19:00:46 -0700 (PDT) Sender: Bobby Eshleman From: Bobby Eshleman To: xen-devel@lists.xenproject.org Cc: Bobby Eshleman , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Wei Liu , Elena Ufimtseva , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= , Jun Nakajima , Kevin Tian Subject: [PATCH 3/4] x86/debug: move debugger_trap_entry into debugger.c not inlined Date: Mon, 12 Jul 2021 18:59:55 -0700 Message-Id: <02355502c796b500a6b7e9e60b903d245d2ece23.1626136452.git.bobby.eshleman@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: References: MIME-Version: 1.0 The function debugger_trap_entry() is rather large for an inlined function. This commit moves debugger_trap_entry() into debugger.c and makes it not inlined. Signed-off-by: Bobby Eshleman --- xen/arch/x86/Makefile | 1 + xen/arch/x86/debugger.c | 41 ++++++++++++++++++++++++++++++++++ xen/include/asm-x86/debugger.h | 29 ++---------------------- 3 files changed, 44 insertions(+), 27 deletions(-) create mode 100644 xen/arch/x86/debugger.c diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 2ec883456e..ba274fb8e6 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -32,6 +32,7 @@ obj-y += emul-i8254.o obj-y += extable.o obj-y += flushtlb.o obj-$(CONFIG_CRASH_DEBUG) += gdbstub.o +obj-$(CONFIG_CRASH_DEBUG) += debugger.o obj-y += hypercall.o obj-y += i387.o obj-y += i8259.o diff --git a/xen/arch/x86/debugger.c b/xen/arch/x86/debugger.c new file mode 100644 index 0000000000..6f33f509ff --- /dev/null +++ b/xen/arch/x86/debugger.c @@ -0,0 +1,41 @@ +/****************************************************************************** + * x86 crash debug hooks + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; If not, see . + */ + +#include +#include +#include +#include + +bool debugger_trap_entry( + unsigned int vector, struct cpu_user_regs *regs) +{ + /* + * This function is called before any checks are made. Amongst other + * things, be aware that during early boot, current is not a safe pointer + * to follow. + */ + struct vcpu *v = current; + + if ( vector != TRAP_int3 && vector != TRAP_debug ) + return false; + + if ( guest_mode(regs) && guest_kernel_mode(v, regs) && + v->domain->debugger_attached ) + { + if ( vector != TRAP_debug ) /* domain pause is good enough */ + current->arch.gdbsx_vcpu_event = vector; + domain_pause_for_debugger(); + return true; + } + + return false; +} diff --git a/xen/include/asm-x86/debugger.h b/xen/include/asm-x86/debugger.h index 38359da0a1..0e30d27a4e 100644 --- a/xen/include/asm-x86/debugger.h +++ b/xen/include/asm-x86/debugger.h @@ -15,9 +15,6 @@ #include #include #include -#include -#include -#include void domain_pause_for_debugger(void); @@ -31,29 +28,7 @@ static inline bool debugger_trap_fatal( /* Int3 is a trivial way to gather cpu_user_regs context. */ #define debugger_trap_immediate() __asm__ __volatile__ ( "int3" ); -static inline bool debugger_trap_entry( - unsigned int vector, struct cpu_user_regs *regs) -{ - /* - * This function is called before any checks are made. Amongst other - * things, be aware that during early boot, current is not a safe pointer - * to follow. - */ - struct vcpu *v = current; - - if ( vector != TRAP_int3 && vector != TRAP_debug ) - return false; - - if ( guest_mode(regs) && guest_kernel_mode(v, regs) && - v->domain->debugger_attached ) - { - if ( vector != TRAP_debug ) /* domain pause is good enough */ - current->arch.gdbsx_vcpu_event = vector; - domain_pause_for_debugger(); - return true; - } - - return false; -} +bool debugger_trap_entry( + unsigned int vector, struct cpu_user_regs *regs); #endif /* __X86_DEBUGGER_H__ */ From patchwork Tue Jul 13 01:59:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bobby Eshleman X-Patchwork-Id: 12372691 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD8F7C07E9A for ; Tue, 13 Jul 2021 02:01:13 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 856A661002 for ; Tue, 13 Jul 2021 02:01:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 856A661002 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.154942.286196 (Exim 4.92) (envelope-from ) id 1m37jO-0002dR-Vd; Tue, 13 Jul 2021 02:01:06 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 154942.286196; Tue, 13 Jul 2021 02:01:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m37jO-0002dD-OY; Tue, 13 Jul 2021 02:01:06 +0000 Received: by outflank-mailman (input) for mailman id 154942; Tue, 13 Jul 2021 02:01:05 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m37jN-000176-32 for xen-devel@lists.xenproject.org; Tue, 13 Jul 2021 02:01:05 +0000 Received: from mail-pg1-x52b.google.com (unknown [2607:f8b0:4864:20::52b]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c179980e-02e2-42b5-998e-9a3efa51a5c9; Tue, 13 Jul 2021 02:00:48 +0000 (UTC) Received: by mail-pg1-x52b.google.com with SMTP id 62so20246129pgf.1 for ; Mon, 12 Jul 2021 19:00:48 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:4c02:4c00::1]) by smtp.gmail.com with ESMTPSA id o20sm19285728pgv.80.2021.07.12.19.00.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 19:00:47 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: c179980e-02e2-42b5-998e-9a3efa51a5c9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FV7wVbCGMMxrIWv0cXlRnxEDbi/EU7T33uAI58BfHiU=; b=I9wBSC0qbzn6iH0pzFRVbANuqOnUAbwdZdEpNoqu2Ru2wnHJx6OugnlgLE0T5b7/Xs 1SyUMIPOcav02xFdHshZhfNU72HWkLv7qGndAEdJ5r50Jm47w3/XkCS+FKHZWmZC8osu iZJyM2T0+SP/jcQlt+S/lh6nLmqQb2X2LM2lK0eL92ynU88rQTynFVAOCH8ozHAw1ubZ FCHjxt0Bzu7mXo6CFkXzx9lhd5uxJUMgixaxl/ZY/5eyN5y92idbS4UInL5QM1qYWQsz OGvLmyj8OtLApFR1T0ays+itej2MGpFQFYoRHHpj0exWiHXlDnZJpSlR8YHCHHUcPAe1 CMcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=FV7wVbCGMMxrIWv0cXlRnxEDbi/EU7T33uAI58BfHiU=; b=jT5XPPjFd2mhzskH71fs7DGtUClEVe3e1RVQaag8MHWO9zEDgxPVRTPf4EhVSROChM QMb/tD2jsDoC13L+iSkAlzN4KRkA45edpfdHBFpwkL+4/L9+Yte2R+UlTXWVH03lx4uO g2LP2W1LAVlqSNHg5a4rLv/RkjvXdd+I8VSFMawpEvTv483WpTKIs5YUMlh/ZbMFLpFq 7q0jR4f/hjJNJ3VMnwFI/unQJvq0mGy/ysJXqKO0AzzIXyMKpUMihETWLbh69+jroOi+ EnE6Oya55uy3xaRAPwUho51w/w0sHfRdG3GxYeujNgFk/Ht3wr+Cx/aBSYx4I601Obyt vBRQ== X-Gm-Message-State: AOAM531o9N1cJrf7prmHHip6C5jVZ4A+lq4jiL1Y0mYQA8FvP69pdfT/ CajHjPXTya1IP+Ypb4w0GEMqjIQkPst4dZxz X-Google-Smtp-Source: ABdhPJw4iTdhZagH3LsD7nmLQqLY0SxxEikJty4X7J2WQ12xQxcsdLG98MQ0afVc6GOX7DZiKeqmrQ== X-Received: by 2002:a63:5f93:: with SMTP id t141mr2033622pgb.236.1626141647878; Mon, 12 Jul 2021 19:00:47 -0700 (PDT) Sender: Bobby Eshleman From: Bobby Eshleman To: xen-devel@lists.xenproject.org Cc: Bobby Eshleman , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Wei Liu , Elena Ufimtseva , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= , Jun Nakajima , Kevin Tian Subject: [PATCH 4/4] x86/debug: move domain_pause_for_debugger to debugger.c Date: Mon, 12 Jul 2021 18:59:56 -0700 Message-Id: X-Mailer: git-send-email 2.30.0 In-Reply-To: References: MIME-Version: 1.0 The function domain_pause_for_debugger() is conditionally compiled if CONFIG_CRASH_DEBUG=y. Instead of placing an extra #ifdef inside domain.c, this commit moves domain_pause_for_debugger() into x86/debugger.c which is only built by Kbuild given CONFIG_CRASH_DEBUG=y. Signed-off-by: Bobby Eshleman Acked-by: Jan Beulich --- xen/arch/x86/debugger.c | 12 ++++++++++++ xen/arch/x86/domain.c | 14 -------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/debugger.c b/xen/arch/x86/debugger.c index 6f33f509ff..4f7c44600f 100644 --- a/xen/arch/x86/debugger.c +++ b/xen/arch/x86/debugger.c @@ -15,6 +15,18 @@ #include #include +void domain_pause_for_debugger(void) +{ + struct vcpu *curr = current; + struct domain *d = curr->domain; + + domain_pause_by_systemcontroller_nosync(d); + + /* if gdbsx active, we just need to pause the domain */ + if ( curr->arch.gdbsx_vcpu_event == 0 ) + send_global_virq(VIRQ_DEBUGGER); +} + bool debugger_trap_entry( unsigned int vector, struct cpu_user_regs *regs) { diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 47448f2f8c..545da32c3b 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -2540,20 +2540,6 @@ static int __init init_vcpu_kick_softirq(void) } __initcall(init_vcpu_kick_softirq); -#ifdef CONFIG_CRASH_DEBUG -void domain_pause_for_debugger(void) -{ - struct vcpu *curr = current; - struct domain *d = curr->domain; - - domain_pause_by_systemcontroller_nosync(d); - - /* if gdbsx active, we just need to pause the domain */ - if ( curr->arch.gdbsx_vcpu_event == 0 ) - send_global_virq(VIRQ_DEBUGGER); -} -#endif - /* * Local variables: * mode: C