From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [patch 0/3] KVM CPU frequency change hypercalls Date: Mon, 27 Feb 2017 23:45:35 -0300 Message-ID: <20170228024532.GA8833@amt.cnet> References: <20170203164349.GA5582@potion> <20170203181405.GA1869@amt.cnet> <20170203190930.GD15128@potion> <5db0e1a1-2eaf-fe77-3e15-7b2ef842d255@redhat.com> <20170223231923.GB23631@amt.cnet> <5310a7a1-3c3b-7b19-4f2d-6f7919c7b560@redhat.com> <20170224114958.GA28618@amt.cnet> <70575c62-b9c5-7100-193a-5f4b8bed258c@redhat.com> <20170224130458.GA31610@amt.cnet> <2c739f77-22c6-c14c-c279-f2dd2445b2df@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Radim Krcmar , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , Viresh Kumar To: Paolo Bonzini Return-path: Received: from mx1.redhat.com ([209.132.183.28]:43362 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751810AbdB1S44 (ORCPT ); Tue, 28 Feb 2017 13:56:56 -0500 Content-Disposition: inline In-Reply-To: <2c739f77-22c6-c14c-c279-f2dd2445b2df@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, Feb 24, 2017 at 04:34:52PM +0100, Paolo Bonzini wrote: > > > On 24/02/2017 14:04, Marcelo Tosatti wrote: > >>>>> 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. > >> Can it be done in vcpu_load/vcpu_put? But you still would have two > >> components (KVM and sysfs) potentially fighting over the frequency, and > >> that's still a bit ugly. > > > > Change the frequency at vcpu_load/vcpu_put? Yes: call into > > cpufreq-userspace. But there is no notion of "per-task frequency" on the > > Linux kernel (which was the starting point of this subthread). > > There isn't, but this patchset is providing a direct path from a task to > cpufreq-userspace. This is as close as you can get to a per-task frequency. Cpufreq-userspace is supposed to be used by tasks in userspace. Thats why its called "userspace". > > But if you configure all CPUs in the system as cpufreq-userspace, > > then some other (userspace program) has to decide the frequency > > for the other CPUs. > > > > Which agent would do that and why? Thats why i initially said "whats the > > usecase". > > You could just pin them at the highest non-TurboBoost frequency until a > guest runs. That's assuming that they are idle and, because of > isol_cpus/nohz_full, they would be almost always in deep C state anyway. > > Paolo The original claim of the thread was: "this feature (frequency hypercalls) works for pinned vcpu<->pcpu, pcpu dedicated exclusively to vcpu case, lets try to extend this to other cases". Which is a valid and useful direction to go. However there is no user for multiple vcpus in the same pcpu now. If there were multiple vcpus, all of them requesting a given frequency, it would be necessary to: 1) Maintain frequency of the pcpu to the highest frequencies. OR 2) Since switching frequencies can take up to 70us (*) (depends on processor), its generally not worthwhile to switch frequencies between task switches. So its a dead end... *: http://www.ena-hpc.org/2013/pdf/04.pdf