From: Radim Krcmar <rkrcmar@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Paolo Bonzini <pbonzini@redhat.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Viresh Kumar <viresh.kumar@linaro.org>
Subject: Re: [patch 0/3] KVM CPU frequency change hypercalls
Date: Fri, 3 Feb 2017 17:43:50 +0100 [thread overview]
Message-ID: <20170203164349.GA5582@potion> (raw)
In-Reply-To: <20170202174755.946578704@redhat.com>
2017-02-02 15:47-0200, Marcelo Tosatti:
> Implement KVM hypercalls for the guest
> to issue frequency changes.
>
> Current situation with DPDK and frequency changes is as follows:
> An algorithm in the guest decides when to increase/decrease
> frequency based on the queue length of the device.
Does the algorithm compute with the magnitude of frequency steps?
(e.g. if CPU can step with 200 MHz granularity, does the algorithm ever
do 400 MHz at once, because it assumes that frequency would be enough
to handle the load?)
> On the host, a power manager daemon is used to listen for
> frequency change requests (on another core) and issue these
> requests.
>
> However frequency changes are performance sensitive events because:
> On a change from low load condition to max load condition,
> the frequency should be raised as soon as possible.
> Sending a virtio-serial notification to another pCPU,
> waiting for that pCPU to initiate an IPI to the requestor pCPU
> to change frequency, is slower and more cache costly than
> a direct hypercall to host to switch the frequency.
>
> If the pCPU where the power manager daemon is running
> is not busy spinning on requests from the isolated DPDK vcpus,
> there is also the cost of HLT wakeup for that pCPU.
>
> Moreover, the daemon serves multiple VMs, meaning that
> the scheme is subject to additional delays from
> queueing of power change requests from VMs.
(Wow, this must be bringing humanity to its doom faster than the heat it
helps to eliminate.)
> A direct hypercall from userspace is the fastest most direct
> method for the guest to change frequency and does not suffer
> from the issues above.
Right, userspace on bare-metal cannot change frequency directly.
> The usage scenario for this hypercalls is for pinned vCPUs <-> pCPUs.
And pinned tasks <-> vCPUs, because the guest kernel has no idea what
frequency is being used or desired on its virtualware, so the kernel
cannot even change frequency without introducing a bug ...
I'm not happy about this hole through layers of isolations.
The domain of valid users is very small and a problem is that any
program with access to /dev/kvm gains the ability to change host CPU
frequency if the host happens to use the userspace governor.
We should at least enable this feature only if /dev/kvm is root-only.
next prev parent reply other threads:[~2017-02-03 16:43 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 [this message]
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
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=20170203164349.GA5582@potion \
--to=rkrcmar@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rjw@rjwysocki.net \
--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;
as well as URLs for NNTP newsgroup(s).