From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751352AbdBXNHZ (ORCPT ); Fri, 24 Feb 2017 08:07:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58412 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751208AbdBXNHR (ORCPT ); Fri, 24 Feb 2017 08:07:17 -0500 Date: Fri, 24 Feb 2017 10:04:59 -0300 From: Marcelo Tosatti To: Paolo Bonzini Cc: Radim Krcmar , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , Viresh Kumar Subject: Re: [patch 0/3] KVM CPU frequency change hypercalls Message-ID: <20170224130458.GA31610@amt.cnet> References: <20170202174755.946578704@redhat.com> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <70575c62-b9c5-7100-193a-5f4b8bed258c@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 24 Feb 2017 13:05:19 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 24, 2017 at 01:17:07PM +0100, Paolo Bonzini wrote: > > > On 24/02/2017 12:50, Marcelo Tosatti wrote: > >>> > >>> 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. > > Yeah, what I mean is that userspace program can be per-CPU, but it looks > at all the processes running on that CPU ("the whole system"). This is > very different from a guest, which is isolated. > > >>>> 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. > > 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. > > Paolo 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). 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".