Hello.

Jason Wessel wrote:
>  > -----Original Message-----
>  > From: Sergei Shtylyov [mailto:[EMAIL PROTECTED]
>  > >>>+
>  > >>>     if(!CHECK_EXCEPTION_STACK()) {
>  >
>  >     Worth fixing if stmt style while at it. :-)
>  >

> Noted and adjusted.

> Attached are the patches to be committed to core-lite.patch in the 
> 2.6.21_uprev branch.

> Now that this is tested and confirmed to work, these will be committed 
> with in the hour.

    Looks like one of the patches could still use a bit cleanup -- sorry for 
not noticing this yesterday... :-/

> Thanks,
> Jason.

> ------------------------------------------------------------------------
> 
> 
> Remove the breakpoint tasklet from the early initialization and defer
> breakpoints to the late_init.  
> 
> On SMP x86_64 in particular scheduling
> a tasklet too early can result in a silent death hang in the system,
> as there is a race to setup the exception stack vs the schduling
> context vs kgdb having the ability to debug the exception.

> Signed-off-by: Jason Wessel <[EMAIL PROTECTED]>

> ---
>  kernel/kgdb.c |   15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> Index: linux-2.6.21-standard/kernel/kgdb.c
> ===================================================================
> --- linux-2.6.21-standard.orig/kernel/kgdb.c
> +++ linux-2.6.21-standard/kernel/kgdb.c
> @@ -1670,7 +1670,7 @@ void kgdb_unregister_io_module(struct kg
>   */
>  static void kgdb_tasklet_bpt(unsigned long ing)
>  {
> -     if(CHECK_EXCEPTION_STACK())
> +     if (CHECK_EXCEPTION_STACK())
>               breakpoint();
>  }
>  
> @@ -1682,20 +1682,21 @@ DECLARE_TASKLET(kgdb_tasklet_breakpoint,
>   */
>  static void __init kgdb_early_entry(void)
>  {
> +     /* Let the architecture do any setup that it needs to. */
> +     kgdb_arch_init();
> +
>       /*
>        * Don't try and do anything until the architecture is able to
>        * setup the exception stack.  In this case, it is up to the
>        * architecture to hook in and look at us when they are ready.
>        */
> -     if(!CHECK_EXCEPTION_STACK()) {
> +
> +     if (!CHECK_EXCEPTION_STACK()) {
>               kgdb_initialized = -1;
> -             tasklet_schedule(&kgdb_tasklet_breakpoint);
> +             /* any kind of break point is deferred to late_init */
>               return;
>       }
>  
> -     /* Let the architecture do any setup that it needs to. */
> -     kgdb_arch_init();
> -
>       /* Now try the I/O. */
>       /* For early entry kgdb_io_ops.init must be defined */
>       if (!kgdb_io_ops.init || kgdb_io_ops.init()) {
> @@ -1879,7 +1880,7 @@ static int __init opt_kgdb_enter(char *s
>                              "gdb...\n");
>               else {
>                       printk(KERN_CRIT "KGDB cannot initialize I/O yet.\n");
> -                     return;
> +                     return 0;

    Hm, and how it compiled before?

>               }
>       }

> ------------------------------------------------------------------------

> This patch moves the early initialization code into a .init_text section
> vs having the possibility to call a function that has been deleted after
> the .init_text has been destroyed. 

> In general this cannot happen but it does fix the compiler's concern about
> the possibility for it to happen.

> Signed-off-by: Jason Wessel <[EMAIL PROTECTED]>

> ---
>  kernel/kgdb.c |   23 +++++++++++------------
>  1 file changed, 11 insertions(+), 12 deletions(-)

> Index: linux-2.6.21-standard/kernel/kgdb.c
> ===================================================================
> --- linux-2.6.21-standard.orig/kernel/kgdb.c
> +++ linux-2.6.21-standard/kernel/kgdb.c
> @@ -1788,17 +1788,6 @@ late_initcall(kgdb_late_entry);
>   */
>  void breakpoint(void)
>  {
> -     if (kgdb_initialized != 1) {
> -             kgdb_early_entry();
> -             if (kgdb_initialized == 1)
> -                     printk(KERN_CRIT "Waiting for connection from remote "
> -                            "gdb...\n");
> -             else {
> -                     printk(KERN_CRIT "KGDB cannot initialize I/O yet.\n");
> -                     return;
> -             }
> -     }
> -
>       atomic_set(&kgdb_setting_breakpoint, 1);
>       wmb();
>       BREAKPOINT();
> @@ -1883,7 +1872,17 @@ static int __init opt_kgdb_enter(char *s
>       if (kgdb_initialized)
>               return 0;
>  
> -     /* Call breakpoint() which will take care of init. */
> +     if (kgdb_initialized != 1) {

    Note that this check completely is superfluous here, i.e. the condition 
would always be true after the first if stmt.

> +             kgdb_early_entry();
> +             if (kgdb_initialized == 1)
> +                     printk(KERN_CRIT "Waiting for connection from remote "
> +                            "gdb...\n");
> +             else {
> +                     printk(KERN_CRIT "KGDB cannot initialize I/O yet.\n");
> +                     return;
> +             }
> +     }
> +
>       breakpoint();
> 
>       return 0;

WBR, Sergei

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to