From patchwork Thu Dec 19 07:42:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juergen Gross X-Patchwork-Id: 11302741 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D374921 for ; Thu, 19 Dec 2019 07:43: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 52E592146E for ; Thu, 19 Dec 2019 07:43:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52E592146E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihqRv-0001Vs-VF; Thu, 19 Dec 2019 07:42:19 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihqRv-0001Vn-98 for xen-devel@lists.xenproject.org; Thu, 19 Dec 2019 07:42:19 +0000 X-Inumbo-ID: 13f5ac36-2233-11ea-915d-12813bfff9fa Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 13f5ac36-2233-11ea-915d-12813bfff9fa; Thu, 19 Dec 2019 07:42:16 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 689B2B281; Thu, 19 Dec 2019 07:42:15 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Thu, 19 Dec 2019 08:42:08 +0100 Message-Id: <20191219074209.17277-2-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191219074209.17277-1-jgross@suse.com> References: <20191219074209.17277-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v3 1/2] xen: put more code under CONFIG_CRASH_DEBUG X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Kevin Tian , Stefano Stabellini , Julien Grall , Jun Nakajima , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Some code is not needed with CONFIG_CRASH_DEBUG, so only include it if CONFIG_CRASH_DEBUG is defined. While at it remove CONFIG_HAS_GDBSX as it can easily be replaced by CONFIG_CRASH_DEBUG. Signed-off-by: Juergen Gross Acked-by: George Dunlap --- V3: - move domain_pause_for_debugger() into arch/x86/domain.c (Andrew Cooper) --- xen/arch/x86/Kconfig | 1 - xen/arch/x86/domain.c | 13 +++++++++++++ xen/arch/x86/hvm/vmx/realmode.c | 1 + xen/common/Kconfig | 3 --- xen/common/domain.c | 14 -------------- xen/include/asm-x86/debugger.h | 32 ++++++++++++++++++++------------ xen/include/xen/sched.h | 1 - 7 files changed, 34 insertions(+), 31 deletions(-) diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index 02bb05f42e..f853c04564 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -13,7 +13,6 @@ config X86 select HAS_EHCI select HAS_EX_TABLE select HAS_FAST_MULTIPLY - select HAS_GDBSX select HAS_IOPORTS select HAS_KEXEC select MEM_ACCESS_ALWAYS_ON diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 7cb7fd31dd..3a3fbde642 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -2318,6 +2318,19 @@ static int __init init_vcpu_kick_softirq(void) } __initcall(init_vcpu_kick_softirq); +void domain_pause_for_debugger(void) +{ +#ifdef CONFIG_CRASH_DEBUG + 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: diff --git a/xen/arch/x86/hvm/vmx/realmode.c b/xen/arch/x86/hvm/vmx/realmode.c index bb0b4439df..bdbd9cb921 100644 --- a/xen/arch/x86/hvm/vmx/realmode.c +++ b/xen/arch/x86/hvm/vmx/realmode.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 2f516da101..b3d161d057 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -57,9 +57,6 @@ config HAS_UBSAN config HAS_KEXEC bool -config HAS_GDBSX - bool - config HAS_IOPORTS bool diff --git a/xen/common/domain.c b/xen/common/domain.c index 611116c7fc..3a77d717db 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -915,20 +915,6 @@ void vcpu_end_shutdown_deferral(struct vcpu *v) vcpu_check_shutdown(v); } -#ifdef CONFIG_HAS_GDBSX -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 - /* Complete domain destroy after RCU readers are not holding old references. */ static void complete_domain_destroy(struct rcu_head *head) { diff --git a/xen/include/asm-x86/debugger.h b/xen/include/asm-x86/debugger.h index b1b627f1fa..f58726daec 100644 --- a/xen/include/asm-x86/debugger.h +++ b/xen/include/asm-x86/debugger.h @@ -33,6 +33,8 @@ #include #include +void domain_pause_for_debugger(void); + #ifdef CONFIG_CRASH_DEBUG #include @@ -47,18 +49,6 @@ static inline bool debugger_trap_fatal( /* Int3 is a trivial way to gather cpu_user_regs context. */ #define debugger_trap_immediate() __asm__ __volatile__ ( "int3" ); -#else - -static inline bool debugger_trap_fatal( - unsigned int vector, struct cpu_user_regs *regs) -{ - return false; -} - -#define debugger_trap_immediate() ((void)0) - -#endif - static inline bool debugger_trap_entry( unsigned int vector, struct cpu_user_regs *regs) { @@ -84,6 +74,24 @@ 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 + unsigned int dbg_rw_mem(void * __user addr, void * __user buf, unsigned int len, domid_t domid, bool toaddr, uint64_t pgd3); diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 9f7bc69293..0b41e936d5 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -652,7 +652,6 @@ void domain_destroy(struct domain *d); int domain_kill(struct domain *d); int domain_shutdown(struct domain *d, u8 reason); void domain_resume(struct domain *d); -void domain_pause_for_debugger(void); int domain_soft_reset(struct domain *d);