public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krcmar <rkrcmar@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Viresh Kumar <viresh.kumar@linaro.org>
Subject: Re: [patch 0/3] KVM CPU frequency change hypercalls
Date: Fri, 24 Feb 2017 08:50:00 -0300	[thread overview]
Message-ID: <20170224114958.GA28618@amt.cnet> (raw)
In-Reply-To: <5310a7a1-3c3b-7b19-4f2d-6f7919c7b560@redhat.com>

On Fri, Feb 24, 2017 at 10:18:59AM +0100, Paolo Bonzini wrote:
> 
> 
> On 24/02/2017 00:19, Marcelo Tosatti wrote:
> >>> i.e. our feature implies userspace tasks pinned to isolated vCPUs.
> > This is how cpufreq-userspace works:
> > 
> > 2.2 Governor
> > ------------
> > 
> > On all other cpufreq implementations, these boundaries still need to
> > be set. Then, a "governor" must be selected. Such a "governor" decides
> > what speed the processor shall run within the boundaries. One such
> > "governor" is the "userspace" governor. This one allows the user - or
> > a yet-to-implement userspace program - to decide what specific speed
> > the processor shall run at.
> 
> The userspace program sets a policy for the whole system.

No, its per cpu.

> >> That's bad.  This feature is broken by design unless it does proper
> >> save/restore across preemption.
> > 
> > Whats the current usecase, or forseeable future usecase, for save/restore
> > across preemption again? (which would validate the broken by design
> > claim).
> 
> Stop a guest that is using cpufreq, start a guest that is not using it.
> The second guest's performance now depends on the state that the first
> guest left in cpufreq.

Nothing forbids the host to implement switching with the
current hypercall interface: all you need is a scheduler
hook.

> I think this is abusing the userspace governor.  Unfortunately cpufreq
> governors cannot be stacked.
> 
> Paolo

This is a special usecase where only the app in the guest knows 
whats the most appropriate frequency at a given time.
This is what cpufreq-userspace is supposed to allow userspace to do, 
but in this case "userspace" is the guest, so i don't 
see this as an abuse at all.

Timeshared setups are by definition not deterministic: 
your task A could be interrupted by another task B 
with results similar to a lower frequency being set.

So saying that:

"Our frequency scaling interface goes against the idea -- guest kernel
 cannot schedule multiple userspaces on the same vCPU, because they
 could
 conflict by overriding frequency."

Assumes that, in a timeshared system, an application is guaranteed a
particular frequency. But that does not make sense: its a timeshared
system in the first place, there is no determinism regarding execution
time.

Moreover, there is no notion of "per-task CPU frequency" in Linux
(there could be, this whole governor business with user
being responsible for setting up the governor is pretty sucky
IMO).

  reply	other threads:[~2017-02-24 11:50 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-02 17:47 [patch 0/3] KVM CPU frequency change hypercalls Marcelo Tosatti
2017-02-02 17:47 ` [patch 1/3] cpufreq: implement min/max/up/down functions Marcelo Tosatti
2017-02-03  4:09   ` Viresh Kumar
2017-02-02 17:47 ` [patch 2/3] KVM: x86: introduce ioctl to allow frequency hypercalls Marcelo Tosatti
2017-02-03 17:03   ` Radim Krcmar
2017-02-22 21:18     ` Marcelo Tosatti
2017-02-23 16:48       ` Radim Krcmar
2017-02-23 17:31         ` Paolo Bonzini
2017-02-02 17:47 ` [patch 3/3] KVM: x86: frequency change hypercalls Marcelo Tosatti
2017-02-02 18:01   ` Marcelo Tosatti
2017-02-03 17:40   ` Radim Krcmar
2017-02-03 18:24     ` Marcelo Tosatti
2017-02-03 19:28       ` Radim Krcmar
2017-02-03 12:50 ` [patch 0/3] KVM CPU " Rafael J. Wysocki
2017-02-03 16:43 ` Radim Krcmar
2017-02-03 18:14   ` Marcelo Tosatti
2017-02-03 19:09     ` Radim Krcmar
2017-02-23 17:35       ` Paolo Bonzini
2017-02-23 23:19         ` Marcelo Tosatti
2017-02-24  9:18           ` Paolo Bonzini
2017-02-24 11:50             ` Marcelo Tosatti [this message]
2017-02-24 12:17               ` Paolo Bonzini
2017-02-24 13:04                 ` Marcelo Tosatti
2017-02-24 15:34                   ` Paolo Bonzini
2017-02-24 16:54                     ` Rafael J. Wysocki
2017-02-28  2:45                     ` Marcelo Tosatti
2017-03-01 14:21                       ` Paolo Bonzini
2017-03-01 15:11                         ` Marcelo Tosatti

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=20170224114958.GA28618@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rjw@rjwysocki.net \
    --cc=rkrcmar@redhat.com \
    --cc=viresh.kumar@linaro.org \
    /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