From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751627AbdBWQz3 (ORCPT ); Thu, 23 Feb 2017 11:55:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46876 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751156AbdBWQz2 (ORCPT ); Thu, 23 Feb 2017 11:55:28 -0500 Date: Thu, 23 Feb 2017 17:48:35 +0100 From: Radim Krcmar To: Marcelo Tosatti Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , "Rafael J. Wysocki" , Viresh Kumar Subject: Re: [patch 2/3] KVM: x86: introduce ioctl to allow frequency hypercalls Message-ID: <20170223164834.GE8342@potion> References: <20170202174755.946578704@redhat.com> <20170202174921.902084298@redhat.com> <20170203170336.GA15128@potion> <20170222211845.GA5777@amt.cnet> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170222211845.GA5777@amt.cnet> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 23 Feb 2017 16:48:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2017-02-22 18:18-0300, Marcelo Tosatti: > On Fri, Feb 03, 2017 at 06:03:37PM +0100, Radim Krcmar wrote: >> 2017-02-02 15:47-0200, Marcelo Tosatti: >> > For most VMs, modifying the host frequency is an undesired >> > operation. Introduce ioctl to enable the guest to >> > modify host CPU frequency. >> > >> > >> > Signed-off-by: Marcelo Tosatti >> > --- >> > arch/x86/include/asm/kvm_host.h | 2 ++ >> > arch/x86/include/uapi/asm/kvm.h | 5 +++++ >> > arch/x86/kvm/x86.c | 20 ++++++++++++++++++++ >> > include/uapi/linux/kvm.h | 3 +++ >> > virt/kvm/kvm_main.c | 2 ++ >> > 5 files changed, 32 insertions(+) >> > >> > Index: kvm-pvfreq/arch/x86/kvm/x86.c >> > =================================================================== >> > --- kvm-pvfreq.orig/arch/x86/kvm/x86.c 2017-01-31 10:32:33.023378783 -0200 >> > +++ kvm-pvfreq/arch/x86/kvm/x86.c 2017-01-31 10:34:25.443618639 -0200 >> > @@ -3665,6 +3665,26 @@ >> > r = kvm_vcpu_ioctl_enable_cap(vcpu, &cap); >> > break; >> > } >> > + case KVM_SET_VCPU_ALLOW_FREQ_HC: { >> >> Just enable the frequency hypercalls with KVM_ENABLE_CAP ioctl and get >> rid of this ioctl. >> (I don't think that we want to allow disabling this capability.) > > Not sure. What if you change the role of vcpus and now want > to change vcpu-1 from a realtime vcpu (one where only DPDK runs) > to a multi-user vcpu without a reboot? If we want to be dynamic, I'd rather have it as a hypercall that toggles the permissions for frequency change under CPL > 0. This would require guest kernel changes, though. As a benefit, we could enable the capability by default for all VCPUs and just let the guest kernel control which task can change frequency without exits into userspace. Having QEMU toggle the whole feature would require some QEMU emulated device, unless we really want to do it manually on both sides. Doing it manually doesn't sound useful outside of testing ... is DPDK actually being used "dynamically"? (I thought that the setup is decided when the host boots.) Thanks.