linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sched: system doesn't boot since  "sched: Add new migrate_disable() implementation"
@ 2020-10-19 10:21 Christian Eggers
  2020-10-19 15:09 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Eggers @ 2020-10-19 10:21 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Peter Zijlstra, tglx, linux-rt-users, linux-kernel

I have problems with the latest 5.9-rt releases on i.MX6ULL (!CONFIG_SMP):

-rc8-rt13 works fine
-rc8-rt14 doesn't compile (due to CONFIG_FRACE, already fixed in -rt16)
-rt15 dito.
-rt16 compiles, but doesn't boot (no console output at all)

After reverting (on -rt16)

de1c0755e6f9 ("tracing: fix compile failure on RT with PREEMPT_RT off")
30763ce6c15d ("sched: Add new migrate_disable() implementation")

the system boots fine again.

Tracking the problem down showed that calls to wait_for_completion_timeout() 
(e.g. during imx_rngc_probe) will never return. The IRQ routine which should 
fire the completion is not executed, and the call doesn't return after the 
timeout. The IRQ flag on the ARM is not set before entering 
wait_for_completion_timeout(), so CPU interrupts seem to be on.

When building with CONFIG_SMP, the system boots fine.

Any hints?

Best regards
Christian




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

* Re: sched: system doesn't boot since  "sched: Add new migrate_disable() implementation"
  2020-10-19 10:21 sched: system doesn't boot since "sched: Add new migrate_disable() implementation" Christian Eggers
@ 2020-10-19 15:09 ` Sebastian Andrzej Siewior
  2020-10-20 11:30   ` Peter Zijlstra
  0 siblings, 1 reply; 7+ messages in thread
From: Sebastian Andrzej Siewior @ 2020-10-19 15:09 UTC (permalink / raw)
  To: Christian Eggers; +Cc: Peter Zijlstra, tglx, linux-rt-users, linux-kernel

On 2020-10-19 12:21:06 [+0200], Christian Eggers wrote:
> I have problems with the latest 5.9-rt releases on i.MX6ULL (!CONFIG_SMP):
> 
> Any hints?

Thank you for the report. The reason is the migrate_disable()
implementation for !SMP.

> Best regards
> Christian

Sebastian

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

* Re: sched: system doesn't boot since  "sched: Add new migrate_disable() implementation"
  2020-10-19 15:09 ` Sebastian Andrzej Siewior
@ 2020-10-20 11:30   ` Peter Zijlstra
  2020-10-20 11:38     ` Sebastian Andrzej Siewior
  2020-10-20 12:38     ` Christian Eggers
  0 siblings, 2 replies; 7+ messages in thread
From: Peter Zijlstra @ 2020-10-20 11:30 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Christian Eggers, tglx, linux-rt-users, linux-kernel

On Mon, Oct 19, 2020 at 05:09:35PM +0200, Sebastian Andrzej Siewior wrote:
> On 2020-10-19 12:21:06 [+0200], Christian Eggers wrote:
> > I have problems with the latest 5.9-rt releases on i.MX6ULL (!CONFIG_SMP):
> > 
> …
> > Any hints?
> 
> Thank you for the report. The reason is the migrate_disable()
> implementation for !SMP.

This should fix things I suppose. I'll fold it in.

---
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -378,7 +378,12 @@ static inline void preempt_notifier_init
 extern void migrate_disable(void);
 extern void migrate_enable(void);
 
-#else /* !(CONFIG_SMP && CONFIG_PREEMPT_RT) */
+#elif defined(CONFIG_PREEMPT_RT)
+
+static inline void migrate_disable(void) { }
+static inline void migrate_enable(void { }
+
+#else /* !CONFIG_PREEMPT_RT */
 
 /**
  * migrate_disable - Prevent migration of the current task

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

* Re: sched: system doesn't boot since  "sched: Add new migrate_disable() implementation"
  2020-10-20 11:30   ` Peter Zijlstra
@ 2020-10-20 11:38     ` Sebastian Andrzej Siewior
  2020-10-20 11:41       ` Peter Zijlstra
  2020-10-20 12:38     ` Christian Eggers
  1 sibling, 1 reply; 7+ messages in thread
From: Sebastian Andrzej Siewior @ 2020-10-20 11:38 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Christian Eggers, tglx, linux-rt-users, linux-kernel

On 2020-10-20 13:30:09 [+0200], Peter Zijlstra wrote:
> On Mon, Oct 19, 2020 at 05:09:35PM +0200, Sebastian Andrzej Siewior wrote:
> > On 2020-10-19 12:21:06 [+0200], Christian Eggers wrote:
> > > I have problems with the latest 5.9-rt releases on i.MX6ULL (!CONFIG_SMP):
> > > 
> > …
> > > Any hints?
> > 
> > Thank you for the report. The reason is the migrate_disable()
> > implementation for !SMP.
> 
> This should fix things I suppose. I'll fold it in.

It will. It will also break lazy-preemption. Each time a sleeping lock
is acquired there is also migrate_disable() and the migrate-disable
counter is != 0 (even for UP). The result is that a wake up for a
SCHED_OTHER task with mg counter != 0 will not lead to context switch
(same like preemption counter != 0). The difference is that a wake up
for a RT task ignores this counter and perform a context switch anyway.

That way we have RT wake ups on time but avoid stumbling from one lock
to another.

> ---
> --- a/include/linux/preempt.h
> +++ b/include/linux/preempt.h
> @@ -378,7 +378,12 @@ static inline void preempt_notifier_init
>  extern void migrate_disable(void);
>  extern void migrate_enable(void);
>  
> -#else /* !(CONFIG_SMP && CONFIG_PREEMPT_RT) */
> +#elif defined(CONFIG_PREEMPT_RT)
> +
> +static inline void migrate_disable(void) { }
> +static inline void migrate_enable(void { }
> +
> +#else /* !CONFIG_PREEMPT_RT */
>  
>  /**
>   * migrate_disable - Prevent migration of the current task

Sebastian

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

* Re: sched: system doesn't boot since  "sched: Add new migrate_disable() implementation"
  2020-10-20 11:38     ` Sebastian Andrzej Siewior
@ 2020-10-20 11:41       ` Peter Zijlstra
  2020-10-20 11:51         ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Zijlstra @ 2020-10-20 11:41 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Christian Eggers, tglx, linux-rt-users, linux-kernel

On Tue, Oct 20, 2020 at 01:38:28PM +0200, Sebastian Andrzej Siewior wrote:
> On 2020-10-20 13:30:09 [+0200], Peter Zijlstra wrote:
> > On Mon, Oct 19, 2020 at 05:09:35PM +0200, Sebastian Andrzej Siewior wrote:
> > > On 2020-10-19 12:21:06 [+0200], Christian Eggers wrote:
> > > > I have problems with the latest 5.9-rt releases on i.MX6ULL (!CONFIG_SMP):
> > > > 
> > > …
> > > > Any hints?
> > > 
> > > Thank you for the report. The reason is the migrate_disable()
> > > implementation for !SMP.
> > 
> > This should fix things I suppose. I'll fold it in.
> 
> It will. It will also break lazy-preemption. Each time a sleeping lock
> is acquired there is also migrate_disable() and the migrate-disable
> counter is != 0 (even for UP). The result is that a wake up for a
> SCHED_OTHER task with mg counter != 0 will not lead to context switch
> (same like preemption counter != 0). The difference is that a wake up
> for a RT task ignores this counter and perform a context switch anyway.

Right, but this patch set doesn't include the lazy preemption stuff, and
given the 'fun' Valentin and me are still having with it, I'd like to
keep it like that.

But yes, that might warrant a slightly less NOP implementation.

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

* Re: sched: system doesn't boot since  "sched: Add new migrate_disable() implementation"
  2020-10-20 11:41       ` Peter Zijlstra
@ 2020-10-20 11:51         ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 7+ messages in thread
From: Sebastian Andrzej Siewior @ 2020-10-20 11:51 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Christian Eggers, tglx, linux-rt-users, linux-kernel

On 2020-10-20 13:41:37 [+0200], Peter Zijlstra wrote:
> Right, but this patch set doesn't include the lazy preemption stuff, and
> given the 'fun' Valentin and me are still having with it, I'd like to
> keep it like that.
> 
> But yes, that might warrant a slightly less NOP implementation.

Uh. Looking at the actual implementation we don't look at the mg-counter
but have preempt_lazy_disable() for that.
Let me sync your bits then.
Thanks.

Sebastian

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

* Re: sched: system doesn't boot since  "sched: Add new migrate_disable() implementation"
  2020-10-20 11:30   ` Peter Zijlstra
  2020-10-20 11:38     ` Sebastian Andrzej Siewior
@ 2020-10-20 12:38     ` Christian Eggers
  1 sibling, 0 replies; 7+ messages in thread
From: Christian Eggers @ 2020-10-20 12:38 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Sebastian Andrzej Siewior, tglx, linux-rt-users, linux-kernel

On Tuesday, 20 October 2020, 13:30:09 CEST, Peter Zijlstra wrote:
> On Mon, Oct 19, 2020 at 05:09:35PM +0200, Sebastian Andrzej Siewior wrote:
> > On 2020-10-19 12:21:06 [+0200], Christian Eggers wrote:
> > > I have problems with the latest 5.9-rt releases on i.MX6ULL (!
CONFIG_SMP):
> > …
> > 
> > > Any hints?
> > 
> > Thank you for the report. The reason is the migrate_disable()
> > implementation for !SMP.
> 
> This should fix things I suppose. I'll fold it in.
> 
> ---
> --- a/include/linux/preempt.h
> +++ b/include/linux/preempt.h
> @@ -378,7 +378,12 @@ static inline void preempt_notifier_init
>  extern void migrate_disable(void);
>  extern void migrate_enable(void);
> 
> -#else /* !(CONFIG_SMP && CONFIG_PREEMPT_RT) */
> +#elif defined(CONFIG_PREEMPT_RT)
> +
> +static inline void migrate_disable(void) { }
> +static inline void migrate_enable(void { }
closing bracket missing

> +
> +#else /* !CONFIG_PREEMPT_RT */
> 
>  /**
>   * migrate_disable - Prevent migration of the current task

I didn't understand much of you discussion with Sebastian,
but my system is able to boot now.

# uname -r
5.9.0-rt16+

Best regards
Christian




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

end of thread, other threads:[~2020-10-20 12:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19 10:21 sched: system doesn't boot since "sched: Add new migrate_disable() implementation" Christian Eggers
2020-10-19 15:09 ` Sebastian Andrzej Siewior
2020-10-20 11:30   ` Peter Zijlstra
2020-10-20 11:38     ` Sebastian Andrzej Siewior
2020-10-20 11:41       ` Peter Zijlstra
2020-10-20 11:51         ` Sebastian Andrzej Siewior
2020-10-20 12:38     ` Christian Eggers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).