All of lore.kernel.org
 help / color / mirror / Atom feed
* BUG: at kernel/sched.c:4031 __schedule()
@ 2007-04-06 13:29 Oleg Kechin
  2007-04-07  7:49 ` Dirk Behme
  0 siblings, 1 reply; 11+ messages in thread
From: Oleg Kechin @ 2007-04-06 13:29 UTC (permalink / raw)
  To: linux-omap-open-source

Hi
I run 2.6.20-rt8 kernel on board like innovator1510 (OMAP5910 cpu)
I notice in boot string:
BUG: at kernel/sched.c:4031 __schedule()
kernel complain interrupts are enabled after schedule.

digging in sched.c I figured out that interrupts are disabled when cpu 
enter __sched(),
but are enabled when it went out.
Playing with the code i can find out, that problem is in the next 
fragment: (line 4024)

    if (likely(prev != next)) {
        next->timestamp = now;
        rq->nr_switches++;
        rq->curr = next;
        ++*switch_count;

        prepare_task_switch(rq, next);
        prev = context_switch(rq, prev, next);
        barrier();
        trace_special_pid(prev->pid, PRIO(prev), PRIO(current));
        /*
         * this_rq must be evaluated again because prev may have moved
         * CPUs since it called schedule(), thus the 'rq' on its stack
         * frame will be invalid.
         */
        finish_task_switch(this_rq(), prev);
        __preempt_enable_no_resched();
    } else {

in prepare_task_switch(rq, next); interrupts are enabled,
but in finish_task_switch(this_rq(), prev); interrupts not disabled
(it look not symmetrical for me).

Can anybody tell - is this right behavior?
I think interrupts should be disabled somewhere in this fragment,
or may be, scheduler should not complain?

Oleg Kechin.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BUG: at kernel/sched.c:4031 __schedule()
  2007-04-06 13:29 BUG: at kernel/sched.c:4031 __schedule() Oleg Kechin
@ 2007-04-07  7:49 ` Dirk Behme
  0 siblings, 0 replies; 11+ messages in thread
From: Dirk Behme @ 2007-04-07  7:49 UTC (permalink / raw)
  To: Oleg Kechin; +Cc: linux-omap-open-source

Oleg Kechin wrote:
> Hi
> I run 2.6.20-rt8 kernel on board like innovator1510 (OMAP5910 cpu)
> I notice in boot string:
> BUG: at kernel/sched.c:4031 __schedule()
> kernel complain interrupts are enabled after schedule.
> 
> digging in sched.c I figured out that interrupts are disabled when cpu 
> enter __sched(),
> but are enabled when it went out.
> Playing with the code i can find out, that problem is in the next 
> fragment: (line 4024)
> 
>    if (likely(prev != next)) {
>        next->timestamp = now;
>        rq->nr_switches++;
>        rq->curr = next;
>        ++*switch_count;
> 
>        prepare_task_switch(rq, next);
>        prev = context_switch(rq, prev, next);
>        barrier();
>        trace_special_pid(prev->pid, PRIO(prev), PRIO(current));
>        /*
>         * this_rq must be evaluated again because prev may have moved
>         * CPUs since it called schedule(), thus the 'rq' on its stack
>         * frame will be invalid.
>         */
>        finish_task_switch(this_rq(), prev);
>        __preempt_enable_no_resched();
>    } else {
> 
> in prepare_task_switch(rq, next); interrupts are enabled,
> but in finish_task_switch(this_rq(), prev); interrupts not disabled
> (it look not symmetrical for me).
> 
> Can anybody tell - is this right behavior?
> I think interrupts should be disabled somewhere in this fragment,
> or may be, scheduler should not complain?

Looks to me that this isn't an OMAP specific question. I 
think linux-rt-users@vger.kernel.org list [1] is a better 
place for this question.

Did you try a more recent -rt patch? They are updated 
frequently with additional fixes.

Regards

Dirk

[1] http://rt.wiki.kernel.org/index.php/Mailinglists

^ permalink raw reply	[flat|nested] 11+ messages in thread

* BUG: at kernel/sched.c:4031 __schedule()
@ 2007-06-07 14:07 Oleg Kechin
  2007-06-07 15:39 ` Steven Rostedt
  0 siblings, 1 reply; 11+ messages in thread
From: Oleg Kechin @ 2007-06-07 14:07 UTC (permalink / raw)
  To: linux-rt-users

Hi
I run 2.6.20-rt8 kernel on board like innovator1510 (OMAP5910 cpu)
I notice in boot string:
BUG: at kernel/sched.c:4031 __schedule()
kernel complain interrupts are enabled after schedule.

digging in sched.c I figured out that interrupts are disabled when cpu 
enter __sched(),
but are enabled when it went out.
Playing with the code i can find out, that problem is in the next 
fragment: (line 4024)

   if (likely(prev != next)) {
       next->timestamp = now;
       rq->nr_switches++;
       rq->curr = next;
       ++*switch_count;

       prepare_task_switch(rq, next);
       prev = context_switch(rq, prev, next);
       barrier();
       trace_special_pid(prev->pid, PRIO(prev), PRIO(current));
       /*
        * this_rq must be evaluated again because prev may have moved
        * CPUs since it called schedule(), thus the 'rq' on its stack
        * frame will be invalid.
        */
       finish_task_switch(this_rq(), prev);
       __preempt_enable_no_resched();
   } else {

in prepare_task_switch(rq, next); interrupts are enabled,
but in finish_task_switch(this_rq(), prev); interrupts not disabled
(it look not symmetrical for me).

Can anybody tell - is this right behavior?
I think interrupts should be disabled somewhere in this fragment,
or may be, scheduler should not complain?

Oleg Kechin.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BUG: at kernel/sched.c:4031 __schedule()
  2007-06-07 14:07 Oleg Kechin
@ 2007-06-07 15:39 ` Steven Rostedt
  2007-06-07 15:58   ` Jan Altenberg
  0 siblings, 1 reply; 11+ messages in thread
From: Steven Rostedt @ 2007-06-07 15:39 UTC (permalink / raw)
  To: Oleg Kechin; +Cc: linux-rt-users

On Thu, 2007-06-07 at 17:07 +0300, Oleg Kechin wrote:

> in prepare_task_switch(rq, next); interrupts are enabled,

That's a bug.  __schedule should not have interrupts enabled.
What's the back trace of this?

-- Steve

> but in finish_task_switch(this_rq(), prev); interrupts not disabled
> (it look not symmetrical for me).
> 
> Can anybody tell - is this right behavior?
> I think interrupts should be disabled somewhere in this fragment,
> or may be, scheduler should not complain?
> 
> Oleg Kechin.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BUG: at kernel/sched.c:4031 __schedule()
  2007-06-07 15:39 ` Steven Rostedt
@ 2007-06-07 15:58   ` Jan Altenberg
  2007-06-07 16:13     ` Steven Rostedt
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Altenberg @ 2007-06-07 15:58 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Oleg Kechin, linux-rt-users, tglx

Hi,

> > in prepare_task_switch(rq, next); interrupts are enabled,
> 
> That's a bug.  __schedule should not have interrupts enabled.
> What's the back trace of this?

I've also seen this in the past. Interrupts are enabled in
prepare_lock_switch because ARM defines __ARCH_WANT_INTERRUPTS_ON_CTXSW.

IIRC Thomas fixed this for the current -rt release.

Cheers,
	Jan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BUG: at kernel/sched.c:4031 __schedule()
  2007-06-07 15:58   ` Jan Altenberg
@ 2007-06-07 16:13     ` Steven Rostedt
  2007-06-07 16:20       ` Daniel Walker
  2007-06-07 16:21       ` Daniel Walker
  0 siblings, 2 replies; 11+ messages in thread
From: Steven Rostedt @ 2007-06-07 16:13 UTC (permalink / raw)
  To: Jan Altenberg; +Cc: Oleg Kechin, linux-rt-users, tglx

On Thu, 2007-06-07 at 17:58 +0200, Jan Altenberg wrote:
> Hi,
> 
> > > in prepare_task_switch(rq, next); interrupts are enabled,
> > 
> > That's a bug.  __schedule should not have interrupts enabled.
> > What's the back trace of this?
> 
> I've also seen this in the past. Interrupts are enabled in
> prepare_lock_switch because ARM defines __ARCH_WANT_INTERRUPTS_ON_CTXSW.
> 

Heh, silly me.  I've been focused so much on x86 that I forgot what
other archs do.

> IIRC Thomas fixed this for the current -rt release.

Thomas, perhaps you want to post the fix.

What arch is innovator1510 (OMAP5910 cpu) anyway?

/me has been away from embedded systems for some time.

-- Steve

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BUG: at kernel/sched.c:4031 __schedule()
  2007-06-07 16:13     ` Steven Rostedt
@ 2007-06-07 16:20       ` Daniel Walker
  2007-06-07 16:21       ` Daniel Walker
  1 sibling, 0 replies; 11+ messages in thread
From: Daniel Walker @ 2007-06-07 16:20 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Jan Altenberg, Oleg Kechin, linux-rt-users, tglx

On Thu, 2007-06-07 at 12:13 -0400, Steven Rostedt wrote:

> 
> What arch is innovator1510 (OMAP5910 cpu) anyway?

It's an ARM .

> /me has been away from embedded systems for some time.
> 

The "fix" went into -rt6 , then was dropped in -rt7 .. I guess a better
fix is being working on, not sure..

Daniel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BUG: at kernel/sched.c:4031 __schedule()
  2007-06-07 16:13     ` Steven Rostedt
  2007-06-07 16:20       ` Daniel Walker
@ 2007-06-07 16:21       ` Daniel Walker
  2007-06-07 16:33         ` Daniel Walker
  1 sibling, 1 reply; 11+ messages in thread
From: Daniel Walker @ 2007-06-07 16:21 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Jan Altenberg, Oleg Kechin, linux-rt-users, tglx

On Thu, 2007-06-07 at 12:13 -0400, Steven Rostedt wrote:
> On Thu, 2007-06-07 at 17:58 +0200, Jan Altenberg wrote:
> > Hi,
> > 
> > > > in prepare_task_switch(rq, next); interrupts are enabled,
> > > 
> > > That's a bug.  __schedule should not have interrupts enabled.
> > > What's the back trace of this?
> > 
> > I've also seen this in the past. Interrupts are enabled in
> > prepare_lock_switch because ARM defines __ARCH_WANT_INTERRUPTS_ON_CTXSW.
> > 
> 
> Heh, silly me.  I've been focused so much on x86 that I forgot what
> other archs do.
> 
> > IIRC Thomas fixed this for the current -rt release.
> 
> Thomas, perhaps you want to post the fix.
> 
> What arch is innovator1510 (OMAP5910 cpu) anyway?
> 
> /me has been away from embedded systems for some time.

I was wrong, I guess it's still in there .. Below I think..

+ *
+ * The new debugging code in __schedule() expects that interrupts
+ * are disabled across a switch_to. Need to investigate which
+ * consequences this has.
  */
-#if 0 // preempt_rt hack, because warn_on in shedule.c triggers
+#ifndef CONFIG_PREEMPT_RT
 #define __ARCH_WANT_INTERRUPTS_ON_CTXSW
 #endif

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BUG: at kernel/sched.c:4031 __schedule()
  2007-06-07 16:21       ` Daniel Walker
@ 2007-06-07 16:33         ` Daniel Walker
  2007-06-08 10:08           ` Oleg Kechin
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Walker @ 2007-06-07 16:33 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Jan Altenberg, Oleg Kechin, linux-rt-users, tglx

On Thu, 2007-06-07 at 09:21 -0700, Daniel Walker wrote:
> .
> 
> + *
> + * The new debugging code in __schedule() expects that interrupts
> + * are disabled across a switch_to. Need to investigate which
> + * consequences this has.
>   */
> -#if 0 // preempt_rt hack, because warn_on in shedule.c triggers
> +#ifndef CONFIG_PREEMPT_RT
>  #define __ARCH_WANT_INTERRUPTS_ON_CTXSW
>  #endif
> 

It is starting to look like a real fix now, thanks for updating it
Thomas .

Daniel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BUG: at kernel/sched.c:4031 __schedule()
  2007-06-07 16:33         ` Daniel Walker
@ 2007-06-08 10:08           ` Oleg Kechin
  2007-06-08 10:52             ` Thomas Gleixner
  0 siblings, 1 reply; 11+ messages in thread
From: Oleg Kechin @ 2007-06-08 10:08 UTC (permalink / raw)
  To: linux-rt-users

On 6/7/07, Daniel Walker <dwalker@mvista.com> wrote:
> On Thu, 2007-06-07 at 09:21 -0700, Daniel Walker wrote:
> > .
> >
> > + *
> > + * The new debugging code in __schedule() expects that interrupts
> > + * are disabled across a switch_to. Need to investigate which
> > + * consequences this has.
> >   */
> > -#if 0 // preempt_rt hack, because warn_on in shedule.c triggers
> > +#ifndef CONFIG_PREEMPT_RT
> >  #define __ARCH_WANT_INTERRUPTS_ON_CTXSW
> >  #endif
> >
>
> It is starting to look like a real fix now, thanks for updating it
> Thomas .
>
> Daniel
>
>
Sorry, OMAP5910 CPU is ARM 925 (v4).
Thank you, Daniel, it's disapear.
There is stil a bit unclearness for me. When I set config other than
PREEMPT_RT this bug occure again.
May be it's ok - if someone want -rt patch on ARM arch, he will want
only PREEMPT_RT or I am wrong?

Oleg Kechin.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BUG: at kernel/sched.c:4031 __schedule()
  2007-06-08 10:08           ` Oleg Kechin
@ 2007-06-08 10:52             ` Thomas Gleixner
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Gleixner @ 2007-06-08 10:52 UTC (permalink / raw)
  To: Oleg Kechin; +Cc: linux-rt-users

On Fri, 2007-06-08 at 13:08 +0300, Oleg Kechin wrote:
> Sorry, OMAP5910 CPU is ARM 925 (v4).
> Thank you, Daniel, it's disapear.
> There is stil a bit unclearness for me. When I set config other than
> PREEMPT_RT this bug occure again.
> May be it's ok - if someone want -rt patch on ARM arch, he will want
> only PREEMPT_RT or I am wrong?

My bad. The check in schedule() is there whether PREEMPT_RT is enabled
or not. I'm going to look at this.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-06-08 10:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-06 13:29 BUG: at kernel/sched.c:4031 __schedule() Oleg Kechin
2007-04-07  7:49 ` Dirk Behme
  -- strict thread matches above, loose matches on Subject: below --
2007-06-07 14:07 Oleg Kechin
2007-06-07 15:39 ` Steven Rostedt
2007-06-07 15:58   ` Jan Altenberg
2007-06-07 16:13     ` Steven Rostedt
2007-06-07 16:20       ` Daniel Walker
2007-06-07 16:21       ` Daniel Walker
2007-06-07 16:33         ` Daniel Walker
2007-06-08 10:08           ` Oleg Kechin
2007-06-08 10:52             ` Thomas Gleixner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.