From nobody Sun Feb 8 22:06:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1533820480046508.4285103478959; Thu, 9 Aug 2018 06:14:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 894A4821C1; Thu, 9 Aug 2018 13:14:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 518685D9CA; Thu, 9 Aug 2018 13:14:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 048F31841C4A; Thu, 9 Aug 2018 13:14:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w79DEPhj009375 for ; Thu, 9 Aug 2018 09:14:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2F4402142F22; Thu, 9 Aug 2018 13:14:25 +0000 (UTC) Received: from vitty.brq.redhat.com (unknown [10.43.2.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7FAA92142F20; Thu, 9 Aug 2018 13:14:24 +0000 (UTC) From: Vitaly Kuznetsov To: libvir-list@redhat.com Date: Thu, 9 Aug 2018 15:14:19 +0200 Message-Id: <20180809131421.24398-2-vkuznets@redhat.com> In-Reply-To: <20180809131421.24398-1-vkuznets@redhat.com> References: <20180809131421.24398-1-vkuznets@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Roman Kagan Subject: [libvirt] [PATCH 1/3] conf: qemu: add support for Hyper-V frequency MSRs X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 09 Aug 2018 13:14:38 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Qemu-2.12 gained 'hv-frequencies' cpu flag to enable Hyper-V frequency MSRs. These MSRs are required (but not sufficient) to make Hyper-V on KVM pass stable TSC page clocksource to L2 guests. Signed-off-by: Vitaly Kuznetsov --- docs/formatdomain.html.in | 7 +++++++ docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 6 +++++- src/conf/domain_conf.h | 1 + src/cpu/cpu_x86.c | 3 +++ src/cpu/cpu_x86_data.h | 1 + src/qemu/qemu_command.c | 1 + src/qemu/qemu_parse_command.c | 1 + src/qemu/qemu_process.c | 1 + tests/qemuxml2argvdata/hyperv-off.xml | 1 + tests/qemuxml2argvdata/hyperv.args | 2 +- tests/qemuxml2argvdata/hyperv.xml | 1 + tests/qemuxml2xmloutdata/hyperv-off.xml | 1 + tests/qemuxml2xmloutdata/hyperv.xml | 1 + 14 files changed, 30 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 34664f7903..4ec2b73244 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1937,6 +1937,7 @@ <synic state=3D'on'/> <reset state=3D'on'/> <vendor_id state=3D'on' value=3D'KVM Hv'/> + <frequencies state=3D'on'/> </hyperv> <kvm> <hidden state=3D'on'/> @@ -2059,6 +2060,12 @@ on, off; value - string, up to 12 characters 1.3.3 (QEMU 2.5) + + frequencies + Expose frequency MSRs + on, off + 4.7.0 (QEMU 2.12) +
pvspinlock
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 1a786968cc..fc013ff2a4 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5716,6 +5716,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8fd774b531..17a9bc8286 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -169,7 +169,8 @@ VIR_ENUM_IMPL(virDomainHyperv, VIR_DOMAIN_HYPERV_LAST, "synic", "stimer", "reset", - "vendor_id") + "vendor_id", + "frequencies") =20 VIR_ENUM_IMPL(virDomainKVM, VIR_DOMAIN_KVM_LAST, "hidden") @@ -20017,6 +20018,7 @@ virDomainDefParseXML(xmlDocPtr xml, case VIR_DOMAIN_HYPERV_SYNIC: case VIR_DOMAIN_HYPERV_STIMER: case VIR_DOMAIN_HYPERV_RESET: + case VIR_DOMAIN_HYPERV_FREQUENCIES: break; =20 case VIR_DOMAIN_HYPERV_SPINLOCKS: @@ -22201,6 +22203,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefP= tr src, case VIR_DOMAIN_HYPERV_SYNIC: case VIR_DOMAIN_HYPERV_STIMER: case VIR_DOMAIN_HYPERV_RESET: + case VIR_DOMAIN_HYPERV_FREQUENCIES: if (src->hyperv_features[i] !=3D dst->hyperv_features[i]) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("State of HyperV enlightenment " @@ -27851,6 +27854,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, case VIR_DOMAIN_HYPERV_SYNIC: case VIR_DOMAIN_HYPERV_STIMER: case VIR_DOMAIN_HYPERV_RESET: + case VIR_DOMAIN_HYPERV_FREQUENCIES: break; =20 case VIR_DOMAIN_HYPERV_SPINLOCKS: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index c1dfa37fdf..8b15b7e192 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1791,6 +1791,7 @@ typedef enum { VIR_DOMAIN_HYPERV_STIMER, VIR_DOMAIN_HYPERV_RESET, VIR_DOMAIN_HYPERV_VENDOR_ID, + VIR_DOMAIN_HYPERV_FREQUENCIES, =20 VIR_DOMAIN_HYPERV_LAST } virDomainHyperv; diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 809da94117..a2fbfb577d 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -109,6 +109,8 @@ KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_VPINDEX, 0x40000003, 0x00000040); KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_RESET, 0x40000003, 0x00000080); +KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_FREQUENCIES, + 0x40000003, 0x00000800); =20 static virCPUx86Feature x86_kvm_features[] =3D { @@ -129,6 +131,7 @@ static virCPUx86Feature x86_kvm_features[] =3D KVM_FEATURE(VIR_CPU_x86_KVM_HV_VAPIC), KVM_FEATURE(VIR_CPU_x86_KVM_HV_VPINDEX), KVM_FEATURE(VIR_CPU_x86_KVM_HV_RESET), + KVM_FEATURE(VIR_CPU_x86_KVM_HV_FREQUENCIES), }; =20 typedef struct _virCPUx86Model virCPUx86Model; diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h index b89110f16c..c01eb41be5 100644 --- a/src/cpu/cpu_x86_data.h +++ b/src/cpu/cpu_x86_data.h @@ -63,6 +63,7 @@ struct _virCPUx86CPUID { # define VIR_CPU_x86_KVM_HV_VAPIC "__kvm_hv_vapic" # define VIR_CPU_x86_KVM_HV_VPINDEX "__kvm_hv_vpindex" # define VIR_CPU_x86_KVM_HV_RESET "__kvm_hv_reset" +# define VIR_CPU_x86_KVM_HV_FREQUENCIES "__kvm_hv_frequencies" =20 =20 # define VIR_CPU_X86_DATA_INIT { 0 } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9e8f2f4c9c..2b84d379c8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6920,6 +6920,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, case VIR_DOMAIN_HYPERV_SYNIC: case VIR_DOMAIN_HYPERV_STIMER: case VIR_DOMAIN_HYPERV_RESET: + case VIR_DOMAIN_HYPERV_FREQUENCIES: if (def->hyperv_features[i] =3D=3D VIR_TRISTATE_SWITCH_ON) virBufferAsprintf(&buf, ",hv_%s", virDomainHypervTypeToString(i)); diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index 351425fedd..ffea9a26bd 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -1536,6 +1536,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom, case VIR_DOMAIN_HYPERV_SYNIC: case VIR_DOMAIN_HYPERV_STIMER: case VIR_DOMAIN_HYPERV_RESET: + case VIR_DOMAIN_HYPERV_FREQUENCIES: if (value) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("HyperV feature '%s' should not " diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c4e33723d1..1276d57f35 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3912,6 +3912,7 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def, case VIR_DOMAIN_HYPERV_SYNIC: case VIR_DOMAIN_HYPERV_STIMER: case VIR_DOMAIN_HYPERV_RESET: + case VIR_DOMAIN_HYPERV_FREQUENCIES: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("host doesn't support hyperv '%s' feature"), virDomainHypervTypeToString(i)); diff --git a/tests/qemuxml2argvdata/hyperv-off.xml b/tests/qemuxml2argvdata= /hyperv-off.xml index ba9c978848..d3a8455ac3 100644 --- a/tests/qemuxml2argvdata/hyperv-off.xml +++ b/tests/qemuxml2argvdata/hyperv-off.xml @@ -20,6 +20,7 @@ + diff --git a/tests/qemuxml2argvdata/hyperv.args b/tests/qemuxml2argvdata/hy= perv.args index a1acbb63de..53026bb2d5 100644 --- a/tests/qemuxml2argvdata/hyperv.args +++ b/tests/qemuxml2argvdata/hyperv.args @@ -9,7 +9,7 @@ QEMU_AUDIO_DRV=3Dnone \ -S \ -machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ -cpu 'qemu32,hv_relaxed,hv_vapic,hv_spinlocks=3D0x2fff,hv_vpindex,hv_runti= me,\ -hv_synic,hv_stimer,hv_reset,hv_vendor_id=3DKVM Hv' \ +hv_synic,hv_stimer,hv_reset,hv_vendor_id=3DKVM Hv,hv_frequencies' \ -m 214 \ -smp 6,sockets=3D6,cores=3D1,threads=3D1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ diff --git a/tests/qemuxml2argvdata/hyperv.xml b/tests/qemuxml2argvdata/hyp= erv.xml index 09f6d21024..27372d1636 100644 --- a/tests/qemuxml2argvdata/hyperv.xml +++ b/tests/qemuxml2argvdata/hyperv.xml @@ -20,6 +20,7 @@ + diff --git a/tests/qemuxml2xmloutdata/hyperv-off.xml b/tests/qemuxml2xmlout= data/hyperv-off.xml index 07eaf7219d..3ba0b827c3 100644 --- a/tests/qemuxml2xmloutdata/hyperv-off.xml +++ b/tests/qemuxml2xmloutdata/hyperv-off.xml @@ -20,6 +20,7 @@ + diff --git a/tests/qemuxml2xmloutdata/hyperv.xml b/tests/qemuxml2xmloutdata= /hyperv.xml index f9ae9504de..1e47a946d6 100644 --- a/tests/qemuxml2xmloutdata/hyperv.xml +++ b/tests/qemuxml2xmloutdata/hyperv.xml @@ -20,6 +20,7 @@ + --=20 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list