All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/clock: disable irq for generic_sched_clock_init
@ 2018-07-30 13:52 Pavel Tatashin
  2018-07-30 17:37 ` [tip:x86/timers] sched/clock: Disable interrupts when calling generic_sched_clock_init() tip-bot for Pavel Tatashin
  2018-07-31 13:19 ` [PATCH] sched/clock: disable irq for generic_sched_clock_init Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Pavel Tatashin @ 2018-07-30 13:52 UTC (permalink / raw)
  To: steven.sistare, daniel.m.jordan, linux-kernel, tglx,
	pasha.tatashin, mingo, peterz, linux

sched_clock_init() used be called early in boot  when IRQs are still
disabled. Now, it is called when IRQs are already enabled, and this
triggers some warning:

WARNING: CPU: 0 PID: 0 at kernel/time/sched_clock.c:180
sched_clock_register+0x44/0x278
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 4.18.0-rc6-next-20180724 #1
Hardware name: ARM Integrator/CP (Device Tree)
[<c0010cb4>] (unwind_backtrace) from [<c000dc24>] (show_stack+0x10/0x18)
[<c000dc24>] (show_stack) from [<c03ffb94>] (dump_stack+0x18/0x24)
[<c03ffb94>] (dump_stack) from [<c001a000>] (__warn+0xc8/0xf0)
[<c001a000>] (__warn) from [<c001a13c>] (warn_slowpath_null+0x3c/0x4c)
[<c001a13c>] (warn_slowpath_null) from [<c052367c>] (sched_clock_register+0x44/0x278)
[<c052367c>] (sched_clock_register) from [<c05238d8>] (generic_sched_clock_init+0x28/0x88)
[<c05238d8>] (generic_sched_clock_init) from [<c0521a00>] (sched_clock_init+0x54/0x74)
[<c0521a00>] (sched_clock_init) from [<c0519c18>] (start_kernel+0x310/0x3e4)
[<c0519c18>] (start_kernel) from [<00000000>] (  (null))
---[ end trace 08080eb81afa002c ]---

Disable IRQs for the duration of generic_sched_clock_init().

Fixes: 857baa87b642 ("sched/clock: Enable sched clock early")

Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
---
 kernel/sched/clock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c
index 811a39aca1ce..e3e3b979f9bd 100644
--- a/kernel/sched/clock.c
+++ b/kernel/sched/clock.c
@@ -452,7 +452,9 @@ EXPORT_SYMBOL_GPL(sched_clock_idle_wakeup_event);
 void __init sched_clock_init(void)
 {
 	static_branch_inc(&sched_clock_running);
+	local_irq_disable();
 	generic_sched_clock_init();
+	local_irq_enable();
 }
 
 u64 sched_clock_cpu(int cpu)
-- 
2.18.0


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

* [tip:x86/timers] sched/clock: Disable interrupts when calling generic_sched_clock_init()
  2018-07-30 13:52 [PATCH] sched/clock: disable irq for generic_sched_clock_init Pavel Tatashin
@ 2018-07-30 17:37 ` tip-bot for Pavel Tatashin
  2018-07-31 13:19 ` [PATCH] sched/clock: disable irq for generic_sched_clock_init Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Pavel Tatashin @ 2018-07-30 17:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, mingo, linux, tglx, pasha.tatashin, linux-kernel, hpa

Commit-ID:  bd9f943e5d2a42d864f9692477a25034c9d47dcc
Gitweb:     https://git.kernel.org/tip/bd9f943e5d2a42d864f9692477a25034c9d47dcc
Author:     Pavel Tatashin <pasha.tatashin@oracle.com>
AuthorDate: Mon, 30 Jul 2018 09:52:52 -0400
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 30 Jul 2018 19:33:35 +0200

sched/clock: Disable interrupts when calling generic_sched_clock_init()

sched_clock_init() used be called early during boot when interrupts were
still disabled. After the recent changes to utilize sched clock early the
sched_clock_init() call happens when interrupts are already enabled, which
triggers the following warning:

WARNING: CPU: 0 PID: 0 at kernel/time/sched_clock.c:180 sched_clock_register+0x44/0x278
[<c001a13c>] (warn_slowpath_null) from [<c052367c>] (sched_clock_register+0x44/0x278)
[<c052367c>] (sched_clock_register) from [<c05238d8>] (generic_sched_clock_init+0x28/0x88)
[<c05238d8>] (generic_sched_clock_init) from [<c0521a00>] (sched_clock_init+0x54/0x74)
[<c0521a00>] (sched_clock_init) from [<c0519c18>] (start_kernel+0x310/0x3e4)
[<c0519c18>] (start_kernel) from [<00000000>] (  (null))

Disable IRQs for the duration of generic_sched_clock_init().

Fixes: 857baa87b642 ("sched/clock: Enable sched clock early")
Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: steven.sistare@oracle.com
Cc: daniel.m.jordan@oracle.com
Link: https://lkml.kernel.org/r/20180730135252.24599-1-pasha.tatashin@oracle.com
---
 kernel/sched/clock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c
index 811a39aca1ce..e3e3b979f9bd 100644
--- a/kernel/sched/clock.c
+++ b/kernel/sched/clock.c
@@ -452,7 +452,9 @@ EXPORT_SYMBOL_GPL(sched_clock_idle_wakeup_event);
 void __init sched_clock_init(void)
 {
 	static_branch_inc(&sched_clock_running);
+	local_irq_disable();
 	generic_sched_clock_init();
+	local_irq_enable();
 }
 
 u64 sched_clock_cpu(int cpu)

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

* Re: [PATCH] sched/clock: disable irq for generic_sched_clock_init
  2018-07-30 13:52 [PATCH] sched/clock: disable irq for generic_sched_clock_init Pavel Tatashin
  2018-07-30 17:37 ` [tip:x86/timers] sched/clock: Disable interrupts when calling generic_sched_clock_init() tip-bot for Pavel Tatashin
@ 2018-07-31 13:19 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2018-07-31 13:19 UTC (permalink / raw)
  To: Pavel Tatashin
  Cc: steven.sistare, daniel.m.jordan, linux-kernel, tglx, mingo, peterz

On Mon, Jul 30, 2018 at 09:52:52AM -0400, Pavel Tatashin wrote:
> sched_clock_init() used be called early in boot  when IRQs are still
> disabled. Now, it is called when IRQs are already enabled, and this
> triggers some warning:
> 
> WARNING: CPU: 0 PID: 0 at kernel/time/sched_clock.c:180
> sched_clock_register+0x44/0x278
> Modules linked in:
> CPU: 0 PID: 0 Comm: swapper Not tainted 4.18.0-rc6-next-20180724 #1
> Hardware name: ARM Integrator/CP (Device Tree)
> [<c0010cb4>] (unwind_backtrace) from [<c000dc24>] (show_stack+0x10/0x18)
> [<c000dc24>] (show_stack) from [<c03ffb94>] (dump_stack+0x18/0x24)
> [<c03ffb94>] (dump_stack) from [<c001a000>] (__warn+0xc8/0xf0)
> [<c001a000>] (__warn) from [<c001a13c>] (warn_slowpath_null+0x3c/0x4c)
> [<c001a13c>] (warn_slowpath_null) from [<c052367c>] (sched_clock_register+0x44/0x278)
> [<c052367c>] (sched_clock_register) from [<c05238d8>] (generic_sched_clock_init+0x28/0x88)
> [<c05238d8>] (generic_sched_clock_init) from [<c0521a00>] (sched_clock_init+0x54/0x74)
> [<c0521a00>] (sched_clock_init) from [<c0519c18>] (start_kernel+0x310/0x3e4)
> [<c0519c18>] (start_kernel) from [<00000000>] (  (null))
> ---[ end trace 08080eb81afa002c ]---
> 
> Disable IRQs for the duration of generic_sched_clock_init().
> 
> Fixes: 857baa87b642 ("sched/clock: Enable sched clock early")
> 
> Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
> Reported-by: Guenter Roeck <linux@roeck-us.net>

Tested-by: Guenter Roeck <linux@roeck-us.net>

Guenter

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

end of thread, other threads:[~2018-07-31 13:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-30 13:52 [PATCH] sched/clock: disable irq for generic_sched_clock_init Pavel Tatashin
2018-07-30 17:37 ` [tip:x86/timers] sched/clock: Disable interrupts when calling generic_sched_clock_init() tip-bot for Pavel Tatashin
2018-07-31 13:19 ` [PATCH] sched/clock: disable irq for generic_sched_clock_init Guenter Roeck

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.