All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 RESEND 0/5] sched/vtime: vtime.h headers cleanup
@ 2024-04-10 15:09 ` Alexander Gordeev
  0 siblings, 0 replies; 18+ messages in thread
From: Alexander Gordeev @ 2024-04-10 15:09 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot, Arnd Bergmann
  Cc: linux-kernel, linux-s390, linuxppc-dev, linux-arch,
	Nicholas Piggin, Michael Ellerman, Frederic Weisbecker,
	Heiko Carstens, Vasily Gorbik

Hi All,

There are no changes since the last post, just a re-send.

v2:
- patch 4: commit message reworded (Heiko)
- patch 5: vtime.h is removed from Kbuild scripts (PowerPC only) (Heiko)

v1:
Please find a small cleanup to vtime_task_switch() wiring.
I split it into smaller patches to allow separate PowerPC
vs s390 reviews. Otherwise patches 2+3 and 4+5 could have
been merged.

I tested it on s390 and compile-tested it on 32- and 64-bit
PowerPC and few other major architectures only, but it is
only of concern for CONFIG_VIRT_CPU_ACCOUNTING_NATIVE-capable
ones (AFAICT).

Thanks!


Alexander Gordeev (5):
  sched/vtime: remove confusing arch_vtime_task_switch() declaration
  sched/vtime: get rid of generic vtime_task_switch() implementation
  s390/vtime: remove unused __ARCH_HAS_VTIME_TASK_SWITCH leftover
  s390/irq,nmi: include <asm/vtime.h> header directly
  sched/vtime: do not include <asm/vtime.h> header

 arch/powerpc/include/asm/Kbuild    |  1 -
 arch/powerpc/include/asm/cputime.h | 13 -------------
 arch/powerpc/kernel/time.c         | 22 ++++++++++++++++++++++
 arch/s390/include/asm/vtime.h      |  2 --
 arch/s390/kernel/irq.c             |  1 +
 arch/s390/kernel/nmi.c             |  1 +
 include/asm-generic/vtime.h        |  1 -
 include/linux/vtime.h              |  5 -----
 kernel/sched/cputime.c             | 13 -------------
 9 files changed, 24 insertions(+), 35 deletions(-)
 delete mode 100644 include/asm-generic/vtime.h

-- 
2.40.1


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

* [PATCH v2 RESEND 0/5] sched/vtime: vtime.h headers cleanup
@ 2024-04-10 15:09 ` Alexander Gordeev
  0 siblings, 0 replies; 18+ messages in thread
From: Alexander Gordeev @ 2024-04-10 15:09 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot, Arnd Bergmann
  Cc: linux-arch, linux-s390, Vasily Gorbik, Frederic Weisbecker,
	linux-kernel, Nicholas Piggin, linuxppc-dev, Heiko Carstens

Hi All,

There are no changes since the last post, just a re-send.

v2:
- patch 4: commit message reworded (Heiko)
- patch 5: vtime.h is removed from Kbuild scripts (PowerPC only) (Heiko)

v1:
Please find a small cleanup to vtime_task_switch() wiring.
I split it into smaller patches to allow separate PowerPC
vs s390 reviews. Otherwise patches 2+3 and 4+5 could have
been merged.

I tested it on s390 and compile-tested it on 32- and 64-bit
PowerPC and few other major architectures only, but it is
only of concern for CONFIG_VIRT_CPU_ACCOUNTING_NATIVE-capable
ones (AFAICT).

Thanks!


Alexander Gordeev (5):
  sched/vtime: remove confusing arch_vtime_task_switch() declaration
  sched/vtime: get rid of generic vtime_task_switch() implementation
  s390/vtime: remove unused __ARCH_HAS_VTIME_TASK_SWITCH leftover
  s390/irq,nmi: include <asm/vtime.h> header directly
  sched/vtime: do not include <asm/vtime.h> header

 arch/powerpc/include/asm/Kbuild    |  1 -
 arch/powerpc/include/asm/cputime.h | 13 -------------
 arch/powerpc/kernel/time.c         | 22 ++++++++++++++++++++++
 arch/s390/include/asm/vtime.h      |  2 --
 arch/s390/kernel/irq.c             |  1 +
 arch/s390/kernel/nmi.c             |  1 +
 include/asm-generic/vtime.h        |  1 -
 include/linux/vtime.h              |  5 -----
 kernel/sched/cputime.c             | 13 -------------
 9 files changed, 24 insertions(+), 35 deletions(-)
 delete mode 100644 include/asm-generic/vtime.h

-- 
2.40.1


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

* [PATCH v2 RESEND 1/5] sched/vtime: remove confusing arch_vtime_task_switch() declaration
  2024-04-10 15:09 ` Alexander Gordeev
@ 2024-04-10 15:09   ` Alexander Gordeev
  -1 siblings, 0 replies; 18+ messages in thread
From: Alexander Gordeev @ 2024-04-10 15:09 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot, Arnd Bergmann
  Cc: linux-kernel, linux-s390, linuxppc-dev, linux-arch,
	Nicholas Piggin, Michael Ellerman, Frederic Weisbecker,
	Heiko Carstens, Vasily Gorbik

Callback arch_vtime_task_switch() is only defined when
CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is selected. Yet, the
function prototype forward declaration is present for
CONFIG_VIRT_CPU_ACCOUNTING_GEN variant. Remove it.

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
 include/linux/vtime.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index 3684487d01e1..593466ceebed 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -18,7 +18,6 @@ extern void vtime_account_idle(struct task_struct *tsk);
 #endif /* !CONFIG_VIRT_CPU_ACCOUNTING */
 
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
-extern void arch_vtime_task_switch(struct task_struct *tsk);
 extern void vtime_user_enter(struct task_struct *tsk);
 extern void vtime_user_exit(struct task_struct *tsk);
 extern void vtime_guest_enter(struct task_struct *tsk);
-- 
2.40.1


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

* [PATCH v2 RESEND 1/5] sched/vtime: remove confusing arch_vtime_task_switch() declaration
@ 2024-04-10 15:09   ` Alexander Gordeev
  0 siblings, 0 replies; 18+ messages in thread
From: Alexander Gordeev @ 2024-04-10 15:09 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot, Arnd Bergmann
  Cc: linux-arch, linux-s390, Vasily Gorbik, Frederic Weisbecker,
	linux-kernel, Nicholas Piggin, linuxppc-dev, Heiko Carstens

Callback arch_vtime_task_switch() is only defined when
CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is selected. Yet, the
function prototype forward declaration is present for
CONFIG_VIRT_CPU_ACCOUNTING_GEN variant. Remove it.

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
 include/linux/vtime.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index 3684487d01e1..593466ceebed 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -18,7 +18,6 @@ extern void vtime_account_idle(struct task_struct *tsk);
 #endif /* !CONFIG_VIRT_CPU_ACCOUNTING */
 
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
-extern void arch_vtime_task_switch(struct task_struct *tsk);
 extern void vtime_user_enter(struct task_struct *tsk);
 extern void vtime_user_exit(struct task_struct *tsk);
 extern void vtime_guest_enter(struct task_struct *tsk);
-- 
2.40.1


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

* [PATCH v2 RESEND 2/5] sched/vtime: get rid of generic vtime_task_switch() implementation
  2024-04-10 15:09 ` Alexander Gordeev
@ 2024-04-10 15:09   ` Alexander Gordeev
  -1 siblings, 0 replies; 18+ messages in thread
From: Alexander Gordeev @ 2024-04-10 15:09 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot, Arnd Bergmann
  Cc: linux-kernel, linux-s390, linuxppc-dev, linux-arch,
	Nicholas Piggin, Michael Ellerman, Frederic Weisbecker,
	Heiko Carstens, Vasily Gorbik

The generic vtime_task_switch() implementation gets built only
if __ARCH_HAS_VTIME_TASK_SWITCH is not defined, but requires an
architecture to implement arch_vtime_task_switch() callback at
the same time, which is confusing.

Further, arch_vtime_task_switch() is implemented for 32-bit PowerPC
architecture only and vtime_task_switch() generic variant is rather
superfluous.

Simplify the whole vtime_task_switch() wiring by moving the existing
generic implementation to PowerPC.

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
 arch/powerpc/include/asm/cputime.h | 13 -------------
 arch/powerpc/kernel/time.c         | 22 ++++++++++++++++++++++
 kernel/sched/cputime.c             | 13 -------------
 3 files changed, 22 insertions(+), 26 deletions(-)

diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h
index 4961fb38e438..aff858ca99c0 100644
--- a/arch/powerpc/include/asm/cputime.h
+++ b/arch/powerpc/include/asm/cputime.h
@@ -32,23 +32,10 @@
 #ifdef CONFIG_PPC64
 #define get_accounting(tsk)	(&get_paca()->accounting)
 #define raw_get_accounting(tsk)	(&local_paca->accounting)
-static inline void arch_vtime_task_switch(struct task_struct *tsk) { }
 
 #else
 #define get_accounting(tsk)	(&task_thread_info(tsk)->accounting)
 #define raw_get_accounting(tsk)	get_accounting(tsk)
-/*
- * Called from the context switch with interrupts disabled, to charge all
- * accumulated times to the current process, and to prepare accounting on
- * the next process.
- */
-static inline void arch_vtime_task_switch(struct task_struct *prev)
-{
-	struct cpu_accounting_data *acct = get_accounting(current);
-	struct cpu_accounting_data *acct0 = get_accounting(prev);
-
-	acct->starttime = acct0->starttime;
-}
 #endif
 
 /*
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index df20cf201f74..c0fdc6d94fee 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -354,6 +354,28 @@ void vtime_flush(struct task_struct *tsk)
 	acct->hardirq_time = 0;
 	acct->softirq_time = 0;
 }
+
+/*
+ * Called from the context switch with interrupts disabled, to charge all
+ * accumulated times to the current process, and to prepare accounting on
+ * the next process.
+ */
+void vtime_task_switch(struct task_struct *prev)
+{
+	if (is_idle_task(prev))
+		vtime_account_idle(prev);
+	else
+		vtime_account_kernel(prev);
+
+	vtime_flush(prev);
+
+	if (!IS_ENABLED(CONFIG_PPC64)) {
+		struct cpu_accounting_data *acct = get_accounting(current);
+		struct cpu_accounting_data *acct0 = get_accounting(prev);
+
+		acct->starttime = acct0->starttime;
+	}
+}
 #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
 
 void __no_kcsan __delay(unsigned long loops)
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index af7952f12e6c..aa48b2ec879d 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -424,19 +424,6 @@ static inline void irqtime_account_process_tick(struct task_struct *p, int user_
  */
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
 
-# ifndef __ARCH_HAS_VTIME_TASK_SWITCH
-void vtime_task_switch(struct task_struct *prev)
-{
-	if (is_idle_task(prev))
-		vtime_account_idle(prev);
-	else
-		vtime_account_kernel(prev);
-
-	vtime_flush(prev);
-	arch_vtime_task_switch(prev);
-}
-# endif
-
 void vtime_account_irq(struct task_struct *tsk, unsigned int offset)
 {
 	unsigned int pc = irq_count() - offset;
-- 
2.40.1


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

* [PATCH v2 RESEND 2/5] sched/vtime: get rid of generic vtime_task_switch() implementation
@ 2024-04-10 15:09   ` Alexander Gordeev
  0 siblings, 0 replies; 18+ messages in thread
From: Alexander Gordeev @ 2024-04-10 15:09 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot, Arnd Bergmann
  Cc: linux-arch, linux-s390, Vasily Gorbik, Frederic Weisbecker,
	linux-kernel, Nicholas Piggin, linuxppc-dev, Heiko Carstens

The generic vtime_task_switch() implementation gets built only
if __ARCH_HAS_VTIME_TASK_SWITCH is not defined, but requires an
architecture to implement arch_vtime_task_switch() callback at
the same time, which is confusing.

Further, arch_vtime_task_switch() is implemented for 32-bit PowerPC
architecture only and vtime_task_switch() generic variant is rather
superfluous.

Simplify the whole vtime_task_switch() wiring by moving the existing
generic implementation to PowerPC.

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
 arch/powerpc/include/asm/cputime.h | 13 -------------
 arch/powerpc/kernel/time.c         | 22 ++++++++++++++++++++++
 kernel/sched/cputime.c             | 13 -------------
 3 files changed, 22 insertions(+), 26 deletions(-)

diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h
index 4961fb38e438..aff858ca99c0 100644
--- a/arch/powerpc/include/asm/cputime.h
+++ b/arch/powerpc/include/asm/cputime.h
@@ -32,23 +32,10 @@
 #ifdef CONFIG_PPC64
 #define get_accounting(tsk)	(&get_paca()->accounting)
 #define raw_get_accounting(tsk)	(&local_paca->accounting)
-static inline void arch_vtime_task_switch(struct task_struct *tsk) { }
 
 #else
 #define get_accounting(tsk)	(&task_thread_info(tsk)->accounting)
 #define raw_get_accounting(tsk)	get_accounting(tsk)
-/*
- * Called from the context switch with interrupts disabled, to charge all
- * accumulated times to the current process, and to prepare accounting on
- * the next process.
- */
-static inline void arch_vtime_task_switch(struct task_struct *prev)
-{
-	struct cpu_accounting_data *acct = get_accounting(current);
-	struct cpu_accounting_data *acct0 = get_accounting(prev);
-
-	acct->starttime = acct0->starttime;
-}
 #endif
 
 /*
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index df20cf201f74..c0fdc6d94fee 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -354,6 +354,28 @@ void vtime_flush(struct task_struct *tsk)
 	acct->hardirq_time = 0;
 	acct->softirq_time = 0;
 }
+
+/*
+ * Called from the context switch with interrupts disabled, to charge all
+ * accumulated times to the current process, and to prepare accounting on
+ * the next process.
+ */
+void vtime_task_switch(struct task_struct *prev)
+{
+	if (is_idle_task(prev))
+		vtime_account_idle(prev);
+	else
+		vtime_account_kernel(prev);
+
+	vtime_flush(prev);
+
+	if (!IS_ENABLED(CONFIG_PPC64)) {
+		struct cpu_accounting_data *acct = get_accounting(current);
+		struct cpu_accounting_data *acct0 = get_accounting(prev);
+
+		acct->starttime = acct0->starttime;
+	}
+}
 #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
 
 void __no_kcsan __delay(unsigned long loops)
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index af7952f12e6c..aa48b2ec879d 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -424,19 +424,6 @@ static inline void irqtime_account_process_tick(struct task_struct *p, int user_
  */
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
 
-# ifndef __ARCH_HAS_VTIME_TASK_SWITCH
-void vtime_task_switch(struct task_struct *prev)
-{
-	if (is_idle_task(prev))
-		vtime_account_idle(prev);
-	else
-		vtime_account_kernel(prev);
-
-	vtime_flush(prev);
-	arch_vtime_task_switch(prev);
-}
-# endif
-
 void vtime_account_irq(struct task_struct *tsk, unsigned int offset)
 {
 	unsigned int pc = irq_count() - offset;
-- 
2.40.1


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

* [PATCH v2 RESEND 3/5] s390/vtime: remove unused __ARCH_HAS_VTIME_TASK_SWITCH leftover
  2024-04-10 15:09 ` Alexander Gordeev
@ 2024-04-10 15:09   ` Alexander Gordeev
  -1 siblings, 0 replies; 18+ messages in thread
From: Alexander Gordeev @ 2024-04-10 15:09 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot, Arnd Bergmann
  Cc: linux-kernel, linux-s390, linuxppc-dev, linux-arch,
	Nicholas Piggin, Michael Ellerman, Frederic Weisbecker,
	Heiko Carstens, Vasily Gorbik

__ARCH_HAS_VTIME_TASK_SWITCH macro is not used anymore.

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Acked-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
 arch/s390/include/asm/vtime.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/s390/include/asm/vtime.h b/arch/s390/include/asm/vtime.h
index fe17e448c0c5..561c91c1a87c 100644
--- a/arch/s390/include/asm/vtime.h
+++ b/arch/s390/include/asm/vtime.h
@@ -2,8 +2,6 @@
 #ifndef _S390_VTIME_H
 #define _S390_VTIME_H
 
-#define __ARCH_HAS_VTIME_TASK_SWITCH
-
 static inline void update_timer_sys(void)
 {
 	S390_lowcore.system_timer += S390_lowcore.last_update_timer - S390_lowcore.exit_timer;
-- 
2.40.1


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

* [PATCH v2 RESEND 3/5] s390/vtime: remove unused __ARCH_HAS_VTIME_TASK_SWITCH leftover
@ 2024-04-10 15:09   ` Alexander Gordeev
  0 siblings, 0 replies; 18+ messages in thread
From: Alexander Gordeev @ 2024-04-10 15:09 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot, Arnd Bergmann
  Cc: linux-arch, linux-s390, Vasily Gorbik, Frederic Weisbecker,
	linux-kernel, Nicholas Piggin, linuxppc-dev, Heiko Carstens

__ARCH_HAS_VTIME_TASK_SWITCH macro is not used anymore.

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Acked-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
 arch/s390/include/asm/vtime.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/s390/include/asm/vtime.h b/arch/s390/include/asm/vtime.h
index fe17e448c0c5..561c91c1a87c 100644
--- a/arch/s390/include/asm/vtime.h
+++ b/arch/s390/include/asm/vtime.h
@@ -2,8 +2,6 @@
 #ifndef _S390_VTIME_H
 #define _S390_VTIME_H
 
-#define __ARCH_HAS_VTIME_TASK_SWITCH
-
 static inline void update_timer_sys(void)
 {
 	S390_lowcore.system_timer += S390_lowcore.last_update_timer - S390_lowcore.exit_timer;
-- 
2.40.1


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

* [PATCH v2 RESEND 4/5] s390/irq,nmi: include <asm/vtime.h> header directly
  2024-04-10 15:09 ` Alexander Gordeev
@ 2024-04-10 15:09   ` Alexander Gordeev
  -1 siblings, 0 replies; 18+ messages in thread
From: Alexander Gordeev @ 2024-04-10 15:09 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot, Arnd Bergmann
  Cc: linux-kernel, linux-s390, linuxppc-dev, linux-arch,
	Nicholas Piggin, Michael Ellerman, Frederic Weisbecker,
	Heiko Carstens, Vasily Gorbik

update_timer_sys() and update_timer_mcck() are inlines used for
CPU time accounting from the interrupt and machine-check handlers.
These routines are specific to s390 architecture, but included
via <linux/vtime.h> header implicitly. Avoid the extra loop and
include <asm/vtime.h> header directly.

Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
 arch/s390/kernel/irq.c | 1 +
 arch/s390/kernel/nmi.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index 6f71b0ce1068..259496fe0ef9 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -29,6 +29,7 @@
 #include <asm/hw_irq.h>
 #include <asm/stacktrace.h>
 #include <asm/softirq_stack.h>
+#include <asm/vtime.h>
 #include "entry.h"
 
 DEFINE_PER_CPU_SHARED_ALIGNED(struct irq_stat, irq_stat);
diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c
index c77382a67325..230d010bac9b 100644
--- a/arch/s390/kernel/nmi.c
+++ b/arch/s390/kernel/nmi.c
@@ -31,6 +31,7 @@
 #include <asm/crw.h>
 #include <asm/asm-offsets.h>
 #include <asm/pai.h>
+#include <asm/vtime.h>
 
 struct mcck_struct {
 	unsigned int kill_task : 1;
-- 
2.40.1


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

* [PATCH v2 RESEND 4/5] s390/irq,nmi: include <asm/vtime.h> header directly
@ 2024-04-10 15:09   ` Alexander Gordeev
  0 siblings, 0 replies; 18+ messages in thread
From: Alexander Gordeev @ 2024-04-10 15:09 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot, Arnd Bergmann
  Cc: linux-arch, linux-s390, Vasily Gorbik, Frederic Weisbecker,
	linux-kernel, Nicholas Piggin, linuxppc-dev, Heiko Carstens

update_timer_sys() and update_timer_mcck() are inlines used for
CPU time accounting from the interrupt and machine-check handlers.
These routines are specific to s390 architecture, but included
via <linux/vtime.h> header implicitly. Avoid the extra loop and
include <asm/vtime.h> header directly.

Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
 arch/s390/kernel/irq.c | 1 +
 arch/s390/kernel/nmi.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index 6f71b0ce1068..259496fe0ef9 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -29,6 +29,7 @@
 #include <asm/hw_irq.h>
 #include <asm/stacktrace.h>
 #include <asm/softirq_stack.h>
+#include <asm/vtime.h>
 #include "entry.h"
 
 DEFINE_PER_CPU_SHARED_ALIGNED(struct irq_stat, irq_stat);
diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c
index c77382a67325..230d010bac9b 100644
--- a/arch/s390/kernel/nmi.c
+++ b/arch/s390/kernel/nmi.c
@@ -31,6 +31,7 @@
 #include <asm/crw.h>
 #include <asm/asm-offsets.h>
 #include <asm/pai.h>
+#include <asm/vtime.h>
 
 struct mcck_struct {
 	unsigned int kill_task : 1;
-- 
2.40.1


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

* [PATCH v2 RESEND 5/5] sched/vtime: do not include <asm/vtime.h> header
  2024-04-10 15:09 ` Alexander Gordeev
@ 2024-04-10 15:09   ` Alexander Gordeev
  -1 siblings, 0 replies; 18+ messages in thread
From: Alexander Gordeev @ 2024-04-10 15:09 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot, Arnd Bergmann
  Cc: linux-kernel, linux-s390, linuxppc-dev, linux-arch,
	Nicholas Piggin, Michael Ellerman, Frederic Weisbecker,
	Heiko Carstens, Vasily Gorbik

There is no architecture-specific code or data left
that generic <linux/vtime.h> needs to know about.
Thus, avoid the inclusion of <asm/vtime.h> header.

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
 arch/powerpc/include/asm/Kbuild | 1 -
 include/asm-generic/vtime.h     | 1 -
 include/linux/vtime.h           | 4 ----
 3 files changed, 6 deletions(-)
 delete mode 100644 include/asm-generic/vtime.h

diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index 61a8d5555cd7..e5fdc336c9b2 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -6,5 +6,4 @@ generic-y += agp.h
 generic-y += kvm_types.h
 generic-y += mcs_spinlock.h
 generic-y += qrwlock.h
-generic-y += vtime.h
 generic-y += early_ioremap.h
diff --git a/include/asm-generic/vtime.h b/include/asm-generic/vtime.h
deleted file mode 100644
index b1a49677fe25..000000000000
--- a/include/asm-generic/vtime.h
+++ /dev/null
@@ -1 +0,0 @@
-/* no content, but patch(1) dislikes empty files */
diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index 593466ceebed..29dd5b91dd7d 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -5,10 +5,6 @@
 #include <linux/context_tracking_state.h>
 #include <linux/sched.h>
 
-#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
-#include <asm/vtime.h>
-#endif
-
 /*
  * Common vtime APIs
  */
-- 
2.40.1


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

* [PATCH v2 RESEND 5/5] sched/vtime: do not include <asm/vtime.h> header
@ 2024-04-10 15:09   ` Alexander Gordeev
  0 siblings, 0 replies; 18+ messages in thread
From: Alexander Gordeev @ 2024-04-10 15:09 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot, Arnd Bergmann
  Cc: linux-arch, linux-s390, Vasily Gorbik, Frederic Weisbecker,
	linux-kernel, Nicholas Piggin, linuxppc-dev, Heiko Carstens

There is no architecture-specific code or data left
that generic <linux/vtime.h> needs to know about.
Thus, avoid the inclusion of <asm/vtime.h> header.

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
 arch/powerpc/include/asm/Kbuild | 1 -
 include/asm-generic/vtime.h     | 1 -
 include/linux/vtime.h           | 4 ----
 3 files changed, 6 deletions(-)
 delete mode 100644 include/asm-generic/vtime.h

diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index 61a8d5555cd7..e5fdc336c9b2 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -6,5 +6,4 @@ generic-y += agp.h
 generic-y += kvm_types.h
 generic-y += mcs_spinlock.h
 generic-y += qrwlock.h
-generic-y += vtime.h
 generic-y += early_ioremap.h
diff --git a/include/asm-generic/vtime.h b/include/asm-generic/vtime.h
deleted file mode 100644
index b1a49677fe25..000000000000
--- a/include/asm-generic/vtime.h
+++ /dev/null
@@ -1 +0,0 @@
-/* no content, but patch(1) dislikes empty files */
diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index 593466ceebed..29dd5b91dd7d 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -5,10 +5,6 @@
 #include <linux/context_tracking_state.h>
 #include <linux/sched.h>
 
-#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
-#include <asm/vtime.h>
-#endif
-
 /*
  * Common vtime APIs
  */
-- 
2.40.1


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

* Re: [PATCH v2 RESEND 0/5] sched/vtime: vtime.h headers cleanup
  2024-04-10 15:09 ` Alexander Gordeev
@ 2024-04-17 10:27   ` Frederic Weisbecker
  -1 siblings, 0 replies; 18+ messages in thread
From: Frederic Weisbecker @ 2024-04-17 10:27 UTC (permalink / raw)
  To: Alexander Gordeev, Ingo Molnar
  Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Arnd Bergmann, linux-kernel, linux-s390, linuxppc-dev,
	linux-arch, Nicholas Piggin, Michael Ellerman, Heiko Carstens,
	Vasily Gorbik

Le Wed, Apr 10, 2024 at 05:09:43PM +0200, Alexander Gordeev a écrit :
> Hi All,
> 
> There are no changes since the last post, just a re-send.
> 
> v2:
> - patch 4: commit message reworded (Heiko)
> - patch 5: vtime.h is removed from Kbuild scripts (PowerPC only) (Heiko)
> 
> v1:
> Please find a small cleanup to vtime_task_switch() wiring.
> I split it into smaller patches to allow separate PowerPC
> vs s390 reviews. Otherwise patches 2+3 and 4+5 could have
> been merged.
> 
> I tested it on s390 and compile-tested it on 32- and 64-bit
> PowerPC and few other major architectures only, but it is
> only of concern for CONFIG_VIRT_CPU_ACCOUNTING_NATIVE-capable
> ones (AFAICT).
> 
> Thanks!

It probably makes sense to apply the whole series to the scheduler tree.
Does any powerpc or s390 maintainer oppose to that?

Thanks.

> 
> 
> Alexander Gordeev (5):
>   sched/vtime: remove confusing arch_vtime_task_switch() declaration
>   sched/vtime: get rid of generic vtime_task_switch() implementation
>   s390/vtime: remove unused __ARCH_HAS_VTIME_TASK_SWITCH leftover
>   s390/irq,nmi: include <asm/vtime.h> header directly
>   sched/vtime: do not include <asm/vtime.h> header
> 
>  arch/powerpc/include/asm/Kbuild    |  1 -
>  arch/powerpc/include/asm/cputime.h | 13 -------------
>  arch/powerpc/kernel/time.c         | 22 ++++++++++++++++++++++
>  arch/s390/include/asm/vtime.h      |  2 --
>  arch/s390/kernel/irq.c             |  1 +
>  arch/s390/kernel/nmi.c             |  1 +
>  include/asm-generic/vtime.h        |  1 -
>  include/linux/vtime.h              |  5 -----
>  kernel/sched/cputime.c             | 13 -------------
>  9 files changed, 24 insertions(+), 35 deletions(-)
>  delete mode 100644 include/asm-generic/vtime.h
> 
> -- 
> 2.40.1
> 

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

* Re: [PATCH v2 RESEND 0/5] sched/vtime: vtime.h headers cleanup
@ 2024-04-17 10:27   ` Frederic Weisbecker
  0 siblings, 0 replies; 18+ messages in thread
From: Frederic Weisbecker @ 2024-04-17 10:27 UTC (permalink / raw)
  To: Alexander Gordeev, Ingo Molnar
  Cc: Juri Lelli, linux-s390, Vincent Guittot, Vasily Gorbik,
	Arnd Bergmann, Peter Zijlstra, Heiko Carstens, linux-kernel,
	Nicholas Piggin, Ingo Molnar, linux-arch, linuxppc-dev

Le Wed, Apr 10, 2024 at 05:09:43PM +0200, Alexander Gordeev a écrit :
> Hi All,
> 
> There are no changes since the last post, just a re-send.
> 
> v2:
> - patch 4: commit message reworded (Heiko)
> - patch 5: vtime.h is removed from Kbuild scripts (PowerPC only) (Heiko)
> 
> v1:
> Please find a small cleanup to vtime_task_switch() wiring.
> I split it into smaller patches to allow separate PowerPC
> vs s390 reviews. Otherwise patches 2+3 and 4+5 could have
> been merged.
> 
> I tested it on s390 and compile-tested it on 32- and 64-bit
> PowerPC and few other major architectures only, but it is
> only of concern for CONFIG_VIRT_CPU_ACCOUNTING_NATIVE-capable
> ones (AFAICT).
> 
> Thanks!

It probably makes sense to apply the whole series to the scheduler tree.
Does any powerpc or s390 maintainer oppose to that?

Thanks.

> 
> 
> Alexander Gordeev (5):
>   sched/vtime: remove confusing arch_vtime_task_switch() declaration
>   sched/vtime: get rid of generic vtime_task_switch() implementation
>   s390/vtime: remove unused __ARCH_HAS_VTIME_TASK_SWITCH leftover
>   s390/irq,nmi: include <asm/vtime.h> header directly
>   sched/vtime: do not include <asm/vtime.h> header
> 
>  arch/powerpc/include/asm/Kbuild    |  1 -
>  arch/powerpc/include/asm/cputime.h | 13 -------------
>  arch/powerpc/kernel/time.c         | 22 ++++++++++++++++++++++
>  arch/s390/include/asm/vtime.h      |  2 --
>  arch/s390/kernel/irq.c             |  1 +
>  arch/s390/kernel/nmi.c             |  1 +
>  include/asm-generic/vtime.h        |  1 -
>  include/linux/vtime.h              |  5 -----
>  kernel/sched/cputime.c             | 13 -------------
>  9 files changed, 24 insertions(+), 35 deletions(-)
>  delete mode 100644 include/asm-generic/vtime.h
> 
> -- 
> 2.40.1
> 

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

* Re: [PATCH v2 RESEND 0/5] sched/vtime: vtime.h headers cleanup
  2024-04-17 10:27   ` Frederic Weisbecker
@ 2024-04-18  1:00     ` Michael Ellerman
  -1 siblings, 0 replies; 18+ messages in thread
From: Michael Ellerman @ 2024-04-18  1:00 UTC (permalink / raw)
  To: Frederic Weisbecker, Alexander Gordeev, Ingo Molnar
  Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Arnd Bergmann, linux-kernel, linux-s390, linuxppc-dev,
	linux-arch, Nicholas Piggin, Heiko Carstens, Vasily Gorbik

Frederic Weisbecker <frederic@kernel.org> writes:
> Le Wed, Apr 10, 2024 at 05:09:43PM +0200, Alexander Gordeev a écrit :
>> Hi All,
>> 
>> There are no changes since the last post, just a re-send.
>> 
>> v2:
>> - patch 4: commit message reworded (Heiko)
>> - patch 5: vtime.h is removed from Kbuild scripts (PowerPC only) (Heiko)
>> 
>> v1:
>> Please find a small cleanup to vtime_task_switch() wiring.
>> I split it into smaller patches to allow separate PowerPC
>> vs s390 reviews. Otherwise patches 2+3 and 4+5 could have
>> been merged.
>> 
>> I tested it on s390 and compile-tested it on 32- and 64-bit
>> PowerPC and few other major architectures only, but it is
>> only of concern for CONFIG_VIRT_CPU_ACCOUNTING_NATIVE-capable
>> ones (AFAICT).
>> 
>> Thanks!
>
> It probably makes sense to apply the whole series to the scheduler tree.
> Does any powerpc or s390 maintainer oppose to that?

No objection. It has acks and reviews from powerpc.

cheers

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

* Re: [PATCH v2 RESEND 0/5] sched/vtime: vtime.h headers cleanup
@ 2024-04-18  1:00     ` Michael Ellerman
  0 siblings, 0 replies; 18+ messages in thread
From: Michael Ellerman @ 2024-04-18  1:00 UTC (permalink / raw)
  To: Frederic Weisbecker, Alexander Gordeev, Ingo Molnar
  Cc: Juri Lelli, linux-s390, Vincent Guittot, Vasily Gorbik,
	Arnd Bergmann, Peter Zijlstra, Heiko Carstens, linux-kernel,
	Nicholas Piggin, Ingo Molnar, linux-arch, linuxppc-dev

Frederic Weisbecker <frederic@kernel.org> writes:
> Le Wed, Apr 10, 2024 at 05:09:43PM +0200, Alexander Gordeev a écrit :
>> Hi All,
>> 
>> There are no changes since the last post, just a re-send.
>> 
>> v2:
>> - patch 4: commit message reworded (Heiko)
>> - patch 5: vtime.h is removed from Kbuild scripts (PowerPC only) (Heiko)
>> 
>> v1:
>> Please find a small cleanup to vtime_task_switch() wiring.
>> I split it into smaller patches to allow separate PowerPC
>> vs s390 reviews. Otherwise patches 2+3 and 4+5 could have
>> been merged.
>> 
>> I tested it on s390 and compile-tested it on 32- and 64-bit
>> PowerPC and few other major architectures only, but it is
>> only of concern for CONFIG_VIRT_CPU_ACCOUNTING_NATIVE-capable
>> ones (AFAICT).
>> 
>> Thanks!
>
> It probably makes sense to apply the whole series to the scheduler tree.
> Does any powerpc or s390 maintainer oppose to that?

No objection. It has acks and reviews from powerpc.

cheers

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

* [PATCH v2 RESEND 0/5] sched/vtime: vtime.h headers cleanup
@ 2024-02-22 14:33 ` Alexander Gordeev
  0 siblings, 0 replies; 18+ messages in thread
From: Alexander Gordeev @ 2024-02-22 14:33 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
  Cc: linux-kernel, linux-s390, linuxppc-dev, Nicholas Piggin,
	Michael Ellerman, Heiko Carstens, Vasily Gorbik,
	Frederic Weisbecker

Hi All,

There are no changes since the last post, just a re-send.

v2:

- patch 4: commit message reworded (Heiko)
- patch 5: vtime.h is removed from Kbuild scripts (PowerPC only) (Heiko)

v1:

Please find a small cleanup to vtime_task_switch() wiring.
I split it into smaller patches to allow separate PowerPC
vs s390 reviews. Otherwise patches 2+3 and 4+5 could have
been merged.

I tested it on s390 and compile-tested it on 32- and 64-bit
PowerPC and few other major architectures only, but it is
only of concern for CONFIG_VIRT_CPU_ACCOUNTING_NATIVE-capable
ones (AFAICT).

Thanks!

Alexander Gordeev (5):
  sched/vtime: remove confusing arch_vtime_task_switch() declaration
  sched/vtime: get rid of generic vtime_task_switch() implementation
  s390/vtime: remove unused __ARCH_HAS_VTIME_TASK_SWITCH leftover
  s390/irq,nmi: include <asm/vtime.h> header directly
  sched/vtime: do not include <asm/vtime.h> header

 arch/powerpc/include/asm/Kbuild    |  1 -
 arch/powerpc/include/asm/cputime.h | 13 -------------
 arch/powerpc/kernel/time.c         | 22 ++++++++++++++++++++++
 arch/s390/include/asm/vtime.h      |  2 --
 arch/s390/kernel/irq.c             |  1 +
 arch/s390/kernel/nmi.c             |  1 +
 include/asm-generic/vtime.h        |  1 -
 include/linux/vtime.h              |  5 -----
 kernel/sched/cputime.c             | 13 -------------
 9 files changed, 24 insertions(+), 35 deletions(-)
 delete mode 100644 include/asm-generic/vtime.h

-- 
2.40.1


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

* [PATCH v2 RESEND 0/5] sched/vtime: vtime.h headers cleanup
@ 2024-02-22 14:33 ` Alexander Gordeev
  0 siblings, 0 replies; 18+ messages in thread
From: Alexander Gordeev @ 2024-02-22 14:33 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
  Cc: linux-s390, Vasily Gorbik, Heiko Carstens, linux-kernel,
	Nicholas Piggin, linuxppc-dev, Frederic Weisbecker

Hi All,

There are no changes since the last post, just a re-send.

v2:

- patch 4: commit message reworded (Heiko)
- patch 5: vtime.h is removed from Kbuild scripts (PowerPC only) (Heiko)

v1:

Please find a small cleanup to vtime_task_switch() wiring.
I split it into smaller patches to allow separate PowerPC
vs s390 reviews. Otherwise patches 2+3 and 4+5 could have
been merged.

I tested it on s390 and compile-tested it on 32- and 64-bit
PowerPC and few other major architectures only, but it is
only of concern for CONFIG_VIRT_CPU_ACCOUNTING_NATIVE-capable
ones (AFAICT).

Thanks!

Alexander Gordeev (5):
  sched/vtime: remove confusing arch_vtime_task_switch() declaration
  sched/vtime: get rid of generic vtime_task_switch() implementation
  s390/vtime: remove unused __ARCH_HAS_VTIME_TASK_SWITCH leftover
  s390/irq,nmi: include <asm/vtime.h> header directly
  sched/vtime: do not include <asm/vtime.h> header

 arch/powerpc/include/asm/Kbuild    |  1 -
 arch/powerpc/include/asm/cputime.h | 13 -------------
 arch/powerpc/kernel/time.c         | 22 ++++++++++++++++++++++
 arch/s390/include/asm/vtime.h      |  2 --
 arch/s390/kernel/irq.c             |  1 +
 arch/s390/kernel/nmi.c             |  1 +
 include/asm-generic/vtime.h        |  1 -
 include/linux/vtime.h              |  5 -----
 kernel/sched/cputime.c             | 13 -------------
 9 files changed, 24 insertions(+), 35 deletions(-)
 delete mode 100644 include/asm-generic/vtime.h

-- 
2.40.1


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

end of thread, other threads:[~2024-04-18  1:01 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-10 15:09 [PATCH v2 RESEND 0/5] sched/vtime: vtime.h headers cleanup Alexander Gordeev
2024-04-10 15:09 ` Alexander Gordeev
2024-04-10 15:09 ` [PATCH v2 RESEND 1/5] sched/vtime: remove confusing arch_vtime_task_switch() declaration Alexander Gordeev
2024-04-10 15:09   ` Alexander Gordeev
2024-04-10 15:09 ` [PATCH v2 RESEND 2/5] sched/vtime: get rid of generic vtime_task_switch() implementation Alexander Gordeev
2024-04-10 15:09   ` Alexander Gordeev
2024-04-10 15:09 ` [PATCH v2 RESEND 3/5] s390/vtime: remove unused __ARCH_HAS_VTIME_TASK_SWITCH leftover Alexander Gordeev
2024-04-10 15:09   ` Alexander Gordeev
2024-04-10 15:09 ` [PATCH v2 RESEND 4/5] s390/irq,nmi: include <asm/vtime.h> header directly Alexander Gordeev
2024-04-10 15:09   ` Alexander Gordeev
2024-04-10 15:09 ` [PATCH v2 RESEND 5/5] sched/vtime: do not include <asm/vtime.h> header Alexander Gordeev
2024-04-10 15:09   ` Alexander Gordeev
2024-04-17 10:27 ` [PATCH v2 RESEND 0/5] sched/vtime: vtime.h headers cleanup Frederic Weisbecker
2024-04-17 10:27   ` Frederic Weisbecker
2024-04-18  1:00   ` Michael Ellerman
2024-04-18  1:00     ` Michael Ellerman
  -- strict thread matches above, loose matches on Subject: below --
2024-02-22 14:33 Alexander Gordeev
2024-02-22 14:33 ` Alexander Gordeev

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.