mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Shrikanth Hegde <sshegde@linux.ibm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Mete Durlu <meted@linux.ibm.com>, Yury Norov <ynorov@nvidia.com>
Cc: Ingo Molnar <mingo@redhat.com>, Thomas Gleixner <tglx@kernel.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Yury Norov <yury.norov@gmail.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Andrea Righi <arighi@nvidia.com>, Ben Segall <bsegall@google.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Danilo Krummrich <dakr@kernel.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Heiko Carstens <hca@linux.ibm.com>,
	Johan Hovold <johan@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	Mel Gorman <mgorman@suse.de>,
	Randy Dunlap <rdunlap@infradead.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Sven Schnelle <svens@linux.ibm.com>,
	Valentin Schneider <vschneid@redhat.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	driver-core@lists.linux.dev, linux-s390@vger.kernel.org
Subject: Re: [PATCH 1/6] sched: decouple PREFERRED_CPU from PARAVIRT in Kconfig.preempt
Date: Tue, 3 Nov 2026 12:26:58 +0100	[thread overview]
Message-ID: <aecd7142-ee54-4cf9-80aa-3546cc2661e3@linux.ibm.com> (raw)
In-Reply-To: <439758ce-c807-4b5b-b2e5-31fb9f1c6f11@linux.ibm.com>



On 11/3/26 06:49, Shrikanth Hegde wrote:
> Hi Ilya,
> 
> On 11/2/26 7:11 PM, Ilya Leoshkevich wrote:
>>
>>
>> On 11/2/26 14:00, Shrikanth Hegde wrote:
>>> Hi.
>>>
>>>
>>> On 11/2/26 5:04 PM, Ilya Leoshkevich wrote:
>>>>
>>>>
>>>> On 11/2/26 12:00, Peter Zijlstra wrote:
>>>>> On Mon, Nov 02, 2026 at 11:16:30AM +0100, Ilya Leoshkevich wrote:
>>>>>>
>>>>>>
>>>>>> On 11/1/26 20:21, Yury Norov wrote:
>>>>>>> The IBM s390 doesn't enable PARAVIRT config for their hardware
>>>>>>> virtualized Logical Partitions (LPAR). However, the steal time is
>>>>>>> accounted for the LPARs, once the config VIRT_CPU_ACCOUNTING_NATIVE
>>>>>>> is enabled.
>>>>>>>
>>>>>>> Preferred cpumask doesn't rely on any feature gated by PARAVIRT 
>>>>>>> config,
>>>>>>> and requires it to minimize the configuration space and runtime 
>>>>>>> overhead,
>>>>>>> with the lack of non-paravirt user. Now that s390 wants to adopt 
>>>>>>> preferred
>>>>>>> cpumask, there's no reason to keep it coupled to paravirt.
>>>>>>>
>>>>>>> Make PREFERRED_CPU a user-configurable option, even if 
>>>>>>> paravirtualization
>>>>>>> is not enabled, and drop PARAVIRT dependency on the steal governor.
>>>>>>>
>>>>>>> Keep the default module selection conditional on PARAVIRT so 
>>>>>>> other SMP
>>>>>>> configurations can opt in without enabling the governor by default.
>>>>>>>
>>>>>>> Link: https://lore.kernel.org/all/4605dad5-aab2-49e3-b919- 
>>>>>>> bf9897181834@linux.ibm.com/
>>>>>>> CC: Mete Durlu <meted@linux.ibm.com>
>>>>>>> Signed-off-by: Yury Norov <ynorov@nvidia.com>
>>>>>>> ---
>>>>>>> Can be applied independently from the rest of the series.
>>>>>>>
>>>>>>>    drivers/virt/Kconfig   |  8 ++++++--
>>>>>>>    kernel/Kconfig.preempt | 12 ++++++++++--
>>>>>>>    2 files changed, 16 insertions(+), 4 deletions(-)
>>>>>>
>>>>>> This is really useful to us, since even though s390 is nominally
>>>>>> paravirtualized, it does not technically benefit from defining
>>>>>> CONFIG_PARAVIRT.
>>>>>
>>>>> And therefore removing PARAVIRT is the only possible solution?
>>>>>
>>>>>> Specifically, steal time accounting happens by
>>>>>> computing a difference between wall time and CPU time, and not by
>>>>>> explicitly querying the hypervisor.
>>>>>
>>>>> Nobody explicitly asks the hypervisor, that would be horrendously 
>>>>> slow.
>>>>>
>>>>> Something trivial like this should do.
>>>>>
>>>>> ---
>>>>>   arch/Kconfig                           | 9 +++++++++
>>>>>   arch/powerpc/platforms/pseries/Kconfig | 1 +
>>>>>   arch/s390/Kconfig                      | 1 +
>>>>>   drivers/virt/Kconfig                   | 2 +-
>>>>>   4 files changed, 12 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/arch/Kconfig b/arch/Kconfig
>>>>> index 1163736de1f9..8980054beb52 100644
>>>>> --- a/arch/Kconfig
>>>>> +++ b/arch/Kconfig
>>>>> @@ -1080,6 +1080,15 @@ config HAVE_IRQ_TIME_ACCOUNTING
>>>>>   config HAVE_PV_STEAL_CLOCK_GEN
>>>>>       bool
>>>>> +#
>>>>> +#  Archs that can account CPUTIME_STEAL; normal route is through 
>>>>> PARAVIRT which
>>>>> +#  selects HAVE_PV_STEAL_CLOCK_GEN. Directly selected by s390 and 
>>>>> PPC-LPAR
>>>>> +#  which have their own thing and don't go through generic cputime 
>>>>> accounting.
>>>>> +#
>>>>> +config HAVE_CPUTIME_STEAL
>>>>> +    bool
>>>>> +    default y if HAVE_PV_STEAL_CLOCK_GEN
>>>>> +
>>>
>>> Can't PARAVIRT_TIME_ACCOUNTING be the kconfig we can rely upon.
>>> s390 can add it to the config (similar to HAVE_CPUTIME_STEAL)?
>>>
>>> I guess it is selected currently where the steal time reporting happens.
>>
>> Looking at update_rq_clock_task(), s390 would still need to provide a
>> pointless dummy paravirt_steal_clock() implementation in this case.
>>
>> [...]
> 
> Other possible option is, you could use CONFIG_HAVE_PV_STEAL_CLOCK_GEN 
> which
> defines the dummy implementation and you don't update that method. That way
> you may implement PARAVIRT_TIME_ACCOUNTING mostly with kconfig changes.
> 
> But it needs the arch to implement static calls. I am not sure if s390 
> has it.

We will get non-optimized static calls soon [1], so this would be not so
great from performance PoV.

I think HAVE_CPUTIME_STEAL is a good solution. It allows to disable
PREFERRED_CPU and STEAL_GOVERNOR on systems which do not do steal time
accounting, while, unlike PARAVIRT, PARAVIRT_TIME_ACCOUNTING, and
HAVE_PV_STEAL_CLOCK_GEN, not prescribing how the other architectures
should implement steal time accounting.

[1] 
https://lore.kernel.org/linux-s390/20261026102952.4153711-1-hca@linux.ibm.com/

  reply	other threads:[~2026-11-03 11:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-01 19:21 [PATCH 0/6] sched: Expose writable interface for preferred CPUs mask Yury Norov
2026-11-01 19:21 ` [PATCH 1/6] sched: decouple PREFERRED_CPU from PARAVIRT in Kconfig.preempt Yury Norov
2026-11-02 10:16   ` Ilya Leoshkevich
2026-11-02 11:00     ` Peter Zijlstra
2026-11-02 11:34       ` Ilya Leoshkevich
2026-11-02 13:00         ` Shrikanth Hegde
2026-11-02 13:41           ` Ilya Leoshkevich
2026-11-02 14:57             ` Shrikanth Hegde
2026-11-03  5:49             ` Shrikanth Hegde
2026-11-03 11:26               ` Ilya Leoshkevich [this message]
2026-11-03 11:30                 ` Ilya Leoshkevich
2026-11-01 19:21 ` [PATCH 2/6] cpumask: Add reset_preferred_cpumask() helper Yury Norov
2026-11-01 19:21 ` [PATCH 3/6] sched: Restore preferred CPUs when hotplug removes the last one Yury Norov
2026-11-01 19:22 ` [PATCH 4/6] sched: serialize preferred cpumask update better Yury Norov
2026-11-01 19:22 ` [PATCH 5/6] virt: steal_governor: Warn on unexpected preferred mask states Yury Norov
2026-11-01 19:22 ` [PATCH 6/6] cpu: Add per-CPU preferred sysfs control Yury Norov
2026-11-02  8:47 ` [PATCH 0/6] sched: Expose writable interface for preferred CPUs mask Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aecd7142-ee54-4cf9-80aa-3546cc2661e3@linux.ibm.com \
    --to=iii@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=arighi@nvidia.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=bsegall@google.com \
    --cc=corbet@lwn.net \
    --cc=dakr@kernel.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=driver-core@lists.linux.dev \
    --cc=gor@linux.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hca@linux.ibm.com \
    --cc=johan@kernel.org \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=meted@linux.ibm.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=skhan@linuxfoundation.org \
    --cc=sshegde@linux.ibm.com \
    --cc=svens@linux.ibm.com \
    --cc=tglx@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=ynorov@nvidia.com \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®