From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>,
linux-rt-users <linux-rt-users@vger.kernel.org>
Subject: Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
Date: Fri, 22 Jan 2016 14:24:29 +0200 [thread overview]
Message-ID: <56A21F7D.9070101@ti.com> (raw)
In-Reply-To: <20160121125405.GA11749@linutronix.de>
On 01/21/2016 02:54 PM, Sebastian Andrzej Siewior wrote:
> * Mike Galbraith | 2016-01-19 03:29:57 [+0100]:
>
>>> And this is a new piece. So you forbid that tasks leave the CPU if
>>> lazy_count > 0. Let me look closed why this is happening and if this is
>>> v4.1 … v4.4 or not.
>>
>> We should probably just add the lazy bits to preemptible().
>
> Subject: preempt-lazy: Add the lazy-preemption check to preempt_schedule()
>
> Probably in the rebase onto v4.1 this check got moved into less commonly used
> preempt_schedule_notrace(). This patch ensures that both functions use it.
>
> Reported-by: Mike Galbraith <umgwanakikbuti@gmail.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> kernel/sched/core.c | 36 ++++++++++++++++++++++++++++--------
> 1 file changed, 28 insertions(+), 8 deletions(-)
>
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -3461,6 +3461,30 @@ static void __sched notrace preempt_sche
> } while (need_resched());
> }
>
> +#ifdef CONFIG_PREEMPT_LAZY
> +/*
> + * If TIF_NEED_RESCHED is then we allow to be scheduled away since this is
> + * set by a RT task. Oterwise we try to avoid beeing scheduled out as long as
> + * preempt_lazy_count counter >0.
> + */
> +static int preemptible_lazy(void)
> +{
> + if (test_thread_flag(TIF_NEED_RESCHED))
> + return 1;
> + if (current_thread_info()->preempt_lazy_count)
> + return 0;
> + return 1;
> +}
> +
> +#else
> +
> +static int preemptible_lazy(void)
> +{
> + return 1;
> +}
> +
> +#endif
> +
> #ifdef CONFIG_PREEMPT
> /*
> * this is the entry point to schedule() from in-kernel preemption
> @@ -3475,6 +3499,8 @@ asmlinkage __visible void __sched notrac
> */
> if (likely(!preemptible()))
> return;
> + if (!preemptible_lazy())
> + return;
>
> preempt_schedule_common();
> }
> @@ -3501,15 +3527,9 @@ asmlinkage __visible void __sched notrac
>
> if (likely(!preemptible()))
> return;
> -
> -#ifdef CONFIG_PREEMPT_LAZY
> - /*
> - * Check for lazy preemption
> - */
> - if (current_thread_info()->preempt_lazy_count &&
> - !test_thread_flag(TIF_NEED_RESCHED))
> + if (!preemptible_lazy())
> return;
> -#endif
> +
> do {
> preempt_disable_notrace();
> /*
I can see below backtrace during boot if i backport this change in K4.1-rt
TI am437x-idk (UP) board.
[ 0.204022] Switched to clocksource arm_global_timer
[ 0.211982] ------------[ cut here ]------------
[ 0.212021] WARNING: CPU: 0 PID: 3 at kernel/softirq.c:894 __tasklet_action+0x150/0x17c()
[ 0.212027] Modules linked in:
[ 0.212041] CPU: 0 PID: 3 Comm: ksoftirqd/0 Not tainted 4.1.15-rt11-00324-g52f8148-dirty #117
[ 0.212046] Hardware name: Generic AM43 (Flattened Device Tree)
[ 0.212052] Backtrace:
[ 0.212080] [<c0012b50>] (dump_backtrace) from [<c0012d70>] (show_stack+0x18/0x1c)
[ 0.212085] r7:c0730a84 r6:0000037e r5:00000009 r4:00000000
[ 0.212112] [<c0012d58>] (show_stack) from [<c05e6940>] (dump_stack+0x20/0x28)
[ 0.212124] [<c05e6920>] (dump_stack) from [<c003713c>] (warn_slowpath_common+0x7c/0xb4)
[ 0.212134] [<c00370c0>] (warn_slowpath_common) from [<c0037218>] (warn_slowpath_null+0x24/0x2c)
[ 0.212138] r8:000f4240 r7:00000000 r6:c0841238 r5:00000018 r4:00000006
[ 0.212156] [<c00371f4>] (warn_slowpath_null) from [<c003a0a4>] (__tasklet_action+0x150/0x17c)
[ 0.212165] [<c0039f54>] (__tasklet_action) from [<c003a138>] (tasklet_action+0x30/0x38)
[ 0.212169] r9:04208140 r8:c0862300 r7:000000c0 r6:c082d774 r5:00000018 r4:00000006
[ 0.212187] [<c003a108>] (tasklet_action) from [<c0039c2c>] (do_current_softirqs+0x190/0x258)
[ 0.212197] [<c0039a9c>] (do_current_softirqs) from [<c003a170>] (run_ksoftirqd+0x30/0x58)
[ 0.212201] r10:00000000 r9:00000000 r8:00000002 r7:c082d8f0 r6:00000001 r5:ee81f740
[ 0.212213] r4:ee874000
[ 0.212227] [<c003a140>] (run_ksoftirqd) from [<c00534e0>] (smpboot_thread_fn+0x15c/0x278)
[ 0.212242] [<c0053384>] (smpboot_thread_fn) from [<c00500fc>] (kthread+0xcc/0xe4)
[ 0.212246] r9:00000000 r8:00000000 r7:c0053384 r6:ee81f740 r5:ee81f780 r4:00000000
[ 0.212265] [<c0050030>] (kthread) from [<c000f988>] (ret_from_fork+0x14/0x2c)
[ 0.212269] r7:00000000 r6:00000000 r5:c0050030 r4:ee81f780
[ 0.212279] ---[ end trace 0000000000000001 ]---
[ 0.212284] softirq: ================== c037d4c4 <---- t->func
^^
# grep c037d4c4 System.map
c037d4c4 t kbd_bh
--
regards,
-grygorii
--
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
WARNING: multiple messages have this Message-ID (diff)
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>,
linux-rt-users <linux-rt-users@vger.kernel.org>
Subject: Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
Date: Fri, 22 Jan 2016 14:24:29 +0200 [thread overview]
Message-ID: <56A21F7D.9070101@ti.com> (raw)
In-Reply-To: <20160121125405.GA11749@linutronix.de>
On 01/21/2016 02:54 PM, Sebastian Andrzej Siewior wrote:
> * Mike Galbraith | 2016-01-19 03:29:57 [+0100]:
>
>>> And this is a new piece. So you forbid that tasks leave the CPU if
>>> lazy_count > 0. Let me look closed why this is happening and if this is
>>> v4.1 … v4.4 or not.
>>
>> We should probably just add the lazy bits to preemptible().
>
> Subject: preempt-lazy: Add the lazy-preemption check to preempt_schedule()
>
> Probably in the rebase onto v4.1 this check got moved into less commonly used
> preempt_schedule_notrace(). This patch ensures that both functions use it.
>
> Reported-by: Mike Galbraith <umgwanakikbuti@gmail.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> kernel/sched/core.c | 36 ++++++++++++++++++++++++++++--------
> 1 file changed, 28 insertions(+), 8 deletions(-)
>
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -3461,6 +3461,30 @@ static void __sched notrace preempt_sche
> } while (need_resched());
> }
>
> +#ifdef CONFIG_PREEMPT_LAZY
> +/*
> + * If TIF_NEED_RESCHED is then we allow to be scheduled away since this is
> + * set by a RT task. Oterwise we try to avoid beeing scheduled out as long as
> + * preempt_lazy_count counter >0.
> + */
> +static int preemptible_lazy(void)
> +{
> + if (test_thread_flag(TIF_NEED_RESCHED))
> + return 1;
> + if (current_thread_info()->preempt_lazy_count)
> + return 0;
> + return 1;
> +}
> +
> +#else
> +
> +static int preemptible_lazy(void)
> +{
> + return 1;
> +}
> +
> +#endif
> +
> #ifdef CONFIG_PREEMPT
> /*
> * this is the entry point to schedule() from in-kernel preemption
> @@ -3475,6 +3499,8 @@ asmlinkage __visible void __sched notrac
> */
> if (likely(!preemptible()))
> return;
> + if (!preemptible_lazy())
> + return;
>
> preempt_schedule_common();
> }
> @@ -3501,15 +3527,9 @@ asmlinkage __visible void __sched notrac
>
> if (likely(!preemptible()))
> return;
> -
> -#ifdef CONFIG_PREEMPT_LAZY
> - /*
> - * Check for lazy preemption
> - */
> - if (current_thread_info()->preempt_lazy_count &&
> - !test_thread_flag(TIF_NEED_RESCHED))
> + if (!preemptible_lazy())
> return;
> -#endif
> +
> do {
> preempt_disable_notrace();
> /*
I can see below backtrace during boot if i backport this change in K4.1-rt
TI am437x-idk (UP) board.
[ 0.204022] Switched to clocksource arm_global_timer
[ 0.211982] ------------[ cut here ]------------
[ 0.212021] WARNING: CPU: 0 PID: 3 at kernel/softirq.c:894 __tasklet_action+0x150/0x17c()
[ 0.212027] Modules linked in:
[ 0.212041] CPU: 0 PID: 3 Comm: ksoftirqd/0 Not tainted 4.1.15-rt11-00324-g52f8148-dirty #117
[ 0.212046] Hardware name: Generic AM43 (Flattened Device Tree)
[ 0.212052] Backtrace:
[ 0.212080] [<c0012b50>] (dump_backtrace) from [<c0012d70>] (show_stack+0x18/0x1c)
[ 0.212085] r7:c0730a84 r6:0000037e r5:00000009 r4:00000000
[ 0.212112] [<c0012d58>] (show_stack) from [<c05e6940>] (dump_stack+0x20/0x28)
[ 0.212124] [<c05e6920>] (dump_stack) from [<c003713c>] (warn_slowpath_common+0x7c/0xb4)
[ 0.212134] [<c00370c0>] (warn_slowpath_common) from [<c0037218>] (warn_slowpath_null+0x24/0x2c)
[ 0.212138] r8:000f4240 r7:00000000 r6:c0841238 r5:00000018 r4:00000006
[ 0.212156] [<c00371f4>] (warn_slowpath_null) from [<c003a0a4>] (__tasklet_action+0x150/0x17c)
[ 0.212165] [<c0039f54>] (__tasklet_action) from [<c003a138>] (tasklet_action+0x30/0x38)
[ 0.212169] r9:04208140 r8:c0862300 r7:000000c0 r6:c082d774 r5:00000018 r4:00000006
[ 0.212187] [<c003a108>] (tasklet_action) from [<c0039c2c>] (do_current_softirqs+0x190/0x258)
[ 0.212197] [<c0039a9c>] (do_current_softirqs) from [<c003a170>] (run_ksoftirqd+0x30/0x58)
[ 0.212201] r10:00000000 r9:00000000 r8:00000002 r7:c082d8f0 r6:00000001 r5:ee81f740
[ 0.212213] r4:ee874000
[ 0.212227] [<c003a140>] (run_ksoftirqd) from [<c00534e0>] (smpboot_thread_fn+0x15c/0x278)
[ 0.212242] [<c0053384>] (smpboot_thread_fn) from [<c00500fc>] (kthread+0xcc/0xe4)
[ 0.212246] r9:00000000 r8:00000000 r7:c0053384 r6:ee81f740 r5:ee81f780 r4:00000000
[ 0.212265] [<c0050030>] (kthread) from [<c000f988>] (ret_from_fork+0x14/0x2c)
[ 0.212269] r7:00000000 r6:00000000 r5:c0050030 r4:ee81f780
[ 0.212279] ---[ end trace 0000000000000001 ]---
[ 0.212284] softirq: ================== c037d4c4 <---- t->func
^^
# grep c037d4c4 System.map
c037d4c4 t kbd_bh
--
regards,
-grygorii
next prev parent reply other threads:[~2016-01-22 12:24 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-18 9:08 [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port Mike Galbraith
2016-01-18 20:18 ` Sebastian Andrzej Siewior
2016-01-19 2:29 ` Mike Galbraith
2016-01-19 2:29 ` Mike Galbraith
2016-01-21 12:54 ` Sebastian Andrzej Siewior
2016-01-22 12:24 ` Grygorii Strashko [this message]
2016-01-22 12:24 ` Grygorii Strashko
2016-01-22 13:19 ` Sebastian Andrzej Siewior
2016-01-22 13:34 ` Grygorii Strashko
2016-01-22 14:14 ` Sebastian Andrzej Siewior
2016-01-22 15:04 ` Grygorii Strashko
2016-01-22 18:21 ` Grygorii Strashko
2016-02-21 15:11 ` [patch] sched,rt: __always_inline preemptible_lazy() Mike Galbraith
2016-01-19 4:41 ` [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port Mike Galbraith
2016-01-19 4:41 ` Mike Galbraith
2016-01-19 5:14 ` Mike Galbraith
2016-01-19 5:14 ` Mike Galbraith
2016-01-22 11:58 ` Grygorii Strashko
2016-01-22 11:58 ` Grygorii Strashko
2016-01-22 12:54 ` Sebastian Andrzej Siewior
2016-01-22 12:54 ` Sebastian Andrzej Siewior
2016-01-22 20:40 ` Sebastian Andrzej Siewior
2016-01-25 17:14 ` Grygorii Strashko
2016-02-01 13:04 ` Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56A21F7D.9070101@ti.com \
--to=grygorii.strashko@ti.com \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=umgwanakikbuti@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.