From nobody Sun May 19 02:38:12 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1559268015; cv=none; d=zoho.com; s=zohoarc; b=jxZnpbSQaAWQ6KX+t7/orfLjCghreyNXV8gdkiNDQekWH9U4iuE35vzsajJkKJS1YYiLSttqrg8LjoF235MdGlMTKrIsZHnKrAvE3fKgQZEiXQzuOVPLYXdHSLnXWyUg8lci6iL1ysBQ7A5EeIlXvjSppFjpoCy5j43FdRZawiQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559268015; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=BXTYLDZLA8J9hP6qGff+9czXp0g/MYJgiJ48kyaUzZg=; b=hHOf+TiH7q5wPChBb0jmknfHduX6aW3Hw22vftY4WkEFA63sDXnxMaz8yQuPvNaYNSZSEHWaDKKIxIDpM4shkDYBbQSeaoeFB1PratXa8JIZ2fuqL70s9/b6ETEhF3Ig9QlJgISLwSfn0GRrgRZUwQtYxQk6013jO6jvA69AmWM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1559268015094523.5924906149874; Thu, 30 May 2019 19:00:15 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hWWoX-0007E3-Nu; Fri, 31 May 2019 01:58:37 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hWWoW-0007Dy-9A for xen-devel@lists.xenproject.org; Fri, 31 May 2019 01:58:36 +0000 Received: from mxnavi-mail.mxnavi.com (unknown [116.90.87.199]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 97ecdd25-8347-11e9-8980-bc764e045a96; Fri, 31 May 2019 01:58:34 +0000 (UTC) Received: from localhost.localdomain (61.161.186.150) by mxnavi-mail.mxnavi.com (116.90.87.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1591.10; Fri, 31 May 2019 09:56:19 +0800 X-Inumbo-ID: 97ecdd25-8347-11e9-8980-bc764e045a96 From: Baodong Chen To: Date: Fri, 31 May 2019 09:58:00 +0800 Message-ID: <1559267880-27863-1-git-send-email-chenbaodong@mxnavi.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [61.161.186.150] X-ClientProxiedBy: mxnavi-mail.mxnavi.com (116.90.87.199) To mxnavi-mail.mxnavi.com (116.90.87.199) Subject: [Xen-devel] [PATCH] xen: make keyhanler configurable 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 , Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Baodong Chen , Dario Faggioli , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" keyhandler mainly used for debug usage by developers which can dump xen module(eg. timer, scheduler) status at runtime by input character from console. Signed-off-by: Baodong Chen --- xen/arch/arm/gic.c | 2 ++ xen/arch/x86/apic.c | 2 ++ xen/common/Kconfig | 9 +++++++++ xen/common/Makefile | 2 +- xen/common/cpupool.c | 2 ++ xen/common/schedule.c | 2 ++ xen/include/xen/keyhandler.h | 14 ++++++++++++++ xen/include/xen/lib.h | 2 ++ xen/include/xen/sched.h | 2 ++ 9 files changed, 36 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 6cc7dec..fff88c5 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -361,7 +361,9 @@ static void do_sgi(struct cpu_user_regs *regs, enum gic= _sgi sgi) /* Nothing to do, will check for events on return path */ break; case GIC_SGI_DUMP_STATE: +#ifdef CONFIG_HAS_KEYHANDLER dump_execstate(regs); +#endif break; case GIC_SGI_CALL_FUNCTION: smp_call_function_interrupt(); diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index fafc0bd..e5f004a 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -1410,7 +1410,9 @@ void spurious_interrupt(struct cpu_user_regs *regs) ack_APIC_irq(); if (this_cpu(state_dump_pending)) { this_cpu(state_dump_pending) =3D false; +#ifdef CONFIG_HAS_KEYHANDLER dump_execstate(regs); +#endif return; } } diff --git a/xen/common/Kconfig b/xen/common/Kconfig index c838506..450541c 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -368,4 +368,13 @@ config DOM0_MEM =20 Leave empty if you are not sure what to specify. =20 +config HAS_KEYHANDLER + bool "Enable/Disable keyhandler" + default y + ---help--- + Enable or disable keyhandler function. + keyhandler mainly used for debug usage by developers which can dump + xen module(eg. timer, scheduler) status at runtime by input character + from console. + endmenu diff --git a/xen/common/Makefile b/xen/common/Makefile index bca48e6..c7bcd26 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -16,7 +16,7 @@ obj-y +=3D guestcopy.o obj-bin-y +=3D gunzip.init.o obj-y +=3D irq.o obj-y +=3D kernel.o -obj-y +=3D keyhandler.o +obj-$(CONFIG_HAS_KEYHANDLER) +=3D keyhandler.o obj-$(CONFIG_KEXEC) +=3D kexec.o obj-$(CONFIG_KEXEC) +=3D kimage.o obj-y +=3D lib.o diff --git a/xen/common/cpupool.c b/xen/common/cpupool.c index 31ac323..721a729 100644 --- a/xen/common/cpupool.c +++ b/xen/common/cpupool.c @@ -699,6 +699,7 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op) return ret; } =20 +#ifdef CONFIG_HAS_KEYHANDLER void dump_runq(unsigned char key) { unsigned long flags; @@ -730,6 +731,7 @@ void dump_runq(unsigned char key) local_irq_restore(flags); spin_unlock(&cpupool_lock); } +#endif =20 static int cpu_callback( struct notifier_block *nfb, unsigned long action, void *hcpu) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 66f1e26..617c444 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -1913,6 +1913,7 @@ void scheduler_free(struct scheduler *sched) xfree(sched); } =20 +#ifdef CONFIG_HAS_KEYHANDLER void schedule_dump(struct cpupool *c) { unsigned int i; @@ -1941,6 +1942,7 @@ void schedule_dump(struct cpupool *c) SCHED_OP(sched, dump_cpu_state, i); } } +#endif =20 void sched_tick_suspend(void) { diff --git a/xen/include/xen/keyhandler.h b/xen/include/xen/keyhandler.h index 5131e86..1050b80 100644 --- a/xen/include/xen/keyhandler.h +++ b/xen/include/xen/keyhandler.h @@ -28,6 +28,7 @@ struct cpu_user_regs; typedef void (irq_keyhandler_fn_t)(unsigned char key, struct cpu_user_regs *regs); =20 +#ifdef CONFIG_HAS_KEYHANDLER /* Initialize keytable with default handlers. */ void initialize_keytable(void); =20 @@ -48,4 +49,17 @@ void register_irq_keyhandler(unsigned char key, /* Inject a keypress into the key-handling subsystem. */ extern void handle_keypress(unsigned char key, struct cpu_user_regs *regs); =20 +#else +static inline void initialize_keytable(void) {} +static inline void register_keyhandler(unsigned char key, keyhandler_fn_t = *fn, + const char *desc, bool_t diagnostic= ) {} +static inline void register_irq_keyhandler(unsigned char key, + irq_keyhandler_fn_t *fn, + const char *desc, + bool_t diagnostic) {} + +static inline void handle_keypress(unsigned char key, + struct cpu_user_regs *regs) {} +#endif + #endif /* __XEN_KEYHANDLER_H__ */ diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h index e0b7bcb..8710305 100644 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -171,8 +171,10 @@ extern unsigned int tainted; extern char *print_tainted(char *str); extern void add_taint(unsigned int taint); =20 +#ifdef CONFIG_HAS_KEYHANDLER struct cpu_user_regs; void dump_execstate(struct cpu_user_regs *); +#endif =20 void init_constructors(void); =20 diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 748bb0f..b82cdee 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -994,8 +994,10 @@ int cpupool_add_domain(struct domain *d, int poolid); void cpupool_rm_domain(struct domain *d); int cpupool_move_domain(struct domain *d, struct cpupool *c); int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op); +#ifdef CONFIG_HAS_KEYHANDLER void schedule_dump(struct cpupool *c); extern void dump_runq(unsigned char key); +#endif =20 void arch_do_physinfo(struct xen_sysctl_physinfo *pi); =20 --=20 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel