Skip to contentSkip to conversation

sched: Decouple PREFERRED_CPU from PARAVIRT

PATCH Applied Mete Durlu 4 participants 6 messages Nov 6 – Nov 9

Subsystems (2)
lore
Share & tools
lore

Mete Durlu

author
#0 lore raw

PATCH 1/1 sched: Decouple PREFERRED_CPU from PARAVIRT

PREFERRED_CPU mechanism does not rely on any feature introduced by PARAVIRT but PREFERRED_CPU still gated behind PARAVIRT. Any architecture that would like to enable PREFERRED_CPU mechanism has to also enable PARAVIRT and bring additional changes to accommodate PARAVIRT's requirements.

As an example, s390 doesn't enable PARAVIRT config for hardware virtualized Logical Partitions (LPAR). The steal time is accounted for the LPARs via architecture's own steal time accounting mechanism instead of the common steal time infrastructure PARAVIRT supplies.
For s390 to enable PREFERRED_CPU, PRAVIRT and its required stubs are just unncessary.

Based on the discussion between Yury Norov and Peter Zijlstra over Yury's original patch [1]:

Introduce a new config flag HAVE_CPUTIME_STEAL to indicate that the architecture has steal time measurement capabilities already implemented and to signal that PARAVIRT is not required.
Remove PARAVIRT gating from CPU_PREFERRED and add HAVE_CPUTIME_STEAL instead.
Select HAVE_CPUTIME_STEAL for s390 and powerpc-pseries configs.

[1] https://lore.kernel.org/all/[email protected]/

---
 arch/Kconfig                           | 8 ++++++++
 arch/powerpc/platforms/pseries/Kconfig | 1 +
 arch/s390/Kconfig                      | 1 +
 drivers/virt/Kconfig                   | 2 +-
 kernel/Kconfig.preempt                 | 2 +-
 5 files changed, 12 insertions(+), 2 deletions(-)
arch/Kconfig +8 -0
index 1163736de1f9..01b8251970f6 100644
@@ -1080,6 +1080,14 @@ config HAVE_IRQ_TIME_ACCOUNTING
 config HAVE_PV_STEAL_CLOCK_GEN
 	bool
 
+config HAVE_CPUTIME_STEAL
+	bool
+	default y if HAVE_PV_STEAL_CLOCK_GEN
+	help
+	  Selected directly by config PARAVIRT through HAVE_PV_STEAL_CLOCK_GEN
+	  or directly by architectures that have their own CPUTIME_STEAL
+	  accounting.
+
 config HAVE_MOVE_PUD
 	bool
 	help
arch/powerpc/platforms/pseries/Kconfig +1 -0
index 7d125e288f6e..3c49baf606d7 100644
@@ -41,6 +41,7 @@ config PPC_SPLPAR
 	depends on PPC_PSERIES
 	select PARAVIRT_SPINLOCKS if PPC_QUEUED_SPINLOCKS
 	select PARAVIRT_TIME_ACCOUNTING if VIRT_CPU_ACCOUNTING_GEN
+	select HAVE_CPUTIME_STEAL
 	default y
 	help
 	  Enabling this option will make the kernel run more efficiently
arch/s390/Kconfig +1 -0
index 7138d923d86f..39379e72ffdf 100644
@@ -204,6 +204,7 @@ config S390
 	select HAVE_BUILDTIME_MCOUNT_SORT
 	select HAVE_CMPXCHG_DOUBLE
 	select HAVE_CMPXCHG_LOCAL
+	select HAVE_CPUTIME_STEAL
 	select HAVE_DEBUG_KMEMLEAK
 	select HAVE_DMA_CONTIGUOUS
 	select HAVE_DYNAMIC_FTRACE
drivers/virt/Kconfig +1 -1
index eeb84e578ddf..a3721d34a55c 100644
@@ -43,7 +43,7 @@ config FSL_HV_MANAGER
 
 config STEAL_GOVERNOR
 	tristate "Dynamic vCPU management based on steal time"
-	depends on PARAVIRT && SMP
+	depends on SMP && HAVE_CPUTIME_STEAL
 	select PREFERRED_CPU
 	default m
 	help
kernel/Kconfig.preempt +1 -1
index edc067a0c422..ffd2cb2a4d69 100644
@@ -197,4 +197,4 @@ config SCHED_CLASS_EXT
 
 config PREFERRED_CPU
 	bool
-	depends on SMP && PARAVIRT
+	depends on SMP && HAVE_CPUTIME_STEAL

---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261104-preferredcpu-b3c00594bd74

Best regards,

Signature · 1 line
Mete Durlu <[email protected]>
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 22 lines

PREFERRED_CPU mechanism does not rely on any feature introduced by PARAVIRT but PREFERRED_CPU still gated behind PARAVIRT. Any architecture that would like to enable PREFERRED_CPU mechanism has to also enable PARAVIRT and bring additional changes to accommodate PARAVIRT's requirements.

As an example, s390 doesn't enable PARAVIRT config for hardware virtualized Logical Partitions (LPAR). The steal time is accounted for the LPARs via architecture's own steal time accounting mechanism instead of the common steal time infrastructure PARAVIRT supplies.
For s390 to enable PREFERRED_CPU, PRAVIRT and its required stubs are just unncessary.

Based on the discussion between Yury Norov and Peter Zijlstra over Yury's original patch [1]:

Introduce a new config flag HAVE_CPUTIME_STEAL to indicate that the architecture has steal time measurement capabilities already implemented and to signal that PARAVIRT is not required.
Remove PARAVIRT gating from CPU_PREFERRED and add HAVE_CPUTIME_STEAL instead.
Select HAVE_CPUTIME_STEAL for s390 and powerpc-pseries configs.

Quoted 5 lines

[1] https://lore.kernel.org/all/[email protected]/

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Mete Durlu
Quoted 22 lines · Mete Durlu

PREFERRED_CPU mechanism does not rely on any feature introduced by PARAVIRT but PREFERRED_CPU still gated behind PARAVIRT. Any architecture that would like to enable PREFERRED_CPU mechanism has to also enable PARAVIRT and bring additional changes to accommodate PARAVIRT's requirements.

As an example, s390 doesn't enable PARAVIRT config for hardware virtualized Logical Partitions (LPAR). The steal time is accounted for the LPARs via architecture's own steal time accounting mechanism instead of the common steal time infrastructure PARAVIRT supplies.
For s390 to enable PREFERRED_CPU, PRAVIRT and its required stubs are just unncessary.

Based on the discussion between Yury Norov and Peter Zijlstra over Yury's original patch [1]:

Introduce a new config flag HAVE_CPUTIME_STEAL to indicate that the architecture has steal time measurement capabilities already implemented and to signal that PARAVIRT is not required.
Remove PARAVIRT gating from CPU_PREFERRED and add HAVE_CPUTIME_STEAL instead.
Select HAVE_CPUTIME_STEAL for s390 and powerpc-pseries configs.

Quoted 5 lines

[1] https://lore.kernel.org/all/[email protected]/

Quoted 80 lines
---
  arch/Kconfig                           | 8 ++++++++
  arch/powerpc/platforms/pseries/Kconfig | 1 +
  arch/s390/Kconfig                      | 1 +
  drivers/virt/Kconfig                   | 2 +-
  kernel/Kconfig.preempt                 | 2 +-
  5 files changed, 12 insertions(+), 2 deletions(-)
arch/Kconfig +8 -0
index 1163736de1f9..01b8251970f6 100644
@@ -1080,6 +1080,14 @@ config HAVE_IRQ_TIME_ACCOUNTING
  config HAVE_PV_STEAL_CLOCK_GEN
  	bool
 
+config HAVE_CPUTIME_STEAL
+	bool
+	default y if HAVE_PV_STEAL_CLOCK_GEN
+	help
+	  Selected directly by config PARAVIRT through HAVE_PV_STEAL_CLOCK_GEN
+	  or directly by architectures that have their own CPUTIME_STEAL
+	  accounting.
+
  config HAVE_MOVE_PUD
  	bool
  	help
arch/powerpc/platforms/pseries/Kconfig +1 -0
index 7d125e288f6e..3c49baf606d7 100644
@@ -41,6 +41,7 @@ config PPC_SPLPAR
  	depends on PPC_PSERIES
  	select PARAVIRT_SPINLOCKS if PPC_QUEUED_SPINLOCKS
  	select PARAVIRT_TIME_ACCOUNTING if VIRT_CPU_ACCOUNTING_GEN
+	select HAVE_CPUTIME_STEAL
  	default y
  	help
  	  Enabling this option will make the kernel run more efficiently
arch/s390/Kconfig +1 -0
index 7138d923d86f..39379e72ffdf 100644
@@ -204,6 +204,7 @@ config S390
  	select HAVE_BUILDTIME_MCOUNT_SORT
  	select HAVE_CMPXCHG_DOUBLE
  	select HAVE_CMPXCHG_LOCAL
+	select HAVE_CPUTIME_STEAL
  	select HAVE_DEBUG_KMEMLEAK
  	select HAVE_DMA_CONTIGUOUS
  	select HAVE_DYNAMIC_FTRACE
drivers/virt/Kconfig +1 -1
index eeb84e578ddf..a3721d34a55c 100644
@@ -43,7 +43,7 @@ config FSL_HV_MANAGER
 
  config STEAL_GOVERNOR
  	tristate "Dynamic vCPU management based on steal time"
-	depends on PARAVIRT && SMP
+	depends on SMP && HAVE_CPUTIME_STEAL
  	select PREFERRED_CPU
  	default m
  	help
kernel/Kconfig.preempt +1 -2
index edc067a0c422..ffd2cb2a4d69 100644
@@ -197,4 +197,4 @@ config SCHED_CLASS_EXT
 
  config PREFERRED_CPU
  	bool
-	depends on SMP && PARAVIRT
+	depends on SMP && HAVE_CPUTIME_STEAL
 
---

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261104-preferredcpu-b3c00594bd74

Best regards,

merge bot Applied
#3 lore raw
In reply to Mete Durlu
The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     ae7ff8b29958143b4f23169a5598c860334db2fa
Gitweb:        https://git.kernel.org/tip/ae7ff8b29958143b4f23169a5598c860334db2fa
Author:        Mete Durlu <[email protected]>
AuthorDate:    Fri, 06 Nov 2026 13:35:12 +01:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Mon, 09 Nov 2026 09:39:59 +01:00

sched: Decouple PREFERRED_CPU from PARAVIRT

PREFERRED_CPU mechanism does not rely on any feature introduced by PARAVIRT but PREFERRED_CPU still gated behind PARAVIRT. Any architecture that would like to enable PREFERRED_CPU mechanism has to also enable PARAVIRT and bring additional changes to accommodate PARAVIRT's requirements.

As an example, s390 doesn't enable PARAVIRT config for hardware virtualized Logical Partitions (LPAR). The steal time is accounted for the LPARs via architecture's own steal time accounting mechanism instead of the common steal time infrastructure PARAVIRT supplies.
For s390 to enable PREFERRED_CPU, PRAVIRT and its required stubs are just unncessary.

Based on the discussion between Yury Norov and Peter Zijlstra over Yury's original patch [1]:

Introduce a new config flag HAVE_CPUTIME_STEAL to indicate that the architecture has steal time measurement capabilities already implemented and to signal that PARAVIRT is not required.
Remove PARAVIRT gating from CPU_PREFERRED and add HAVE_CPUTIME_STEAL instead.
Select HAVE_CPUTIME_STEAL for s390 and powerpc-pseries configs.

[1] https://lore.kernel.org/all/[email protected]/

---
 arch/Kconfig                           | 8 ++++++++
 arch/powerpc/platforms/pseries/Kconfig | 1 +
 arch/s390/Kconfig                      | 1 +
 drivers/virt/Kconfig                   | 2 +-
 kernel/Kconfig.preempt                 | 2 +-
 5 files changed, 12 insertions(+), 2 deletions(-)
arch/Kconfig +8 -0
index 1163736..01b8251 100644
@@ -1080,6 +1080,14 @@ config HAVE_IRQ_TIME_ACCOUNTING
 config HAVE_PV_STEAL_CLOCK_GEN
 	bool
 
+config HAVE_CPUTIME_STEAL
+	bool
+	default y if HAVE_PV_STEAL_CLOCK_GEN
+	help
+	  Selected directly by config PARAVIRT through HAVE_PV_STEAL_CLOCK_GEN
+	  or directly by architectures that have their own CPUTIME_STEAL
+	  accounting.
+
 config HAVE_MOVE_PUD
 	bool
 	help
arch/powerpc/platforms/pseries/Kconfig +1 -0
index 7d125e2..3c49baf 100644
@@ -41,6 +41,7 @@ config PPC_SPLPAR
 	depends on PPC_PSERIES
 	select PARAVIRT_SPINLOCKS if PPC_QUEUED_SPINLOCKS
 	select PARAVIRT_TIME_ACCOUNTING if VIRT_CPU_ACCOUNTING_GEN
+	select HAVE_CPUTIME_STEAL
 	default y
 	help
 	  Enabling this option will make the kernel run more efficiently
arch/s390/Kconfig +1 -0
index 7138d92..39379e7 100644
@@ -204,6 +204,7 @@ config S390
 	select HAVE_BUILDTIME_MCOUNT_SORT
 	select HAVE_CMPXCHG_DOUBLE
 	select HAVE_CMPXCHG_LOCAL
+	select HAVE_CPUTIME_STEAL
 	select HAVE_DEBUG_KMEMLEAK
 	select HAVE_DMA_CONTIGUOUS
 	select HAVE_DYNAMIC_FTRACE
drivers/virt/Kconfig +1 -1
index eeb84e5..a3721d3 100644
@@ -43,7 +43,7 @@ config FSL_HV_MANAGER
 
 config STEAL_GOVERNOR
 	tristate "Dynamic vCPU management based on steal time"
-	depends on PARAVIRT && SMP
+	depends on SMP && HAVE_CPUTIME_STEAL
 	select PREFERRED_CPU
 	default m
 	help
kernel/Kconfig.preempt +1 -1
index edc067a..ffd2cb2 100644
@@ -197,4 +197,4 @@ config SCHED_CLASS_EXT
 
 config PREFERRED_CPU
 	bool
-	depends on SMP && PARAVIRT
+	depends on SMP && HAVE_CPUTIME_STEAL
merge bot Applied
#4 lore raw

[tip: sched/core] sched/config: Decouple PREFERRED_CPU from PARAVIRT

In reply to Mete Durlu
The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     56d3bd3bbc663dc3f8fa09577c76eb0205d65177
Gitweb:        https://git.kernel.org/tip/56d3bd3bbc663dc3f8fa09577c76eb0205d65177
Author:        Mete Durlu <[email protected]>
AuthorDate:    Fri, 06 Nov 2026 13:35:12 +01:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Mon, 09 Nov 2026 10:24:06 +01:00

sched/config: Decouple PREFERRED_CPU from PARAVIRT

PREFERRED_CPU mechanism does not rely on any feature introduced by PARAVIRT but PREFERRED_CPU still gated behind PARAVIRT. Any architecture that would like to enable PREFERRED_CPU mechanism has to also enable PARAVIRT and bring additional changes to accommodate PARAVIRT's requirements.

As an example, s390 doesn't enable PARAVIRT config for hardware virtualized Logical Partitions (LPAR). The steal time is accounted for the LPARs via architecture's own steal time accounting mechanism instead of the common steal time infrastructure PARAVIRT supplies.
For s390 to enable PREFERRED_CPU, PRAVIRT and its required stubs are just unncessary.

Based on the discussion between Yury Norov and Peter Zijlstra over Yury's original patch [1]:

Introduce a new config flag HAVE_CPUTIME_STEAL to indicate that the architecture has steal time measurement capabilities already implemented and to signal that PARAVIRT is not required.
Remove PARAVIRT gating from CPU_PREFERRED and add HAVE_CPUTIME_STEAL instead.
Select HAVE_CPUTIME_STEAL for s390 and powerpc-pseries configs.

[1] https://lore.kernel.org/all/[email protected]/

---
 arch/Kconfig                           | 8 ++++++++
 arch/powerpc/platforms/pseries/Kconfig | 1 +
 arch/s390/Kconfig                      | 1 +
 drivers/virt/Kconfig                   | 2 +-
 kernel/Kconfig.preempt                 | 2 +-
 5 files changed, 12 insertions(+), 2 deletions(-)
arch/Kconfig +8 -0
index 1163736..01b8251 100644
@@ -1080,6 +1080,14 @@ config HAVE_IRQ_TIME_ACCOUNTING
 config HAVE_PV_STEAL_CLOCK_GEN
 	bool
 
+config HAVE_CPUTIME_STEAL
+	bool
+	default y if HAVE_PV_STEAL_CLOCK_GEN
+	help
+	  Selected directly by config PARAVIRT through HAVE_PV_STEAL_CLOCK_GEN
+	  or directly by architectures that have their own CPUTIME_STEAL
+	  accounting.
+
 config HAVE_MOVE_PUD
 	bool
 	help
arch/powerpc/platforms/pseries/Kconfig +1 -0
index 7d125e2..3c49baf 100644
@@ -41,6 +41,7 @@ config PPC_SPLPAR
 	depends on PPC_PSERIES
 	select PARAVIRT_SPINLOCKS if PPC_QUEUED_SPINLOCKS
 	select PARAVIRT_TIME_ACCOUNTING if VIRT_CPU_ACCOUNTING_GEN
+	select HAVE_CPUTIME_STEAL
 	default y
 	help
 	  Enabling this option will make the kernel run more efficiently
arch/s390/Kconfig +1 -0
index 7138d92..39379e7 100644
@@ -204,6 +204,7 @@ config S390
 	select HAVE_BUILDTIME_MCOUNT_SORT
 	select HAVE_CMPXCHG_DOUBLE
 	select HAVE_CMPXCHG_LOCAL
+	select HAVE_CPUTIME_STEAL
 	select HAVE_DEBUG_KMEMLEAK
 	select HAVE_DMA_CONTIGUOUS
 	select HAVE_DYNAMIC_FTRACE
drivers/virt/Kconfig +1 -1
index eeb84e5..a3721d3 100644
@@ -43,7 +43,7 @@ config FSL_HV_MANAGER
 
 config STEAL_GOVERNOR
 	tristate "Dynamic vCPU management based on steal time"
-	depends on PARAVIRT && SMP
+	depends on SMP && HAVE_CPUTIME_STEAL
 	select PREFERRED_CPU
 	default m
 	help
kernel/Kconfig.preempt +1 -1
index edc067a..ffd2cb2 100644
@@ -197,4 +197,4 @@ config SCHED_CLASS_EXT
 
 config PREFERRED_CPU
 	bool
-	depends on SMP && PARAVIRT
+	depends on SMP && HAVE_CPUTIME_STEAL
merge bot Applied
#5 lore raw

[tip: sched/core] sched/config: Decouple PREFERRED_CPU from PARAVIRT

In reply to Mete Durlu
The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     08503034111a68383774e3f0a47eabb59e21aac7
Gitweb:        https://git.kernel.org/tip/08503034111a68383774e3f0a47eabb59e21aac7
Author:        Mete Durlu <[email protected]>
AuthorDate:    Fri, 06 Nov 2026 13:35:12 +01:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Mon, 09 Nov 2026 10:58:14 +01:00

sched/config: Decouple PREFERRED_CPU from PARAVIRT

PREFERRED_CPU mechanism does not rely on any feature introduced by PARAVIRT but PREFERRED_CPU still gated behind PARAVIRT. Any architecture that would like to enable PREFERRED_CPU mechanism has to also enable PARAVIRT and bring additional changes to accommodate PARAVIRT's requirements.

As an example, s390 doesn't enable PARAVIRT config for hardware virtualized Logical Partitions (LPAR). The steal time is accounted for the LPARs via architecture's own steal time accounting mechanism instead of the common steal time infrastructure PARAVIRT supplies.
For s390 to enable PREFERRED_CPU, PRAVIRT and its required stubs are just unncessary.

Based on the discussion between Yury Norov and Peter Zijlstra over Yury's original patch [1]:

Introduce a new config flag HAVE_CPUTIME_STEAL to indicate that the architecture has steal time measurement capabilities already implemented and to signal that PARAVIRT is not required.
Remove PARAVIRT gating from CPU_PREFERRED and add HAVE_CPUTIME_STEAL instead.
Select HAVE_CPUTIME_STEAL for s390 and powerpc-pseries configs.

[1] https://lore.kernel.org/all/[email protected]/

---
 arch/Kconfig                           | 8 ++++++++
 arch/powerpc/platforms/pseries/Kconfig | 1 +
 arch/s390/Kconfig                      | 1 +
 drivers/virt/Kconfig                   | 2 +-
 kernel/Kconfig.preempt                 | 2 +-
 5 files changed, 12 insertions(+), 2 deletions(-)
arch/Kconfig +8 -0
index 1163736..01b8251 100644
@@ -1080,6 +1080,14 @@ config HAVE_IRQ_TIME_ACCOUNTING
 config HAVE_PV_STEAL_CLOCK_GEN
 	bool
 
+config HAVE_CPUTIME_STEAL
+	bool
+	default y if HAVE_PV_STEAL_CLOCK_GEN
+	help
+	  Selected directly by config PARAVIRT through HAVE_PV_STEAL_CLOCK_GEN
+	  or directly by architectures that have their own CPUTIME_STEAL
+	  accounting.
+
 config HAVE_MOVE_PUD
 	bool
 	help
arch/powerpc/platforms/pseries/Kconfig +1 -0
index 7d125e2..3c49baf 100644
@@ -41,6 +41,7 @@ config PPC_SPLPAR
 	depends on PPC_PSERIES
 	select PARAVIRT_SPINLOCKS if PPC_QUEUED_SPINLOCKS
 	select PARAVIRT_TIME_ACCOUNTING if VIRT_CPU_ACCOUNTING_GEN
+	select HAVE_CPUTIME_STEAL
 	default y
 	help
 	  Enabling this option will make the kernel run more efficiently
arch/s390/Kconfig +1 -0
index 7138d92..39379e7 100644
@@ -204,6 +204,7 @@ config S390
 	select HAVE_BUILDTIME_MCOUNT_SORT
 	select HAVE_CMPXCHG_DOUBLE
 	select HAVE_CMPXCHG_LOCAL
+	select HAVE_CPUTIME_STEAL
 	select HAVE_DEBUG_KMEMLEAK
 	select HAVE_DMA_CONTIGUOUS
 	select HAVE_DYNAMIC_FTRACE
drivers/virt/Kconfig +1 -1
index eeb84e5..a3721d3 100644
@@ -43,7 +43,7 @@ config FSL_HV_MANAGER
 
 config STEAL_GOVERNOR
 	tristate "Dynamic vCPU management based on steal time"
-	depends on PARAVIRT && SMP
+	depends on SMP && HAVE_CPUTIME_STEAL
 	select PREFERRED_CPU
 	default m
 	help
kernel/Kconfig.preempt +1 -1
index edc067a..ffd2cb2 100644
@@ -197,4 +197,4 @@ config SCHED_CLASS_EXT
 
 config PREFERRED_CPU
 	bool
-	depends on SMP && PARAVIRT
+	depends on SMP && HAVE_CPUTIME_STEAL