linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
@ 2016-01-18  9:08 Mike Galbraith
  2016-01-18 20:18 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 18+ messages in thread
From: Mike Galbraith @ 2016-01-18  9:08 UTC (permalink / raw)
  To: Thomas Gleixner, Sebastian Andrzej Siewior; +Cc: LKML, linux-rt-users


pre:
preempt lazy enabled
homer:/root # taskset -c 7 pipe-test 1
2.618038 usecs/loop -- avg 2.618038 763.9 KHz
2.620658 usecs/loop -- avg 2.618300 763.9 KHz
2.618775 usecs/loop -- avg 2.618347 763.8 KHz
2.618819 usecs/loop -- avg 2.618395 763.8 KHz
2.619269 usecs/loop -- avg 2.618482 763.8 KHz

tbench
Throughput 2612.9 MB/sec 8 procs

preempt lazy disabled
homer:/root # taskset -c 7 pipe-test 1
1.771921 usecs/loop -- avg 1.771921 1128.7 KHz
1.782686 usecs/loop -- avg 1.772998 1128.0 KHz
1.785444 usecs/loop -- avg 1.774242 1127.2 KHz
1.787388 usecs/loop -- avg 1.775557 1126.4 KHz
1.770772 usecs/loop -- avg 1.775078 1126.7 KHz

tbench
Throughput 2626.91 MB/sec 8 procs

post:
preempt lazy enabled
homer:/root # taskset -c 7 pipe-test 1
1.485592 usecs/loop -- avg 1.485592 1346.3 KHz
1.489640 usecs/loop -- avg 1.485997 1345.9 KHz
1.488325 usecs/loop -- avg 1.486230 1345.7 KHz
1.484632 usecs/loop -- avg 1.486070 1345.8 KHz
1.484889 usecs/loop -- avg 1.485952 1345.9 KHz

tbench
Throughput 3091.84 MB/sec 8 procs

preempt lazy disabled
homer:/root # taskset -c 7 pipe-test 1
1.579723 usecs/loop -- avg 1.579723 1266.0 KHz
1.562026 usecs/loop -- avg 1.577953 1267.5 KHz
1.546090 usecs/loop -- avg 1.574767 1270.0 KHz
1.543852 usecs/loop -- avg 1.571675 1272.5 KHz
1.546313 usecs/loop -- avg 1.569139 1274.6 KHz

tbench
Throughput 2649.65 MB/sec 8 procs

Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
---
 arch/x86/entry/common.c |    4 ++--
 kernel/sched/core.c     |    9 +++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -220,14 +220,14 @@ long syscall_trace_enter(struct pt_regs
 
 #define EXIT_TO_USERMODE_LOOP_FLAGS				\
 	(_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_UPROBE |	\
-	 _TIF_NEED_RESCHED | _TIF_USER_RETURN_NOTIFY)
+	 _TIF_NEED_RESCHED_MASK | _TIF_USER_RETURN_NOTIFY)
 
 static void exit_to_usermode_loop(struct pt_regs *regs, u32 cached_flags)
 {
 	/*
 	 * In order to return to user mode, we need to have IRQs off with
 	 * none of _TIF_SIGPENDING, _TIF_NOTIFY_RESUME, _TIF_USER_RETURN_NOTIFY,
-	 * _TIF_UPROBE, or _TIF_NEED_RESCHED set.  Several of these flags
+	 * _TIF_UPROBE, or _TIF_NEED_RESCHED_MASK set.  Several of these flags
 	 * can be set at any time on preemptable kernels if we have IRQs on,
 	 * so we need to loop.  Disabling preemption wouldn't help: doing the
 	 * work to clear some of the flags can sleep.
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3542,6 +3542,15 @@ 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))
+		return;
+#endif
+
 	preempt_schedule_common();
 }
 NOKPROBE_SYMBOL(preempt_schedule);

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

* Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
  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
                     ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-01-18 20:18 UTC (permalink / raw)
  To: Mike Galbraith; +Cc: Thomas Gleixner, LKML, linux-rt-users

* Mike Galbraith | 2016-01-18 10:08:23 [+0100]:

>--- a/arch/x86/entry/common.c
>+++ b/arch/x86/entry/common.c
>@@ -220,14 +220,14 @@ long syscall_trace_enter(struct pt_regs
> 
> #define EXIT_TO_USERMODE_LOOP_FLAGS				\
> 	(_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_UPROBE |	\
>-	 _TIF_NEED_RESCHED | _TIF_USER_RETURN_NOTIFY)
>+	 _TIF_NEED_RESCHED_MASK | _TIF_USER_RETURN_NOTIFY)
> 

If I read this right, the loop where this define is used
_TIF_ALLWORK_MASK in v4.1 of which _TIF_NEED_RESCHED_MASK was part of.
Adding this will reassmeble the old behaviour.
…

>--- a/kernel/sched/core.c
>+++ b/kernel/sched/core.c
>@@ -3542,6 +3542,15 @@ 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))
>+		return;
>+#endif
>+

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.

> 	preempt_schedule_common();
> }
> NOKPROBE_SYMBOL(preempt_schedule);

Sebastian

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

* Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
  2016-01-18 20:18 ` Sebastian Andrzej Siewior
@ 2016-01-19  2:29   ` Mike Galbraith
  2016-01-21 12:54     ` Sebastian Andrzej Siewior
  2016-01-19  4:41   ` [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port Mike Galbraith
  2016-01-22 11:58   ` Grygorii Strashko
  2 siblings, 1 reply; 18+ messages in thread
From: Mike Galbraith @ 2016-01-19  2:29 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: Thomas Gleixner, LKML, linux-rt-users

On Mon, 2016-01-18 at 21:18 +0100, Sebastian Andrzej Siewior wrote:

> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -3542,6 +3542,15 @@ 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))
> > +		return;
> > +#endif
> > +
> 
> 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().

	-Mike
--
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] 18+ messages in thread

* Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
  2016-01-18 20:18 ` Sebastian Andrzej Siewior
  2016-01-19  2:29   ` Mike Galbraith
@ 2016-01-19  4:41   ` Mike Galbraith
  2016-01-19  5:14     ` Mike Galbraith
  2016-01-22 11:58   ` Grygorii Strashko
  2 siblings, 1 reply; 18+ messages in thread
From: Mike Galbraith @ 2016-01-19  4:41 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: Thomas Gleixner, LKML, linux-rt-users

On Mon, 2016-01-18 at 21:18 +0100, Sebastian Andrzej Siewior wrote:

> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -3542,6 +3542,15 @@ 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))
> > +		return;
> > +#endif
> > +
> 
> 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.

That check wants a !rt_task(current) qualifier anyway.

	-Mike
--
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] 18+ messages in thread

* Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
  2016-01-19  4:41   ` [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port Mike Galbraith
@ 2016-01-19  5:14     ` Mike Galbraith
  0 siblings, 0 replies; 18+ messages in thread
From: Mike Galbraith @ 2016-01-19  5:14 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: Thomas Gleixner, LKML, linux-rt-users

On Tue, 2016-01-19 at 05:41 +0100, Mike Galbraith wrote:
> On Mon, 2016-01-18 at 21:18 +0100, Sebastian Andrzej Siewior wrote:
> 
> > > --- a/kernel/sched/core.c
> > > +++ b/kernel/sched/core.c
> > > @@ -3542,6 +3542,15 @@ 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))
> > > +		return;
> > > +#endif
> > > +
> > 
> > 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.
> 
> That check wants a !rt_task(current) qualifier anyway.

(bah, -ESWILLMORECOFFEE)
--
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] 18+ messages in thread

* Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
  2016-01-19  2:29   ` Mike Galbraith
@ 2016-01-21 12:54     ` Sebastian Andrzej Siewior
  2016-01-22 12:24       ` Grygorii Strashko
  2016-02-21 15:11       ` [patch] sched,rt: __always_inline preemptible_lazy() Mike Galbraith
  0 siblings, 2 replies; 18+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-01-21 12:54 UTC (permalink / raw)
  To: Mike Galbraith; +Cc: Thomas Gleixner, LKML, linux-rt-users

* 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();
 		/*

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

* Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
  2016-01-18 20:18 ` Sebastian Andrzej Siewior
  2016-01-19  2:29   ` Mike Galbraith
  2016-01-19  4:41   ` [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port Mike Galbraith
@ 2016-01-22 11:58   ` Grygorii Strashko
  2016-01-22 12:54     ` Sebastian Andrzej Siewior
  2 siblings, 1 reply; 18+ messages in thread
From: Grygorii Strashko @ 2016-01-22 11:58 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, Mike Galbraith
  Cc: Thomas Gleixner, LKML, linux-rt-users

On 01/18/2016 10:18 PM, Sebastian Andrzej Siewior wrote:
> * Mike Galbraith | 2016-01-18 10:08:23 [+0100]:
>
>> --- a/arch/x86/entry/common.c
>> +++ b/arch/x86/entry/common.c
>> @@ -220,14 +220,14 @@ long syscall_trace_enter(struct pt_regs
>>
>> #define EXIT_TO_USERMODE_LOOP_FLAGS				\
>> 	(_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_UPROBE |	\
>> -	 _TIF_NEED_RESCHED | _TIF_USER_RETURN_NOTIFY)
>> +	 _TIF_NEED_RESCHED_MASK | _TIF_USER_RETURN_NOTIFY)
>
> If I read this right, the loop where this define is used
> _TIF_ALLWORK_MASK in v4.1 of which _TIF_NEED_RESCHED_MASK was part of.
> Adding this will reassmeble the old behaviour.
> …

Just a question (sorry if dumb). ARM has _TIF_WORK_MASK defined:
#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
	_TIF_NOTIFY_RESUME | _TIF_UPROBE)

which is used to calculate loop exit condition in
  do_work_pending() (arch/arm/kernel/signal.c).

Should _TIF_WORK_MASK also contain _TIF_NEED_RESCHED_LAZY?

-- 
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

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

* Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
  2016-01-21 12:54     ` Sebastian Andrzej Siewior
@ 2016-01-22 12:24       ` Grygorii Strashko
  2016-01-22 13:19         ` Sebastian Andrzej Siewior
  2016-02-21 15:11       ` [patch] sched,rt: __always_inline preemptible_lazy() Mike Galbraith
  1 sibling, 1 reply; 18+ messages in thread
From: Grygorii Strashko @ 2016-01-22 12:24 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, Mike Galbraith
  Cc: Thomas Gleixner, LKML, linux-rt-users

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

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

* Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
  2016-01-22 11:58   ` Grygorii Strashko
@ 2016-01-22 12:54     ` Sebastian Andrzej Siewior
  2016-01-22 20:40       ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 18+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-01-22 12:54 UTC (permalink / raw)
  To: Grygorii Strashko, Mike Galbraith; +Cc: Thomas Gleixner, LKML, linux-rt-users

On 01/22/2016 12:58 PM, Grygorii Strashko wrote:
> On 01/18/2016 10:18 PM, Sebastian Andrzej Siewior wrote:
>> * Mike Galbraith | 2016-01-18 10:08:23 [+0100]:
>>
>>> --- a/arch/x86/entry/common.c
>>> +++ b/arch/x86/entry/common.c
>>> @@ -220,14 +220,14 @@ long syscall_trace_enter(struct pt_regs
>>>
>>> #define EXIT_TO_USERMODE_LOOP_FLAGS                \
>>>     (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_UPROBE |    \
>>> -     _TIF_NEED_RESCHED | _TIF_USER_RETURN_NOTIFY)
>>> +     _TIF_NEED_RESCHED_MASK | _TIF_USER_RETURN_NOTIFY)
>>
>> If I read this right, the loop where this define is used
>> _TIF_ALLWORK_MASK in v4.1 of which _TIF_NEED_RESCHED_MASK was part of.
>> Adding this will reassmeble the old behaviour.
>> …
> 
> Just a question (sorry if dumb). ARM has _TIF_WORK_MASK defined:
> #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
>     _TIF_NOTIFY_RESUME | _TIF_UPROBE)
> 
> which is used to calculate loop exit condition in
>  do_work_pending() (arch/arm/kernel/signal.c).
> 
> Should _TIF_WORK_MASK also contain _TIF_NEED_RESCHED_LAZY?

Yes, and arm64 lacks the same bits.

Sebastian
--
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] 18+ messages in thread

* Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
  2016-01-22 12:24       ` Grygorii Strashko
@ 2016-01-22 13:19         ` Sebastian Andrzej Siewior
  2016-01-22 13:34           ` Grygorii Strashko
  0 siblings, 1 reply; 18+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-01-22 13:19 UTC (permalink / raw)
  To: Grygorii Strashko, Mike Galbraith; +Cc: Thomas Gleixner, LKML, linux-rt-users

On 01/22/2016 01:24 PM, Grygorii Strashko wrote:
> 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

Do you still see it with the missing lazy bits? I don't see where this
could come from.

Sebastian


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

* Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
  2016-01-22 13:19         ` Sebastian Andrzej Siewior
@ 2016-01-22 13:34           ` Grygorii Strashko
  2016-01-22 14:14             ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 18+ messages in thread
From: Grygorii Strashko @ 2016-01-22 13:34 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, Mike Galbraith
  Cc: Thomas Gleixner, LKML, linux-rt-users

On 01/22/2016 03:19 PM, Sebastian Andrzej Siewior wrote:
> On 01/22/2016 01:24 PM, Grygorii Strashko wrote:
>> 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
>
> Do you still see it with the missing lazy bits? I don't see where this
> could come from.
>

yep. I've tried it with and without changing _TIF_WORK_MASK
Seems It's triggered by Virtual terminal keyboard_tasklet

-- 
regards,
-grygorii

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

* Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
  2016-01-22 13:34           ` Grygorii Strashko
@ 2016-01-22 14:14             ` Sebastian Andrzej Siewior
  2016-01-22 15:04               ` Grygorii Strashko
  0 siblings, 1 reply; 18+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-01-22 14:14 UTC (permalink / raw)
  To: Grygorii Strashko, Mike Galbraith; +Cc: Thomas Gleixner, LKML, linux-rt-users

On 01/22/2016 02:34 PM, Grygorii Strashko wrote:
>> Do you still see it with the missing lazy bits? I don't see where this
>> could come from.
>>
> 
> yep. I've tried it with and without changing _TIF_WORK_MASK
> Seems It's triggered by Virtual terminal keyboard_tasklet

Just bootet my current v4.4 to cross check what you see and I have this:

[    3.808273] clocksource: Switched to clocksource arch_sys_counter
[    3.851193] keyboard: kbd_init(1609)
[    3.861903] keyboard: kbd_bh(1201)
[    3.868322] keyboard: kbd_init(1612)
[    3.868581] NET: Registered protocol family 2

So. No backtrace here. According to the full dmesg I should have all
CPUs up by now. kbd_bh is comming from ksoftirqd as well. No idea why
you see this.
There is a irq off region which sets and removes RUN bit, I have no
idea why you have this backtrace.

Sebastian


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

* Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
  2016-01-22 14:14             ` Sebastian Andrzej Siewior
@ 2016-01-22 15:04               ` Grygorii Strashko
  2016-01-22 18:21                 ` Grygorii Strashko
  0 siblings, 1 reply; 18+ messages in thread
From: Grygorii Strashko @ 2016-01-22 15:04 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, Mike Galbraith
  Cc: Thomas Gleixner, LKML, linux-rt-users

On 01/22/2016 04:14 PM, Sebastian Andrzej Siewior wrote:
> On 01/22/2016 02:34 PM, Grygorii Strashko wrote:
>>> Do you still see it with the missing lazy bits? I don't see where this
>>> could come from.
>>>
>>
>> yep. I've tried it with and without changing _TIF_WORK_MASK
>> Seems It's triggered by Virtual terminal keyboard_tasklet
>
> Just bootet my current v4.4 to cross check what you see and I have this:
>
> [    3.808273] clocksource: Switched to clocksource arch_sys_counter
> [    3.851193] keyboard: kbd_init(1609)
> [    3.861903] keyboard: kbd_bh(1201)
> [    3.868322] keyboard: kbd_init(1612)
> [    3.868581] NET: Registered protocol family 2
>
> So. No backtrace here. According to the full dmesg I should have all
> CPUs up by now. kbd_bh is comming from ksoftirqd as well. No idea why
> you see this.
> There is a irq off region which sets and removes RUN bit, I have no
> idea why you have this backtrace.
>

As of now, i'm too :(
- not sure if this could be the case, but my kernel is !SMP
# CONFIG_SMP is not set
# CONFIG_CPUSETS is not set

-- 
regards,
-grygorii

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

* Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
  2016-01-22 15:04               ` Grygorii Strashko
@ 2016-01-22 18:21                 ` Grygorii Strashko
  0 siblings, 0 replies; 18+ messages in thread
From: Grygorii Strashko @ 2016-01-22 18:21 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, Mike Galbraith
  Cc: Thomas Gleixner, LKML, linux-rt-users

hi Sebastian,
On 01/22/2016 05:04 PM, Grygorii Strashko wrote:
> On 01/22/2016 04:14 PM, Sebastian Andrzej Siewior wrote:
>> On 01/22/2016 02:34 PM, Grygorii Strashko wrote:
>>>> Do you still see it with the missing lazy bits? I don't see where this
>>>> could come from.
>>>>
>>>
>>> yep. I've tried it with and without changing _TIF_WORK_MASK
>>> Seems It's triggered by Virtual terminal keyboard_tasklet
>>
>> Just bootet my current v4.4 to cross check what you see and I have this:
>>
>> [    3.808273] clocksource: Switched to clocksource arch_sys_counter
>> [    3.851193] keyboard: kbd_init(1609)
>> [    3.861903] keyboard: kbd_bh(1201)
>> [    3.868322] keyboard: kbd_init(1612)
>> [    3.868581] NET: Registered protocol family 2
>>
>> So. No backtrace here. According to the full dmesg I should have all
>> CPUs up by now. kbd_bh is comming from ksoftirqd as well. No idea why
>> you see this.
>> There is a irq off region which sets and removes RUN bit, I have no
>> idea why you have this backtrace.
>>
>
> As of now, i'm too :(
> - not sure if this could be the case, but my kernel is !SMP
> # CONFIG_SMP is not set
> # CONFIG_CPUSETS is not set
>

Sorry, this is false alarm - I did mistake in my patch.

Sorry for your time.

-- 
regards,
-grygorii

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

* Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
  2016-01-22 12:54     ` Sebastian Andrzej Siewior
@ 2016-01-22 20:40       ` Sebastian Andrzej Siewior
  2016-01-25 17:14         ` Grygorii Strashko
  0 siblings, 1 reply; 18+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-01-22 20:40 UTC (permalink / raw)
  To: Grygorii Strashko, Mike Galbraith; +Cc: Thomas Gleixner, LKML, linux-rt-users

* Sebastian Andrzej Siewior | 2016-01-22 13:54:43 [+0100]:

>> Should _TIF_WORK_MASK also contain _TIF_NEED_RESCHED_LAZY?
>
>Yes, and arm64 lacks the same bits.

That would be this. If a compiler is reading here and knows how to
improve the following, please let me know :)

diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index 46cc07b5cae6..1f36a4eccc72 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -143,8 +143,8 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
 #define TIF_SYSCALL_TRACE	4	/* syscall trace active */
 #define TIF_SYSCALL_AUDIT	5	/* syscall auditing active */
 #define TIF_SYSCALL_TRACEPOINT	6	/* syscall tracepoint instrumentation */
-#define TIF_SECCOMP		7	/* seccomp syscall filtering active */
-#define TIF_NEED_RESCHED_LAZY	8
+#define TIF_SECCOMP		8	/* seccomp syscall filtering active */
+#define TIF_NEED_RESCHED_LAZY	7
 
 #define TIF_NOHZ		12	/* in adaptive nohz mode */
 #define TIF_USING_IWMMXT	17
@@ -170,7 +170,8 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
  * Change these and you break ASM code in entry-common.S
  */
 #define _TIF_WORK_MASK		(_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
-				 _TIF_NOTIFY_RESUME | _TIF_UPROBE)
+				 _TIF_NOTIFY_RESUME | _TIF_UPROBE | \
+				 _TIF_NEED_RESCHED_LAZY)
 
 #endif /* __KERNEL__ */
 #endif /* __ASM_ARM_THREAD_INFO_H */
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 30a7228eaceb..c3bd6cbfce4b 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -36,7 +36,9 @@
  UNWIND(.cantunwind	)
 	disable_irq_notrace			@ disable interrupts
 	ldr	r1, [tsk, #TI_FLAGS]		@ re-check for syscall tracing
-	tst	r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
+	tst	r1, #((_TIF_SYSCALL_WORK | _TIF_WORK_MASK) & ~_TIF_SECCOMP)
+	bne	fast_work_pending
+	tst	r1, #_TIF_SECCOMP
 	bne	fast_work_pending
 
 	/* perform architecture specific actions before user return */
@@ -62,8 +64,11 @@ ENDPROC(ret_fast_syscall)
 	str	r0, [sp, #S_R0 + S_OFF]!	@ save returned r0
 	disable_irq_notrace			@ disable interrupts
 	ldr	r1, [tsk, #TI_FLAGS]		@ re-check for syscall tracing
-	tst	r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
+	tst	r1, #((_TIF_SYSCALL_WORK | _TIF_WORK_MASK) & ~_TIF_SECCOMP)
+	bne 	do_slower_path
+	tst	r1, #_TIF_SECCOMP
 	beq	no_work_pending
+do_slower_path:
  UNWIND(.fnend		)
 ENDPROC(ret_fast_syscall)
 
diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h
index b229ef49a643..5f4e89fbc290 100644
--- a/arch/arm64/include/asm/thread_info.h
+++ b/arch/arm64/include/asm/thread_info.h
@@ -129,7 +129,8 @@ static inline struct thread_info *current_thread_info(void)
 #define _TIF_32BIT		(1 << TIF_32BIT)
 
 #define _TIF_WORK_MASK		(_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
-				 _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE)
+				 _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE | \
+				 _TIF_NEED_RESCHED_LAZY)
 
 #define _TIF_SYSCALL_WORK	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
 				 _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \
-- 
2.7.0.rc3

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

* Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
  2016-01-22 20:40       ` Sebastian Andrzej Siewior
@ 2016-01-25 17:14         ` Grygorii Strashko
  2016-02-01 13:04           ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 18+ messages in thread
From: Grygorii Strashko @ 2016-01-25 17:14 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, Mike Galbraith
  Cc: Thomas Gleixner, LKML, linux-rt-users

On 01/22/2016 10:40 PM, Sebastian Andrzej Siewior wrote:
> * Sebastian Andrzej Siewior | 2016-01-22 13:54:43 [+0100]:
>
>>> Should _TIF_WORK_MASK also contain _TIF_NEED_RESCHED_LAZY?
>>
>> Yes, and arm64 lacks the same bits.
>
> That would be this. If a compiler is reading here and knows how to
> improve the following, please let me know :)
>
> diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
> index 46cc07b5cae6..1f36a4eccc72 100644
> --- a/arch/arm/include/asm/thread_info.h
> +++ b/arch/arm/include/asm/thread_info.h
> @@ -143,8 +143,8 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
>   #define TIF_SYSCALL_TRACE	4	/* syscall trace active */
>   #define TIF_SYSCALL_AUDIT	5	/* syscall auditing active */
>   #define TIF_SYSCALL_TRACEPOINT	6	/* syscall tracepoint instrumentation */
> -#define TIF_SECCOMP		7	/* seccomp syscall filtering active */
> -#define TIF_NEED_RESCHED_LAZY	8
> +#define TIF_SECCOMP		8	/* seccomp syscall filtering active */
> +#define TIF_NEED_RESCHED_LAZY	7
>
>   #define TIF_NOHZ		12	/* in adaptive nohz mode */
>   #define TIF_USING_IWMMXT	17
> @@ -170,7 +170,8 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
>    * Change these and you break ASM code in entry-common.S
>    */
>   #define _TIF_WORK_MASK		(_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
> -				 _TIF_NOTIFY_RESUME | _TIF_UPROBE)
> +				 _TIF_NOTIFY_RESUME | _TIF_UPROBE | \
> +				 _TIF_NEED_RESCHED_LAZY)
>
>   #endif /* __KERNEL__ */
>   #endif /* __ASM_ARM_THREAD_INFO_H */
> diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
> index 30a7228eaceb..c3bd6cbfce4b 100644
> --- a/arch/arm/kernel/entry-common.S
> +++ b/arch/arm/kernel/entry-common.S
> @@ -36,7 +36,9 @@
>    UNWIND(.cantunwind	)
>   	disable_irq_notrace			@ disable interrupts
>   	ldr	r1, [tsk, #TI_FLAGS]		@ re-check for syscall tracing
> -	tst	r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
> +	tst	r1, #((_TIF_SYSCALL_WORK | _TIF_WORK_MASK) & ~_TIF_SECCOMP)
> +	bne	fast_work_pending
		^^^^^^^^^^^^^^^^

> +	tst	r1, #_TIF_SECCOMP
>   	bne	fast_work_pending
		^^^^^^^^^^^^^^^^^

Should it be "fast_work_pending" in both cases?

>
>   	/* perform architecture specific actions before user return */
> @@ -62,8 +64,11 @@ ENDPROC(ret_fast_syscall)
>   	str	r0, [sp, #S_R0 + S_OFF]!	@ save returned r0
>   	disable_irq_notrace			@ disable interrupts
>   	ldr	r1, [tsk, #TI_FLAGS]		@ re-check for syscall tracing
> -	tst	r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
> +	tst	r1, #((_TIF_SYSCALL_WORK | _TIF_WORK_MASK) & ~_TIF_SECCOMP)
> +	bne 	do_slower_path
> +	tst	r1, #_TIF_SECCOMP
>   	beq	no_work_pending
> +do_slower_path:
>    UNWIND(.fnend		)
>   ENDPROC(ret_fast_syscall)
>
[...]

-- 
regards,
-grygorii

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

* Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
  2016-01-25 17:14         ` Grygorii Strashko
@ 2016-02-01 13:04           ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 18+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-02-01 13:04 UTC (permalink / raw)
  To: Grygorii Strashko, Mike Galbraith; +Cc: Thomas Gleixner, LKML, linux-rt-users

On 01/25/2016 06:14 PM, Grygorii Strashko wrote:

>> diff --git a/arch/arm/kernel/entry-common.S
>> b/arch/arm/kernel/entry-common.S
>> index 30a7228eaceb..c3bd6cbfce4b 100644
>> --- a/arch/arm/kernel/entry-common.S
>> +++ b/arch/arm/kernel/entry-common.S
>> @@ -36,7 +36,9 @@
>>    UNWIND(.cantunwind    )
>>       disable_irq_notrace            @ disable interrupts
>>       ldr    r1, [tsk, #TI_FLAGS]        @ re-check for syscall tracing
>> -    tst    r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
>> +    tst    r1, #((_TIF_SYSCALL_WORK | _TIF_WORK_MASK) & ~_TIF_SECCOMP)
>> +    bne    fast_work_pending
>         ^^^^^^^^^^^^^^^^
> 
>> +    tst    r1, #_TIF_SECCOMP
>>       bne    fast_work_pending
>         ^^^^^^^^^^^^^^^^^
> 
> Should it be "fast_work_pending" in both cases?

Yes, I think so and it is, isn't it?
The original is

     tst    r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
     bne    fast_work_pending

and with the LAZY bits in it, the ASM opcode no longer works because
the constant is too large (or has to many bits set). So I removed the
_TIF_SECCOMP bit out of the mask and made two compare & jumps here.

Sebastian

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

* [patch]  sched,rt: __always_inline preemptible_lazy()
  2016-01-21 12:54     ` Sebastian Andrzej Siewior
  2016-01-22 12:24       ` Grygorii Strashko
@ 2016-02-21 15:11       ` Mike Galbraith
  1 sibling, 0 replies; 18+ messages in thread
From: Mike Galbraith @ 2016-02-21 15:11 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: Thomas Gleixner, LKML, linux-rt-users

homer: # nm kernel/sched/core.o|grep preemptible_lazy
00000000000000b5 t preemptible_lazy

echo wakeup_rt > current_tracer ==> Welcome to infinity.

Signed-off-bx: Mike Galbraith <umgwanakikbuti@gmail.com>
---
 kernel/sched/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3469,7 +3469,7 @@ static void __sched notrace preempt_sche
  * 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)
+static __always_inline int preemptible_lazy(void)
 {
 	if (test_thread_flag(TIF_NEED_RESCHED))
 		return 1;

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

end of thread, other threads:[~2016-02-21 15:11 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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-21 12:54     ` Sebastian Andrzej Siewior
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  5:14     ` Mike Galbraith
2016-01-22 11:58   ` Grygorii Strashko
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

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).