RE: Disable modem's watchdog when kernel debugging with KGDB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Joey,

Check kernel/kgdb.c. That code should be there.
It was moved to kernel/debug/debug_core.c in kernel 2.6.35: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=c433820971ffa854feda6adc17f5f24201354f11

Best Regards 
Michal Frynas


-----Original Message-----
From: joey.jiaojg [mailto:joey.jiaojg@xxxxxxxxx] 
Sent: 28 marca 2012 03:34
To: Frynas Michal K
Subject: Re: Disable modem's watchdog when kernel debugging with KGDB

Hi Michal,
I want to try you method.
But I don't have kernel/debug/debug_core.c in kernel 2.6.32 from caf.

On 2012年03月23日 17:56, Michal.K.Frynas@xxxxxxxxx wrote:
> Hi,
>
> I was trying to launch KGDB kernel debugging on MSM 8255 platform.
> It works now but I needed to apply a few patches. Among other things
> I needed to neutralized AMSS' watchdog for the time the linux kernel
> spends on breakpoint. Please have a look at the patch below with code
> of a driver controlling modem's watchdog.
>
> It might be useful for everyone willing to debug the kernel
> on Qualcomm's platform.
>
> For it to work there's another patch needed. The patch I've posted
> on KGDB mailing list: http://sourceforge.net/mailarchive/message.php?msg_id=28955742
> It adds hooks for architecture specific pre and post breakpoint
> handlers and invocations before and after the breakpoint.
>
> Best Regards
> Michal Frynas
>
>
>  From 077f79c950f15ba0f4af08381b16d093a17c3354 Mon Sep 17 00:00:00 2001
> From: Michal Frynas<michal.frynas@xxxxxxxxx>
> Date: Wed, 7 Mar 2012 12:59:28 +0100
> Subject: [PATCH] KGDB: modem watchdog immunization against kernel stopping
>
> On Qualcomm's MSM 8255 platform there are two processors running
> simultaneously and synchronizing constantly with each other.
> The ARM11 CPU executes Linux code while the ARM9 executes modem code.
>
> While debugging Linux code and stopping kernel on a breakpoint
> the synchronization breaks causing modem CPU to trigger hard reset.
> To avoid this modem_watchdog_control driver registers pre_exception
> handler where it instructs modem watchdog to ignore timing issues
> from Linux side. That handler is invoked every time the kernel enters
> breakpoint and then when leaving breakpoint post_exception handler is
> called restoring modem watchdog to its default behavior.
>
> Change-Id: I8ab73b1c8edcec1fe89b0d2f2dfbd03f0a617f57
> Signed-off-by: Michal Frynas<michal.k.frynas@xxxxxxxxx>
> ---
>   arch/arm/mach-msm/Makefile                 |    2 +
>   arch/arm/mach-msm/modem_watchdog_control.c |   35 +++++++++++++++++++
>   arch/arm/mach-msm/modem_watchdog_control.h |   50 ++++++++++++++++++++++++++++
>   3 files changed, 87 insertions(+), 0 deletions(-)
>   create mode 100644 arch/arm/mach-msm/modem_watchdog_control.c
>   create mode 100644 arch/arm/mach-msm/modem_watchdog_control.h
>
> diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
> index 7ce284d..9984467 100755
> --- a/arch/arm/mach-msm/Makefile
> +++ b/arch/arm/mach-msm/Makefile
> @@ -208,3 +208,5 @@ endif
>   obj-$(CONFIG_PMIC_TIME) += pmic_time.o
>
>   obj-$(CONFIG_SEMC_MOGAMI_FELICA_SUPPORT) += semc_mogami_felica.o
> +
> +obj-$(CONFIG_KGDB) += modem_watchdog_control.o
> diff --git a/arch/arm/mach-msm/modem_watchdog_control.c b/arch/arm/mach-msm/modem_watchdog_control.c
> new file mode 100644
> index 0000000..d64ae7e
> --- /dev/null
> +++ b/arch/arm/mach-msm/modem_watchdog_control.c
> @@ -0,0 +1,35 @@
> +#include<proc_comm.h>
> +#include<modem_watchdog_control.h>
> +
> +
> +static int modem_watchdog_state;
> +
> +void modem_watchdog_disable(void)
> +{
> +	pr_info("kgdb: disabling modem watchdog on breakpoint\n");
> +	modem_watchdog_state = DOG_HALT_MONITORING;
> +	msm_proc_comm(PCOM_SET_SW_WATCHDOG_STATE,&modem_watchdog_state, 0);
> +}
> +
> +void modem_watchdog_enable(void)
> +{
> +	pr_info("kgdb: reenabling modem watchdog\n");
> +	modem_watchdog_state = DOG_DEFAULT_STATE;
> +	msm_proc_comm(PCOM_SET_SW_WATCHDOG_STATE,&modem_watchdog_state, 0);
> +}
> +
> +int get_modem_watchdog_state(void)
> +{
> +	return modem_watchdog_state;
> +}
> +
> +static int __init modem_watchdog_control_init(void)
> +{
> +	pr_info("kgdb: initializing modem watchdog control module\n");
> +	arch_kgdb_ops.pre_exception = modem_watchdog_disable;
> +	arch_kgdb_ops.post_exception = modem_watchdog_enable;
> +
> +	return 0;
> +}
> +
> +late_initcall(modem_watchdog_control_init);
> diff --git a/arch/arm/mach-msm/modem_watchdog_control.h b/arch/arm/mach-msm/modem_watchdog_control.h
> new file mode 100644
> index 0000000..a42a350
> --- /dev/null
> +++ b/arch/arm/mach-msm/modem_watchdog_control.h
> @@ -0,0 +1,50 @@
> +#ifndef MODEM_WATCHDOG_CONTROL_H_
> +#define MODEM_WATCHDOG_CONTROL_H_
> +
> +#include<linux/kgdb.h>
> +
> +/*----------------------------------------------------------------------------
> +    Bits indicating watch dog state as set by remote processors
> +    Copied from AMSS source codes:
> +    amss/AMSS/products/7x30/core/debugtools/task/src/dog.c
> +----------------------------------------------------------------------------*/
> +
> +/*
> + *  Remote proc is requesting dog task to resume its default state
> + */
> +#define DOG_DEFAULT_STATE                       0x00000000
> +
> +/*
> + * Remote proc is requesting dog monitoring to be halted/enabled
> + */
> +#define DOG_HALT_MONITORING                     0x00000001
> +
> +/* Remote proc is requesting dog task to setup/clear conditions for
> + * entering modem halt state (timer based)
> + */
> +#define DOG_HALT_MODEM                          0x00000002
> +
> +/*
> + * Needed for pre_breakpoint and post_breakpoing hooks.
> + */
> +extern struct kgdb_arch		arch_kgdb_ops;
> +
> +/*
> + * Sends DOG_HALT_MONITORING value to modem site causing the modem watchdog
> + * ignoring tasks timeouts while still kicking the hardware watchdog.
> + */
> +extern void modem_watchdog_disable(void);
> +
> +/*
> + * Sends DOG_DEFAULT_STATE value to modem site causing the modem watchdog
> + * to resume its default tasks processing.
> + */
> +extern void modem_watchdog_enable(void);
> +
> +/*
> + * Returns current status of modem watchdog.
> + */
> +extern int get_modem_watchdog_state(void);
> +
> +
> +#endif /* MODEM_WATCHDOG_CONTROL_H_ */

��.n��������+%������w��{.n�����{���)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux