Skip to contentSkip to conversation

powerpc/time: enable sched clock for irqtime

PATCH Applied Pingfan Liu 2 participants 3 messages Oct 22, 2020 – Feb 3, 2021 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/time: enable sched clock for irqtime

When CONFIG_IRQ_TIME_ACCOUNTING and CONFIG_VIRT_CPU_ACCOUNTING_GEN, powerpc does not enable "sched_clock_irqtime" and can not utilize irq time accounting.

Like x86, powerpc does not use the sched_clock_register() interface. So it needs an dedicated call to enable_sched_clock_irqtime() to enable irq time accounting.

Cc Michael Ellerman <[email protected]>
Cc Christophe Leroy <[email protected]>
Cc Nicholas Piggin <[email protected]>

To: [email protected]

---
 arch/powerpc/kernel/time.c | 2 ++
 1 file changed, 2 insertions(+)
arch/powerpc/kernel/time.c +2 -0
index f85539e..4083b59e 100644
@@ -53,6 +53,7 @@
 #include <linux/of_clk.h>
 #include <linux/suspend.h>
 #include <linux/sched/cputime.h>
+#include <linux/sched/clock.h>
 #include <linux/processor.h>
 #include <asm/trace.h>
 
@@ -1134,6 +1135,7 @@ void __init time_init(void)
 	tick_setup_hrtimer_broadcast();
 
 	of_clk_init(NULL);
+	enable_sched_clock_irqtime();
 }
 
 /*
Signature · 1 line
2.7.5
#1 lore raw

I encounter a irq flood on Power9 machine, and tries a way to work around it by https://www.spinics.net/lists/kernel/msg3705028.html

As irq time accounting is the foundation for the method, it needs to make irq accounting take effect on powerpc platform.

Quoted 41 lines · Pingfan Liu

When CONFIG_IRQ_TIME_ACCOUNTING and CONFIG_VIRT_CPU_ACCOUNTING_GEN, powerpc does not enable "sched_clock_irqtime" and can not utilize irq time accounting.

Like x86, powerpc does not use the sched_clock_register() interface. So it needs an dedicated call to enable_sched_clock_irqtime() to enable irq time accounting.

Cc Michael Ellerman <[email protected]>
Cc Christophe Leroy <[email protected]>
Cc Nicholas Piggin <[email protected]>

To: [email protected]

---
 arch/powerpc/kernel/time.c | 2 ++
 1 file changed, 2 insertions(+)
arch/powerpc/kernel/time.c +2 -1
index f85539e..4083b59e 100644
@@ -53,6 +53,7 @@
 #include <linux/of_clk.h>
 #include <linux/suspend.h>
 #include <linux/sched/cputime.h>
+#include <linux/sched/clock.h>
 #include <linux/processor.h>
 #include <asm/trace.h>
 
@@ -1134,6 +1135,7 @@ void __init time_init(void)
        tick_setup_hrtimer_broadcast();
 
        of_clk_init(NULL);
+       enable_sched_clock_irqtime();
 }
 
 /*
--

2.7.5

#2 lore raw
In reply to Pingfan Liu
Quoted 7 lines · Pingfan Liu

When CONFIG_IRQ_TIME_ACCOUNTING and CONFIG_VIRT_CPU_ACCOUNTING_GEN, powerpc does not enable "sched_clock_irqtime" and can not utilize irq time accounting.

Like x86, powerpc does not use the sched_clock_register() interface. So it needs an dedicated call to enable_sched_clock_irqtime() to enable irq time accounting.

Applied to powerpc/next.

[1/1] powerpc/time: Enable sched clock for irqtime

      https://git.kernel.org/powerpc/c/b709e32ef570b8b91dfbcb63cffac4324c87799f

cheers