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 3/3] KVM: x86: frequency change hypercalls
Date: Fri, 3 Feb 2017 20:28:23 +0100 [thread overview]
Message-ID: <20170203192822.GE15128@potion> (raw)
In-Reply-To: <20170203182423.GB1869@amt.cnet>
2017-02-03 16:24-0200, Marcelo Tosatti:
> On Fri, Feb 03, 2017 at 06:40:34PM +0100, Radim Krcmar wrote:
>> You can make it one hypercall with an argument.
>
> Fine.
>
>> And the argument doesn't have to be enum {UP, DOWN, MAX, MIN}, but an
>> int, which would also allow you to do -2 steps.
>
> Are you suggesting to have an integer to signify the number of steps up
> or down.
Yes.
>> A number over the capabilites of stepping would just map to MAX/MIN.
>
> Then MAX == any positive value above the number of steps
> MIN == any negative value below the negative of number of steps
>
> Sure.
>
>> Avoiding an absolute scale for interface simplifies migration, where the
>> guest cannot really depend much on this. Except that calling it with
>> MIN (INT_MIN) will get the minimum and MAX (INT_MAX) the maximum
>> frequency.
>
> Are you suggesting for the hypercall to return the maximum/minimum
> frequency if called with the highest integer and lowest negative integer
> respectively? (That same hypercall).
No, I meant that we will guarantee that the guest will always get (the
CPU will be in) the minimal frequency when hypercall parameter is
INT_MIN and the maximal with INT_MAX -- just so the guest wouldn't lose
the ability which you provided by MIN and MAX hypercalls.
(We could also make a stronger assertion that there is never going to be
more than INT_MAX steps, CPUs that run KVM will probably never have
that fine frequency control.)
>> Plese explictly say in documentation that things like the number of
>> steps, which the guest can learn by doing MAX and then -1 until the
>> hypercall fails, is undefined and should not be depended upon.
>
> Sure, because it fails over migration.
>
>> Userspace might still want know the number of steps to avoid useless
>> hypercall -- I think we should return a different value when the limit
>> is reached, not just after the guest wants to go past it.
>
> Are you suggesting to return a different value when going from
>
> max-1 -> max
> and
> min+1 -> min
>
> frequencies?
Yes. Like you do now when going "up" from "max".
It saves one call of the hypercall.
> Fine.
>
>> > +#endif
>> > +
>> > default:
>> > ret = -KVM_ENOSYS;
>> > break;
>>
>> And thinking more about migration, userspace cannot learn the current
>> frequency (at least MIN/MAX), so the new host will just pick at random,
>> which will break userspace's expectations that it cannot increase or
>> decrease the frequency. Is migration left for the future, because DPDK
>> doesn't migrate anyway?
>>
>> Thanks.
>
> The new host should start with the highest frequency always. Then
> the frequency tuning algorithm can reduce frequency afterwards.
That is not going to work on migration.
Suppose we do that and the CPU is in minimal frequency before the
migration. This means that queue is below the threshold and userspace
knows that it is in minimum frequency (because we provide that
information when going down), so it doesn't trigger useless hypercalls.
After migration, the host would set frequency to maximum, but userspace
would still thing that it is minimal, so it would decrease it.
The only reason for this series -- power saving -- is lost.
> Migration is a desired feature for DPDK, so it should be supported
> (thats one reason why virtio-net drivers are used in the guest BTW).
Oh, nice,
thanks.
next prev parent reply other threads:[~2017-02-03 19:28 UTC|newest]
Thread overview: 29+ 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 [this message]
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
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
-- strict thread matches above, loose matches on Subject: below --
2017-03-01 15:04 [patch 0/3] KVM CPU frequency change hypercalls (resend) Marcelo Tosatti
2017-03-01 15:04 ` [patch 3/3] KVM: x86: frequency change hypercalls 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=20170203192822.GE15128@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