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]/ Reviewed-by: Yury Norov <[email protected]> Suggested-by: Peter Zijlstra <[email protected]> Signed-off-by: Mete Durlu <[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(-) diff --git a/arch/Kconfig b/arch/Kconfig index 1163736de1f9..01b8251970f6 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -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 diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig index 7d125e288f6e..3c49baf606d7 100644 --- a/arch/powerpc/platforms/pseries/Kconfig +++ b/arch/powerpc/platforms/pseries/Kconfig @@ -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 diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 7138d923d86f..39379e72ffdf 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -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 diff --git a/drivers/virt/Kconfig b/drivers/virt/Kconfig index eeb84e578ddf..a3721d34a55c 100644 --- a/drivers/virt/Kconfig +++ b/drivers/virt/Kconfig @@ -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 diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt index edc067a0c422..ffd2cb2a4d69 100644 --- a/kernel/Kconfig.preempt +++ b/kernel/Kconfig.preempt @@ -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, -- Mete Durlu <[email protected]>
