From nobody Mon May 6 23:03:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1626295118; cv=none; d=zohomail.com; s=zohoarc; b=g8QuNztIEIUS7P+GSbmvjjVNn9R8xoSyKBwn8Z/2NePh+Bw8cR6h4IftLHA5Q1U2Y1GcizBR2JBuaS90ub/jV5lupjB9sh2XpwrqGpolX98vRWRZIZVYYgZy08aMtx37OnwTbWguj8iipF0wBs/jbUxh8ZcJv9+07Ja9cMag+uw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626295118; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PVjxJO7r4tEQ5KrqJV2fLuS45xkhLqACA4SCEsFghwg=; b=KvYKGDJRj1SScUUI/hnJYU1FWBDlgpbOXeTOlhE/geQDNmEEvtehzmvyrDStnmyyG5Xp6Q6wJsekNY7NtGNCA7Zuj2KSDFVMGO5ff/AvJcxQD2VVwcgpn7EC4I03giQVssbVCI71Dk196HCiCg7J4AzkEZQK4ry8CIoO+SXkJ1s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 162629511862692.69798100689218; Wed, 14 Jul 2021 13:38:38 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.156212.288258 (Exim 4.92) (envelope-from ) id 1m3le9-0000L8-Ht; Wed, 14 Jul 2021 20:38:21 +0000 Received: by outflank-mailman (output) from mailman id 156212.288258; Wed, 14 Jul 2021 20:38:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m3le9-0000Kv-E9; Wed, 14 Jul 2021 20:38:21 +0000 Received: by outflank-mailman (input) for mailman id 156212; Wed, 14 Jul 2021 20:38:19 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m3le7-0000KG-Pc for xen-devel@lists.xenproject.org; Wed, 14 Jul 2021 20:38:19 +0000 Received: from mail-pf1-x431.google.com (unknown [2607:f8b0:4864:20::431]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a66d8a53-11d2-43d1-a186-ab0271001d25; Wed, 14 Jul 2021 20:38:19 +0000 (UTC) Received: by mail-pf1-x431.google.com with SMTP id o201so3101865pfd.1 for ; Wed, 14 Jul 2021 13:38:19 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:4c02:4c00::1]) by smtp.gmail.com with ESMTPSA id b17sm1785084pfm.54.2021.07.14.13.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jul 2021 13:38:17 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: a66d8a53-11d2-43d1-a186-ab0271001d25 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=PVjxJO7r4tEQ5KrqJV2fLuS45xkhLqACA4SCEsFghwg=; b=LOzr0TSGpoY/uDxpvLTKhA2FZnlCEorEMej+Oifny9CBnjufEhEYllm4eg+dfxST8x YM/2ZHAEkYxfSCkAlcGW1AsVxX0tnYzLaFGvS4r8BZCr9iBdNFZlbCMnTs797vu6Kvek rG3ThorDLN1LaQvMIRxw/xBV2rRQNmEWsFE/1Y9A+7CbLrjzvc2Rjmmt0jmScjyoDRQp B8pVoJ+y0h81ncvpkr5eLx2SdVGn1dHdgjZVh1GUtwLHSKXJMncET/NM2xvg+r+UrZfa 8FM41IFcwsJEUlXcbo0TiSclE+ySJS0QSMBoCpHg+GY/u3QrhE8Pg5pR4otSJECPJuy4 YMPw== 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=PVjxJO7r4tEQ5KrqJV2fLuS45xkhLqACA4SCEsFghwg=; b=YCmNE/QE6crt7u+Z32YgyOyJYsVZBSvkSmXuk/DA9FoFYK+03Shyysi2C8g7d01cUE MWBmxCbkDWj3GtzlR1vJStNSyfe8FUAoTrRbVtXOpfSBDOnvaiS/bhnarSns8m1S1+6r dhAGZ8VLRBXUgV+0wN4GoAkuGdCCaAQfLeQwi6jzWUOiLIwYQfEu9Lam4WoXOA4IP0g+ VMiZlTPd0lURoH9qKxfDykLlhPp9uk2BzEjA2XACeODRXGhmfpxMjroGjfe8cIC06nKi dE5cc5NsfwRKwPCJPX1UKKr93xK1iqwuLYyyNBsbp8zJ7axi7h7V9+9c2LWuOMUszlg9 sElQ== X-Gm-Message-State: AOAM533PMwRgEwAkU8ap/fBuoH9nut7/4prM/QkAKgSywiLlhh1Iiw2c MtZ6hnXSGxoroJipU0vlsOsAs//Zz9XDyqDA X-Google-Smtp-Source: ABdhPJwrIpd7894157L04ZpBVIBPvvAbUKvKVDl93xih+9WvPToauUvvW8+k0RdKIk0ByMnQGyf7kA== X-Received: by 2002:a62:1697:0:b029:326:7ec1:a9e9 with SMTP id 145-20020a6216970000b02903267ec1a9e9mr116882pfw.14.1626295098137; Wed, 14 Jul 2021 13:38:18 -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=20Pau=20Monn=C3=A9?= , Jun Nakajima , Kevin Tian Subject: [PATCH v2 1/4] arm/traps: remove debugger_trap_fatal() calls Date: Wed, 14 Jul 2021 13:37:44 -0700 Message-Id: <2de1e8493e08722b5444d1293c5af299c76bf891.1626286772.git.bobby.eshleman@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1626295120047100002 Content-Type: text/plain; charset="utf-8" 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 ------ 1 file changed, 6 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 4ccb6e7d18..dd09d2a4a9 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, v= addr_t pc) =20 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); =20 @@ -1281,8 +1277,6 @@ int do_bug_frame(const struct cpu_user_regs *regs, va= ddr_t pc) =20 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); --=20 2.30.0 From nobody Mon May 6 23:03:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1626295119; cv=none; d=zohomail.com; s=zohoarc; b=by8c5E6gP4C+d2gbmEkQZpg7UjpcZy2p/oje7Dlu6mxk52R/ro6SWce3jDdJ4lfbdMI71qqwcf5apVaFELPB5aRU2Or4qEqsFgSjAfMkCTOMH6r7iBMx1Wy9iVWCy/3OTw682PAhrUEJVBu1sPzr+d/hWjSC5akGbMH4+AZj9Zs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626295119; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jpxytOQI7mEBkhk32tjmUuolX/Q1Yn907IdDWiELMV8=; b=nKrW1lRe+WPlaOAgGYCgI1ExIgCtnm9pKbuOhPkQwyhYjYWuFCeUxLZHj44iUCwB8iWCXFmQDU+nh4O2k0Vh5Z0/SKJc39uCeIH6DcPtMxydySKkujDMjm2iQXJYhy+0dUaH2FE9xg7i+OHfTBzykPA+o/RXeKPfSk82ciX97Hk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1626295119967116.58256090728878; Wed, 14 Jul 2021 13:38:39 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.156213.288269 (Exim 4.92) (envelope-from ) id 1m3leC-0000ez-V7; Wed, 14 Jul 2021 20:38:24 +0000 Received: by outflank-mailman (output) from mailman id 156213.288269; Wed, 14 Jul 2021 20:38:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m3leC-0000eq-Nz; Wed, 14 Jul 2021 20:38:24 +0000 Received: by outflank-mailman (input) for mailman id 156213; Wed, 14 Jul 2021 20:38:24 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m3leC-0000KG-5Z for xen-devel@lists.xenproject.org; Wed, 14 Jul 2021 20:38:24 +0000 Received: from mail-pj1-x102d.google.com (unknown [2607:f8b0:4864:20::102d]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b8a3144c-427d-4b48-93a9-b509a296a775; Wed, 14 Jul 2021 20:38:21 +0000 (UTC) Received: by mail-pj1-x102d.google.com with SMTP id p14-20020a17090ad30eb02901731c776526so4644124pju.4 for ; Wed, 14 Jul 2021 13:38:21 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:4c02:4c00::1]) by smtp.gmail.com with ESMTPSA id b17sm1785084pfm.54.2021.07.14.13.38.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jul 2021 13:38:20 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: b8a3144c-427d-4b48-93a9-b509a296a775 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=jpxytOQI7mEBkhk32tjmUuolX/Q1Yn907IdDWiELMV8=; b=KykIMWqip6LoIXDyfSIq1qKR+Gka1EeLBtyAXfy1PAyEX8IAy2CQqBjYs+iQijhq6E oBqqmHG2YYeB3U5oMTWVRcfkb4fL00GONk9XjkW2XRkzrtYfVTBR7zG6+sb1SWWUPo0d RLhSFnIRmEu8g/8H2D+D3qiY/UDijfXhagimglVk+VqWzOCVeOuKfLBsUPbbEsN2KMJJ KiYBdkJSgZqe+49Pc1s8J2bv0NW8dGkSTnYbOejvZJe042W6lOnLymZPLhzXkIQrshvp 4cwmheN/i92dLZ/ybShqNLaI+2bKo4fmCKWh0DalRAW+MLXY23gi8R07mQij5NJfHjtJ GVpg== 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=jpxytOQI7mEBkhk32tjmUuolX/Q1Yn907IdDWiELMV8=; b=VOvJt6baTOUJyBovXq8/mPrQHDyzgOgxbjw4AhHOEsMH5n+V9dAt/PfzlfySxR4TlO /T73+GEP9TZxgC4EcS7sCkutDEzZAFgUT1t+JV5XIzRXpcBi0rpqtGRT5BXAtEgD2FLA aslPolNUSyp8RVA41tnhqu7RRnpTWyKCQZouryldwnLYTNalbF1xhUcwD3DyFNFv1wbR 972iIeNBEi4U+zsNywghHJYqF/Djegsx+PcP+/g0GGh0ZsdPruCnD3XSqPsiOpKvoTy7 ClvQUrVrp9mGcHnTDC4oN1jtIQletQibqBY9vexoK0TrGwPvF4lOL/wbIQhlDCpaR0h+ /Xhw== X-Gm-Message-State: AOAM531w8B9uKqgg9DOkPdicJZ9Z7qkb+cACqiUOQ0UpLpRUdxEsImr+ 6a0I17zHUGxjTF20kKSVHz525V8xwWXgjksC X-Google-Smtp-Source: ABdhPJz+EAy20EOa/LMJc6vD8Yk4JeBto6hIMQMv4UVrk1D9AH1LmIfGafjTYMw04uoHk67badcmLw== X-Received: by 2002:a17:90b:fd6:: with SMTP id gd22mr5497865pjb.37.1626295100499; Wed, 14 Jul 2021 13:38:20 -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=20Pau=20Monn=C3=A9?= , Jun Nakajima , Kevin Tian Subject: [PATCH v2 2/4] build: use common stubs for debugger_trap_* functions if !CONFIG_CRASH_DEBUG Date: Wed, 14 Jul 2021 13:37:45 -0700 Message-Id: X-Mailer: git-send-email 2.30.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1626296024634100001 Content-Type: text/plain; charset="utf-8" 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=3Dy, 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 --- Changes in v2: - #include ordering (xen/.h before asm/.h, alphabetical order) - Other style (no double blanks in comments). - Removed dummy TRAP_invalid_op for ARM (not needed because the patch to remove the calls is now prior to this patch) - Removed common-izing of dbg_rw_mem 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 | 60 ++++++---------------------- xen/include/xen/debugger.h | 69 +++++++++++++++++++++++++++++++++ 19 files changed, 103 insertions(+), 80 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 dd09d2a4a9..10db98e01a 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -16,6 +16,7 @@ * GNU General Public License for more details. */ =20 +#include #include #include #include @@ -41,7 +42,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/debug.c b/xen/arch/x86/debug.c index d90dc93056..583a9a042a 100644 --- a/xen/arch/x86/debug.c +++ b/xen/arch/x86/debug.c @@ -14,12 +14,12 @@ * License along with this program; If not, see . */ =20 +#include #include #include #include #include #include -#include #include =20 typedef unsigned long dbgva_t; diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index ef1812dc14..5b948ff270 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -15,6 +15,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); =20 +#ifdef CONFIG_CRASH_DEBUG void domain_pause_for_debugger(void) { -#ifdef CONFIG_CRASH_DEBUG struct vcpu *curr =3D current; struct domain *d =3D curr->domain; =20 @@ -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 =3D=3D 0 ) send_global_virq(VIRQ_DEBUGGER); -#endif } +#endif =20 /* * Local variables: diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 26a76d2be9..24bdb86de7 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -33,7 +34,6 @@ #include #include #include -#include #include #include =20 diff --git a/xen/arch/x86/gdbstub.c b/xen/arch/x86/gdbstub.c index 8f4f49fd3b..5e23d27f62 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 =20 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..ce1cbe7825 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -58,7 +59,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/hvm/vmx/realmode.c b/xen/arch/x86/hvm/vmx/realmod= e.c index cc23afa788..57d230c4fe 100644 --- a/xen/arch/x86/hvm/vmx/realmode.c +++ b/xen/arch/x86/hvm/vmx/realmode.c @@ -9,12 +9,12 @@ * Keir Fraser */ =20 +#include #include #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..00107e8a3b 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -51,7 +52,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c index ab94a96c4d..505358b656 100644 --- a/xen/arch/x86/nmi.c +++ b/xen/arch/x86/nmi.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -30,7 +31,6 @@ #include #include #include -#include #include #include =20 diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index e60af16ddd..8561ffe3fe 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -62,7 +63,6 @@ #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 . */ =20 -#include +#include +#include =20 #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..a87d814b38 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -33,7 +34,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/common/gdbstub.c b/xen/common/gdbstub.c index 848c1f4327..c233eb2b49 100644 --- a/xen/common/gdbstub.c +++ b/xen/common/gdbstub.c @@ -38,12 +38,13 @@ #include #include #include -#include #include #include #include #include #include +#include +#include #include #include =20 diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index 8b9f378371..1eafaef9b2 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -3,6 +3,7 @@ */ =20 #include +#include #include #include #include @@ -20,7 +21,6 @@ #include #include #include -#include #include =20 static unsigned char keypress_key; diff --git a/xen/common/shutdown.c b/xen/common/shutdown.c index abde48aa4c..f51d44fdc4 100644 --- a/xen/common/shutdown.c +++ b/xen/common/shutdown.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -8,7 +9,6 @@ #include #include #include -#include #include =20 /* 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..3d1cdde821 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -26,7 +27,6 @@ #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..c856c1b795 100644 --- a/xen/include/asm-x86/debugger.h +++ b/xen/include/asm-x86/debugger.h @@ -1,44 +1,26 @@ /*************************************************************************= ***** - * asm/debugger.h - *=20 - * Generic hooks into arch-dependent Xen. - *=20 - * Each debugger should define two functions here: - *=20 - * 1. debugger_trap_entry():=20 - * 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. - *=20 - * 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 s= tate - * 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__ =20 +#include +#include +#include #include #include #include =20 void domain_pause_for_debugger(void); =20 -#ifdef CONFIG_CRASH_DEBUG - -#include - static inline bool debugger_trap_fatal( unsigned int vector, struct cpu_user_regs *regs) { @@ -74,28 +56,10 @@ static inline bool debugger_trap_entry( return false; } =20 -#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) bu= f, unsigned int len, domid_t domid, bool toaddr, uint64_t pgd3); -#endif +#endif /* CONFIG_GDBSX */ =20 #endif /* __X86_DEBUGGER_H__ */ diff --git a/xen/include/xen/debugger.h b/xen/include/xen/debugger.h new file mode 100644 index 0000000000..64745fbe8f --- /dev/null +++ b/xen/include/xen/debugger.h @@ -0,0 +1,69 @@ +/*************************************************************************= ***** + * 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 s= tate + * 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__ + +#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 */ + +#endif /* __XEN_DEBUGGER_H__ */ --=20 2.30.0 From nobody Mon May 6 23:03:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1626295120; cv=none; d=zohomail.com; s=zohoarc; b=AaxgIXvx06fsQwbaSGALfXg+5JVW4HXluKH3EZU+wwcW390dJeb1nfPFk8oFV6ou/Y3+fCIcTOvCuMDjaO851rPMtiXvmY7CMI0U7x0CAYkpMidS3nY2QIbMwkWEB4cLuhECvsuev0/n5u4sZLV2QCz09V08pr4YLL91rEKBwIA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626295120; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=c0nnBaD2pL0VkhpqTi/GSsyBm9vArGbyMPY2G5OiRPc=; b=R9AX9A92MPBuf0qy2MrCaxuaZu5v+TMC3AKNnEarYVvaeuqgCDjAQvr6SkUTl7gMIPvgq597EmDK1Lw+i9zPT3w7ATOxdcTS57RxOz3LH712cFZ+Ui7OdpDW6xH1a39annRHfcj3Sx1/RwnJi0aEblvvNMhq/Qeyd3m5TGttCgo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1626295120579679.8445474504471; Wed, 14 Jul 2021 13:38:40 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.156214.288280 (Exim 4.92) (envelope-from ) id 1m3leE-0000xN-BF; Wed, 14 Jul 2021 20:38:26 +0000 Received: by outflank-mailman (output) from mailman id 156214.288280; Wed, 14 Jul 2021 20:38:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m3leE-0000xE-6T; Wed, 14 Jul 2021 20:38:26 +0000 Received: by outflank-mailman (input) for mailman id 156214; Wed, 14 Jul 2021 20:38:24 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m3leC-0000KG-On for xen-devel@lists.xenproject.org; Wed, 14 Jul 2021 20:38:24 +0000 Received: from mail-pl1-x633.google.com (unknown [2607:f8b0:4864:20::633]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 67347e58-726d-41d7-ba9b-936580e7fb8a; Wed, 14 Jul 2021 20:38:22 +0000 (UTC) Received: by mail-pl1-x633.google.com with SMTP id o8so2042539plg.11 for ; Wed, 14 Jul 2021 13:38:22 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:4c02:4c00::1]) by smtp.gmail.com with ESMTPSA id b17sm1785084pfm.54.2021.07.14.13.38.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jul 2021 13:38:21 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 67347e58-726d-41d7-ba9b-936580e7fb8a 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=c0nnBaD2pL0VkhpqTi/GSsyBm9vArGbyMPY2G5OiRPc=; b=V0YuUm4F5ZL//dA3LzDvyZzAgn0zfz3TOvIZvz8EOy0xECuQfna58kZb7W9q79D8m/ QQvfTsv5f4oy09CL9OFX/pUbFJbiS0JPyrpDm7ZIeOFc03tHvhjacqFZunxegQvJxVmB WQjnhr+AimvtwCNveWncXAvBNLSsKtDkjJ56zwl0vuvSGoYQrCmPm9wuHR1fL+NYEj+k OpgaqU9/snWSMnshvmWgeE5ypPSI9jkydw2wwSuMUUznPcgYgj2MoD4ZKhctTpCGP0jk p4NIcQufdZw5qXPYg8CR2IgQePeonSEjetU8WVuTMLEv5jcUtVzVpN42Wb0Q9/fjtijA G2oA== 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=c0nnBaD2pL0VkhpqTi/GSsyBm9vArGbyMPY2G5OiRPc=; b=ulxZEDi+J2Qsw+fpsb0cZEHB+rTzSpBmoU0wnOq0wmb153sL4S2Aubjpcot6h9u/2x XBb+CPPr9giOGeNqZ8P286RdRzDbMHt//kYsAtuMfbocoBCfZCctldIfBda3Qj4xlOsW 7V+n3j5Aw7d9KA84zSEit5lM26QgVsXv1WzO/XdpGBshW8C3m5zc5B3F0atnx8k4mhKQ 9r9qLiTgUOXZ1fD9YBqoXpuSbyUNAuvb1A5sqLDiR/g0zEHU3meB2bLTANoD8eBDMKs2 2LTu3QRUIzpNIQnPuwJghkAsw32Lv3FZJYAtKkVfh5iJ0zMfutW1BeHOHfOtXuYVOxdq Hr0A== X-Gm-Message-State: AOAM533zfnUwsjtxivp/XOB5sP4E9mPe6hnIZyBxueaRLsqZ9iFLqkJv 9vc5ymaJeeVL22JR/JCWHyriWk9h9SDaIlHU X-Google-Smtp-Source: ABdhPJxSyAq9fc8Va4SaiyXmdltT4t2CxbaMnDmVNqIFS4vO/qscXSfsjUf2o5jXGqG2XTrLJ49R0A== X-Received: by 2002:a17:90b:d8f:: with SMTP id bg15mr5377047pjb.152.1626295101821; Wed, 14 Jul 2021 13:38:21 -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=20Pau=20Monn=C3=A9?= , Jun Nakajima , Kevin Tian Subject: [PATCH v2 3/4] x86/debug: move debugger_trap_entry into debugger.c not inlined Date: Wed, 14 Jul 2021 13:37:46 -0700 Message-Id: X-Mailer: git-send-email 2.30.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1626295122138100006 Content-Type: text/plain; charset="utf-8" The function debugger_trap_entry() is somewhat large for an inlined function. This commit moves debugger_trap_entry() into debugger.c and makes it not inlined. Signed-off-by: Bobby Eshleman Acked-by: Jan Beulich --- Changes in v2: - Move obj-$(CONFIG_CRASH_DEBUG) +=3D debugger.o to be in alphabetical order - Constify cpu_user_regs *regs and struct vcpu *v in debugger_trap_entry() xen/arch/x86/Makefile | 1 + xen/arch/x86/debugger.c | 41 ++++++++++++++++++++++++++++++++++ xen/include/asm-x86/debugger.h | 26 ++------------------- 3 files changed, 44 insertions(+), 24 deletions(-) create mode 100644 xen/arch/x86/debugger.c diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 2ec883456e..c5c9f37570 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -21,6 +21,7 @@ obj-$(CONFIG_PV) +=3D compat.o obj-$(CONFIG_PV32) +=3D x86_64/compat.o obj-$(CONFIG_KEXEC) +=3D crash.o obj-$(CONFIG_GDBSX) +=3D debug.o +obj-$(CONFIG_CRASH_DEBUG) +=3D debugger.o obj-y +=3D delay.o obj-y +=3D desc.o obj-bin-y +=3D dmi_scan.init.o diff --git a/xen/arch/x86/debugger.c b/xen/arch/x86/debugger.c new file mode 100644 index 0000000000..985c1275b4 --- /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, const 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 poin= ter + * to follow. + */ + const struct vcpu *v =3D current; + + if ( vector !=3D TRAP_int3 && vector !=3D TRAP_debug ) + return false; + + if ( guest_mode(regs) && guest_kernel_mode(v, regs) && + v->domain->debugger_attached ) + { + if ( vector !=3D TRAP_debug ) /* domain pause is good enough */ + current->arch.gdbsx_vcpu_event =3D 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 c856c1b795..75e35c7902 100644 --- a/xen/include/asm-x86/debugger.h +++ b/xen/include/asm-x86/debugger.h @@ -31,30 +31,8 @@ static inline bool debugger_trap_fatal( /* Int3 is a trivial way to gather cpu_user_regs context. */ #define debugger_trap_immediate() __asm__ __volatile__ ( "int3" ); =20 -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 poin= ter - * to follow. - */ - struct vcpu *v =3D current; - - if ( vector !=3D TRAP_int3 && vector !=3D TRAP_debug ) - return false; - - if ( guest_mode(regs) && guest_kernel_mode(v, regs) && - v->domain->debugger_attached ) - { - if ( vector !=3D TRAP_debug ) /* domain pause is good enough */ - current->arch.gdbsx_vcpu_event =3D vector; - domain_pause_for_debugger(); - return true; - } - - return false; -} +bool debugger_trap_entry( + unsigned int vector, const struct cpu_user_regs *regs); =20 #ifdef CONFIG_GDBSX unsigned int dbg_rw_mem(unsigned long gva, XEN_GUEST_HANDLE_PARAM(void) bu= f, --=20 2.30.0 From nobody Mon May 6 23:03:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1626295126; cv=none; d=zohomail.com; s=zohoarc; b=aLel6iKPeTEHbi3DmcnWWrYAjjdRp6znJwbFPWZA0Fng7IVmHEXo5f8+CryaSATfv1SLHVQgpRz1buVOUC1kgiIstSgST9IYHJrivKMCsp+VUKa/wA416+5Uq3q6LNqaqLgDkwyIFP93+73ymva7ATuZbLRNcA2YceHXlMw3beg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626295126; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yWceiZFDgebIWTda4wCRP6HVoSGyuXNhbWaAMklJuU4=; b=SJwh985gPfgH7OvuqtakIhmHXcYwFAId8DAnoy/t5eUwkaAYMW5BlTwIiV/LiOLF89wTEGn4ri1u9KyHh5tyTsTXPI6dhRkNVGWoLfG2umXNcuEi6XmC2IWYKjWbHaAmWgbn30T0v8x2yY+z8X5ib4D4fa2IcVKKEh2CZTBUgt8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1626295126752770.8538788978859; Wed, 14 Jul 2021 13:38:46 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.156216.288291 (Exim 4.92) (envelope-from ) id 1m3leJ-0001PA-MZ; Wed, 14 Jul 2021 20:38:31 +0000 Received: by outflank-mailman (output) from mailman id 156216.288291; Wed, 14 Jul 2021 20:38:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m3leJ-0001Ot-IL; Wed, 14 Jul 2021 20:38:31 +0000 Received: by outflank-mailman (input) for mailman id 156216; Wed, 14 Jul 2021 20:38:29 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m3leH-0000KG-P6 for xen-devel@lists.xenproject.org; Wed, 14 Jul 2021 20:38:29 +0000 Received: from mail-pj1-x102e.google.com (unknown [2607:f8b0:4864:20::102e]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b0fc6f99-c991-48af-81dc-bde2f387e0f9; Wed, 14 Jul 2021 20:38:23 +0000 (UTC) Received: by mail-pj1-x102e.google.com with SMTP id me13-20020a17090b17cdb0290173bac8b9c9so4648017pjb.3 for ; Wed, 14 Jul 2021 13:38:23 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:4c02:4c00::1]) by smtp.gmail.com with ESMTPSA id b17sm1785084pfm.54.2021.07.14.13.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jul 2021 13:38:22 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: b0fc6f99-c991-48af-81dc-bde2f387e0f9 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=yWceiZFDgebIWTda4wCRP6HVoSGyuXNhbWaAMklJuU4=; b=hfEkg6QA9LY0LfkLt5VFa/JybLvpNyp0rnCm5h88rFmYdt+6X+5BP1z76USxtHzlm7 iF3mACEVxenNV58/ihKM+C47W5M9ENeZQMvx+bGS2W1ZsYeUc754e3FCBR6PB1IIYL4M GHHkFw0cWN6rjQsgqzZEJ2N1Ix5qBoRatpjkztMzdNH+v8zycQw2koCriewHEL+GPgzx 4APKd0Y2KBVJWiyjUcyrhWuOGCpbaThY+kyiWFMgny7PMEaU8BzZ+G6RV0dRkOI7Q5eO sXxq69m9/nLzj8yn2PTFv9Xz3eTTaeAZvf9GgefwM74cHsYuMRWwU7XkdYx3z0R6Sx92 4WSQ== 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=yWceiZFDgebIWTda4wCRP6HVoSGyuXNhbWaAMklJuU4=; b=AzhjlTHW5/txQUQQsPbN14zK7lZjbWVGiuoTsKqthu4849ivcSGYT5sKfzlLtbwXOi qfrmZYFmZXMBZYzEhIZIAe4KzVtBmILeLYlO5BFuR8vwwMDUMkqwa6ERa9pqzPRUoXCk 3p3gl/gh/kGcxQ8rZYcqd0XjhXnOuwNg2tvDIsvdsO+J5CjTSJg441i0As+6D7xmIleM 9mZye4UjTzaCHJd+MNMBB0+SorgSgZAJ2LE0zPPPHhjie2VVpgmSsfCq/qmH8syUQ/PS 6uoumg3vSIMdghs9a0fWVpO560QpRXvW6MfrRGmxrjRbAwet2iPohirTXQi8vFc9rROB sVrA== X-Gm-Message-State: AOAM533Gqrw4J5/DsF9LSJl9MdOyM4YKDFM+X/mmDUKMVs+YP3w0pYMF JQ+zxAsemk+ZBncHTi4AduvUzY3/Hqrty/BJ X-Google-Smtp-Source: ABdhPJxcv28P9SX6dmui/eaRLIuu9pZdMquhwOF+f/Jq46jqsVCHyEjAilVQ4c2cIAyfR5EdnTGWNA== X-Received: by 2002:a17:90a:2ec1:: with SMTP id h1mr5693893pjs.4.1626295102934; Wed, 14 Jul 2021 13:38:22 -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=20Pau=20Monn=C3=A9?= , Jun Nakajima , Kevin Tian Subject: [PATCH v2 4/4] x86/debug: move domain_pause_for_debugger to debugger.c Date: Wed, 14 Jul 2021 13:37:47 -0700 Message-Id: X-Mailer: git-send-email 2.30.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1626295128748100001 Content-Type: text/plain; charset="utf-8" The function domain_pause_for_debugger() is conditionally compiled if CONFIG_CRASH_DEBUG=3Dy. 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=3Dy. Signed-off-by: Bobby Eshleman Acked-by: Jan Beulich --- Changes in v2: - constify struct vcpu *curr 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 985c1275b4..54e81b99f4 100644 --- a/xen/arch/x86/debugger.c +++ b/xen/arch/x86/debugger.c @@ -15,6 +15,18 @@ #include #include =20 +void domain_pause_for_debugger(void) +{ + const struct vcpu *curr =3D current; + struct domain *d =3D curr->domain; + + domain_pause_by_systemcontroller_nosync(d); + + /* if gdbsx active, we just need to pause the domain */ + if ( curr->arch.gdbsx_vcpu_event =3D=3D 0 ) + send_global_virq(VIRQ_DEBUGGER); +} + bool debugger_trap_entry( unsigned int vector, const struct cpu_user_regs *regs) { diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 5b948ff270..450b2ca831 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); =20 -#ifdef CONFIG_CRASH_DEBUG -void domain_pause_for_debugger(void) -{ - struct vcpu *curr =3D current; - struct domain *d =3D curr->domain; - - domain_pause_by_systemcontroller_nosync(d); - - /* if gdbsx active, we just need to pause the domain */ - if ( curr->arch.gdbsx_vcpu_event =3D=3D 0 ) - send_global_virq(VIRQ_DEBUGGER); -} -#endif - /* * Local variables: * mode: C --=20 2.30.0