mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched/rt: don't enable runtime if already enabled
@ 2012-12-03  8:01 Neil Zhang
  2012-12-04  9:31 ` Neil Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Zhang @ 2012-12-03  8:01 UTC (permalink / raw)
  To: mingo, peterz; +Cc: cxie4, linux-kernel, Neil Zhang

There are two paths will call __enable_runtime, they are enable_runtime
and rq_online. Don't enable runtime again if it is already enabled.
It can fix the following kernel BUG when do cpu hotplug while there
are realtime threads running.

[ 3347.091644] kernel BUG at kernel/sched/rt.c:687!
[ 3347.091674] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
[ 3347.091674] Modules linked in: cidatattydev(O) gs_diag(O) diag(O) gs_modem(O) ccinetdev(O) cci_datastub(O) citty(O) msocke
[ 3347.091705] CPU: 1    Tainted: G           O  (3.4.5+ #439)
[ 3347.091735] PC is at __disable_runtime+0x1e4/0x240
[ 3347.091735] LR is at __disable_runtime+0x1dc/0x240
[ 3347.091735] pc : [<c0162124>]    lr : [<c016211c>]    psr:
	a0000093
[ 3347.091735] sp : e0061dc8  ip : c0807861  fp : c07a9740
[ 3347.091766] r10: c1a0b740  r9 : ffffffff  r8 : fd050f80
[ 3347.091766] r7 : 00000002  r6 : 000003f8  r5 : c1a13740  r4 : c1a137d8
[ 3347.091766] r3 : ffffffff  r2 : e0061dbc  r1 : c06b11b6  r0 : 00000037
[ 3347.091796] Flags: NzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[ 3347.091796] Control: 10c53c7d  Table: 21e5004a  DAC: 00000015

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
---
 kernel/sched/rt.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 418feb0..6525e5b 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -722,9 +722,11 @@ static void __enable_runtime(struct rq *rq)
 
 		raw_spin_lock(&rt_b->rt_runtime_lock);
 		raw_spin_lock(&rt_rq->rt_runtime_lock);
-		rt_rq->rt_runtime = rt_b->rt_runtime;
-		rt_rq->rt_time = 0;
-		rt_rq->rt_throttled = 0;
+		if (rt_rq->rt_runtime == RUNTIME_INF) {
+			rt_rq->rt_runtime = rt_b->rt_runtime;
+			rt_rq->rt_time = 0;
+			rt_rq->rt_throttled = 0;
+		}
 		raw_spin_unlock(&rt_rq->rt_runtime_lock);
 		raw_spin_unlock(&rt_b->rt_runtime_lock);
 	}
-- 
1.7.4.1


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

* RE: [PATCH] sched/rt: don't enable runtime if already enabled
  2012-12-03  8:01 [PATCH] sched/rt: don't enable runtime if already enabled Neil Zhang
@ 2012-12-04  9:31 ` Neil Zhang
  2012-12-12  5:38   ` Neil Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Zhang @ 2012-12-04  9:31 UTC (permalink / raw)
  To: Neil Zhang, peterz, mingo; +Cc: Chao Xie, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 2416 bytes --]

Hi All,

-----Original Message-----
From: Neil Zhang [mailto:zhangwm@marvell.com] 
Sent: 2012Äê12ÔÂ3ÈÕ 16:01
To: mingo@redhat.com; peterz@infradead.org
Cc: Chao Xie; linux-kernel@vger.kernel.org; Neil Zhang
Subject: [PATCH] sched/rt: don't enable runtime if already enabled

There are two paths will call __enable_runtime, they are enable_runtime and rq_online. Don't enable runtime again if it is already enabled.
It can fix the following kernel BUG when do cpu hotplug while there are realtime threads running.

[ 3347.091644] kernel BUG at kernel/sched/rt.c:687!
[ 3347.091674] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM [ 3347.091674] Modules linked in: cidatattydev(O) gs_diag(O) diag(O) gs_modem(O) ccinetdev(O) cci_datastub(O) citty(O) msocke
[ 3347.091705] CPU: 1    Tainted: G           O  (3.4.5+ #439)
[ 3347.091735] PC is at __disable_runtime+0x1e4/0x240 [ 3347.091735] LR is at __disable_runtime+0x1dc/0x240
[ 3347.091735] pc : [<c0162124>]    lr : [<c016211c>]    psr:
	a0000093
[ 3347.091735] sp : e0061dc8  ip : c0807861  fp : c07a9740 [ 3347.091766] r10: c1a0b740  r9 : ffffffff  r8 : fd050f80 [ 3347.091766] r7 : 00000002  r6 : 000003f8  r5 : c1a13740  r4 : c1a137d8 [ 3347.091766] r3 : ffffffff  r2 : e0061dbc  r1 : c06b11b6  r0 : 00000037 [ 3347.091796] Flags: NzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel [ 3347.091796] Control: 10c53c7d  Table: 21e5004a  DAC: 00000015

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
---
 kernel/sched/rt.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 418feb0..6525e5b 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -722,9 +722,11 @@ static void __enable_runtime(struct rq *rq)
 
 		raw_spin_lock(&rt_b->rt_runtime_lock);
 		raw_spin_lock(&rt_rq->rt_runtime_lock);
-		rt_rq->rt_runtime = rt_b->rt_runtime;
-		rt_rq->rt_time = 0;
-		rt_rq->rt_throttled = 0;
+		if (rt_rq->rt_runtime == RUNTIME_INF) {
+			rt_rq->rt_runtime = rt_b->rt_runtime;
+			rt_rq->rt_time = 0;
+			rt_rq->rt_throttled = 0;
+		}
 		raw_spin_unlock(&rt_rq->rt_runtime_lock);
 		raw_spin_unlock(&rt_b->rt_runtime_lock);
 	}
--
1.7.4.1

Ingo seems use another mail now, update the To list.

Best Regards,
Neil Zhang

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* RE: [PATCH] sched/rt: don't enable runtime if already enabled
  2012-12-04  9:31 ` Neil Zhang
@ 2012-12-12  5:38   ` Neil Zhang
  2012-12-12  9:39     ` Mike Galbraith
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Zhang @ 2012-12-12  5:38 UTC (permalink / raw)
  To: Neil Zhang, peterz, mingo; +Cc: Chao Xie, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 2721 bytes --]

Ingo and All,

-----Original Message-----
From: Neil Zhang 
Sent: 2012Äê12ÔÂ4ÈÕ 17:31
To: Neil Zhang; peterz@infradead.org; mingo@kernel.org
Cc: Chao Xie; linux-kernel@vger.kernel.org
Subject: RE: [PATCH] sched/rt: don't enable runtime if already enabled

Hi All,

-----Original Message-----
From: Neil Zhang [mailto:zhangwm@marvell.com] 
Sent: 2012Äê12ÔÂ3ÈÕ 16:01
To: mingo@redhat.com; peterz@infradead.org
Cc: Chao Xie; linux-kernel@vger.kernel.org; Neil Zhang
Subject: [PATCH] sched/rt: don't enable runtime if already enabled

There are two paths will call __enable_runtime, they are enable_runtime and rq_online. Don't enable runtime again if it is already enabled.
It can fix the following kernel BUG when do cpu hotplug while there are realtime threads running.

[ 3347.091644] kernel BUG at kernel/sched/rt.c:687!
[ 3347.091674] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM [ 3347.091674] Modules linked in: cidatattydev(O) gs_diag(O) diag(O) gs_modem(O) ccinetdev(O) cci_datastub(O) citty(O) msocke
[ 3347.091705] CPU: 1    Tainted: G           O  (3.4.5+ #439)
[ 3347.091735] PC is at __disable_runtime+0x1e4/0x240 [ 3347.091735] LR is at __disable_runtime+0x1dc/0x240
[ 3347.091735] pc : [<c0162124>]    lr : [<c016211c>]    psr:
	a0000093
[ 3347.091735] sp : e0061dc8  ip : c0807861  fp : c07a9740 [ 3347.091766] r10: c1a0b740  r9 : ffffffff  r8 : fd050f80 [ 3347.091766] r7 : 00000002  r6 : 000003f8  r5 : c1a13740  r4 : c1a137d8 [ 3347.091766] r3 : ffffffff  r2 : e0061dbc  r1 : c06b11b6  r0 : 00000037 [ 3347.091796] Flags: NzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel [ 3347.091796] Control: 10c53c7d  Table: 21e5004a  DAC: 00000015

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
---
 kernel/sched/rt.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 418feb0..6525e5b 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -722,9 +722,11 @@ static void __enable_runtime(struct rq *rq)
 
 		raw_spin_lock(&rt_b->rt_runtime_lock);
 		raw_spin_lock(&rt_rq->rt_runtime_lock);
-		rt_rq->rt_runtime = rt_b->rt_runtime;
-		rt_rq->rt_time = 0;
-		rt_rq->rt_throttled = 0;
+		if (rt_rq->rt_runtime == RUNTIME_INF) {
+			rt_rq->rt_runtime = rt_b->rt_runtime;
+			rt_rq->rt_time = 0;
+			rt_rq->rt_throttled = 0;
+		}
 		raw_spin_unlock(&rt_rq->rt_runtime_lock);
 		raw_spin_unlock(&rt_b->rt_runtime_lock);
 	}
--
1.7.4.1

Ingo seems use another mail now, update the To list.

Best Regards,
Neil Zhang

Please help review it.

Best Regards,
Neil Zhang
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* RE: [PATCH] sched/rt: don't enable runtime if already enabled
  2012-12-12  5:38   ` Neil Zhang
@ 2012-12-12  9:39     ` Mike Galbraith
  2012-12-28 10:01       ` Neil Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Galbraith @ 2012-12-12  9:39 UTC (permalink / raw)
  To: Neil Zhang; +Cc: peterz, mingo, Chao Xie, linux-kernel

On Tue, 2012-12-11 at 21:38 -0800, Neil Zhang wrote: 
> Ingo and All,

Hm, /me wonders why we would even need update_runtime() handler.  We
disable at CPU_DOWN_PREPARE in update_runtime(), again at CPU_DYING in
migration_call(), and enable at CPU_ONLINE in both.

> -----Original Message-----
> From: Neil Zhang 
> Sent: 2012年12月4日 17:31
> To: Neil Zhang; peterz@infradead.org; mingo@kernel.org
> Cc: Chao Xie; linux-kernel@vger.kernel.org
> Subject: RE: [PATCH] sched/rt: don't enable runtime if already enabled
> 
> Hi All,
> 
> -----Original Message-----
> From: Neil Zhang [mailto:zhangwm@marvell.com] 
> Sent: 2012年12月3日 16:01
> To: mingo@redhat.com; peterz@infradead.org
> Cc: Chao Xie; linux-kernel@vger.kernel.org; Neil Zhang
> Subject: [PATCH] sched/rt: don't enable runtime if already enabled
> 
> There are two paths will call __enable_runtime, they are enable_runtime and rq_online. Don't enable runtime again if it is already enabled.
> It can fix the following kernel BUG when do cpu hotplug while there are realtime threads running.
> 
> [ 3347.091644] kernel BUG at kernel/sched/rt.c:687!
> [ 3347.091674] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM [ 3347.091674] Modules linked in: cidatattydev(O) gs_diag(O) diag(O) gs_modem(O) ccinetdev(O) cci_datastub(O) citty(O) msocke
> [ 3347.091705] CPU: 1    Tainted: G           O  (3.4.5+ #439)
> [ 3347.091735] PC is at __disable_runtime+0x1e4/0x240 [ 3347.091735] LR is at __disable_runtime+0x1dc/0x240
> [ 3347.091735] pc : [<c0162124>]    lr : [<c016211c>]    psr:
> 	a0000093
> [ 3347.091735] sp : e0061dc8  ip : c0807861  fp : c07a9740 [ 3347.091766] r10: c1a0b740  r9 : ffffffff  r8 : fd050f80 [ 3347.091766] r7 : 00000002  r6 : 000003f8  r5 : c1a13740  r4 : c1a137d8 [ 3347.091766] r3 : ffffffff  r2 : e0061dbc  r1 : c06b11b6  r0 : 00000037 [ 3347.091796] Flags: NzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel [ 3347.091796] Control: 10c53c7d  Table: 21e5004a  DAC: 00000015
> 
> Signed-off-by: Neil Zhang <zhangwm@marvell.com>
> ---
>  kernel/sched/rt.c |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 418feb0..6525e5b 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -722,9 +722,11 @@ static void __enable_runtime(struct rq *rq)
>  
>  		raw_spin_lock(&rt_b->rt_runtime_lock);
>  		raw_spin_lock(&rt_rq->rt_runtime_lock);
> -		rt_rq->rt_runtime = rt_b->rt_runtime;
> -		rt_rq->rt_time = 0;
> -		rt_rq->rt_throttled = 0;
> +		if (rt_rq->rt_runtime == RUNTIME_INF) {
> +			rt_rq->rt_runtime = rt_b->rt_runtime;
> +			rt_rq->rt_time = 0;
> +			rt_rq->rt_throttled = 0;
> +		}
>  		raw_spin_unlock(&rt_rq->rt_runtime_lock);
>  		raw_spin_unlock(&rt_b->rt_runtime_lock);
>  	}
> --
> 1.7.4.1
> 
> Ingo seems use another mail now, update the To list.
> 
> Best Regards,
> Neil Zhang
> 
> Please help review it.
> 
> Best Regards,
> Neil Zhang
> NР骒rybX肚v^)藓{.n+伐{赙zXФ≤}财z&j:+v赙zZ++zf"h~izwア?ㄨ&)撷f^j谦ym@Aa囤\x7f0鹅hi\x7f



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

* RE: [PATCH] sched/rt: don't enable runtime if already enabled
  2012-12-12  9:39     ` Mike Galbraith
@ 2012-12-28 10:01       ` Neil Zhang
  0 siblings, 0 replies; 5+ messages in thread
From: Neil Zhang @ 2012-12-28 10:01 UTC (permalink / raw)
  To: Mike Galbraith; +Cc: peterz, mingo, Chao Xie, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 3775 bytes --]

Mike,

> -----Original Message-----
> From: Mike Galbraith [mailto:bitbucket@online.de]
> Sent: 2012年12月12日 17:39
> To: Neil Zhang
> Cc: peterz@infradead.org; mingo@kernel.org; Chao Xie;
> linux-kernel@vger.kernel.org
> Subject: RE: [PATCH] sched/rt: don't enable runtime if already enabled
> 
> On Tue, 2012-12-11 at 21:38 -0800, Neil Zhang wrote:
> > Ingo and All,
> 
> Hm, /me wonders why we would even need update_runtime() handler.  We
> disable at CPU_DOWN_PREPARE in update_runtime(), again at CPU_DYING
> in migration_call(), and enable at CPU_ONLINE in both.
> 
Totally agree with you.
Then I will prepare another patch to remove it.
Thanks.

> > -----Original Message-----
> > From: Neil Zhang
> > Sent: 2012年12月4日 17:31
> > To: Neil Zhang; peterz@infradead.org; mingo@kernel.org
> > Cc: Chao Xie; linux-kernel@vger.kernel.org
> > Subject: RE: [PATCH] sched/rt: don't enable runtime if already enabled
> >
> > Hi All,
> >
> > -----Original Message-----
> > From: Neil Zhang [mailto:zhangwm@marvell.com]
> > Sent: 2012年12月3日 16:01
> > To: mingo@redhat.com; peterz@infradead.org
> > Cc: Chao Xie; linux-kernel@vger.kernel.org; Neil Zhang
> > Subject: [PATCH] sched/rt: don't enable runtime if already enabled
> >
> > There are two paths will call __enable_runtime, they are enable_runtime
> and rq_online. Don't enable runtime again if it is already enabled.
> > It can fix the following kernel BUG when do cpu hotplug while there are
> realtime threads running.
> >
> > [ 3347.091644] kernel BUG at kernel/sched/rt.c:687!
> > [ 3347.091674] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
> [ 3347.091674] Modules linked in: cidatattydev(O) gs_diag(O) diag(O)
> gs_modem(O) ccinetdev(O) cci_datastub(O) citty(O) msocke
> > [ 3347.091705] CPU: 1    Tainted: G           O  (3.4.5+ #439)
> > [ 3347.091735] PC is at __disable_runtime+0x1e4/0x240 [ 3347.091735] LR
> is at __disable_runtime+0x1dc/0x240
> > [ 3347.091735] pc : [<c0162124>]    lr : [<c016211c>]    psr:
> > 	a0000093
> > [ 3347.091735] sp : e0061dc8  ip : c0807861  fp : c07a9740 [
> > 3347.091766] r10: c1a0b740  r9 : ffffffff  r8 : fd050f80 [
> > 3347.091766] r7 : 00000002  r6 : 000003f8  r5 : c1a13740  r4 :
> > c1a137d8 [ 3347.091766] r3 : ffffffff  r2 : e0061dbc  r1 : c06b11b6
> > r0 : 00000037 [ 3347.091796] Flags: NzCv  IRQs off  FIQs on  Mode
> > SVC_32  ISA ARM  Segment kernel [ 3347.091796] Control: 10c53c7d
> > Table: 21e5004a  DAC: 00000015
> >
> > Signed-off-by: Neil Zhang <zhangwm@marvell.com>
> > ---
> >  kernel/sched/rt.c |    8 +++++---
> >  1 files changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index
> > 418feb0..6525e5b 100644
> > --- a/kernel/sched/rt.c
> > +++ b/kernel/sched/rt.c
> > @@ -722,9 +722,11 @@ static void __enable_runtime(struct rq *rq)
> >
> >  		raw_spin_lock(&rt_b->rt_runtime_lock);
> >  		raw_spin_lock(&rt_rq->rt_runtime_lock);
> > -		rt_rq->rt_runtime = rt_b->rt_runtime;
> > -		rt_rq->rt_time = 0;
> > -		rt_rq->rt_throttled = 0;
> > +		if (rt_rq->rt_runtime == RUNTIME_INF) {
> > +			rt_rq->rt_runtime = rt_b->rt_runtime;
> > +			rt_rq->rt_time = 0;
> > +			rt_rq->rt_throttled = 0;
> > +		}
> >  		raw_spin_unlock(&rt_rq->rt_runtime_lock);
> >  		raw_spin_unlock(&rt_b->rt_runtime_lock);
> >  	}
> > --
> > 1.7.4.1
> >
> > Ingo seems use another mail now, update the To list.
> >
> > Best Regards,
> > Neil Zhang
> >
> > Please help review it.
> >
> > Best Regards,
> > Neil Zhang
> > NР骒rybX肚v^)藓{.n+伐{赙zXФ≤}财z&j:+v赙zZ++zf"h~izwア?ㄨ&)
> 撷f^j谦ym@Aa囤\x7f0鹅hi\x7f
> 

Best Regards,
Neil Zhang
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

end of thread, other threads:[~2012-12-28 10:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-03  8:01 [PATCH] sched/rt: don't enable runtime if already enabled Neil Zhang
2012-12-04  9:31 ` Neil Zhang
2012-12-12  5:38   ` Neil Zhang
2012-12-12  9:39     ` Mike Galbraith
2012-12-28 10:01       ` Neil Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome