From nobody Thu May 2 16:14:43 2024 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.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1497877759602397.4697925521464; Mon, 19 Jun 2017 06:09:19 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F34C3DBE3; Mon, 19 Jun 2017 13:09:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 799B1187A3; Mon, 19 Jun 2017 13:09:15 +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 338824A493; Mon, 19 Jun 2017 13:09:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5JD9CBi013865 for ; Mon, 19 Jun 2017 09:09:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id B61A981EDC; Mon, 19 Jun 2017 13:09:12 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3F9D281A98 for ; Mon, 19 Jun 2017 13:09:07 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 81361100A24; Mon, 19 Jun 2017 15:09:06 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3F34C3DBE3 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3F34C3DBE3 From: Jiri Denemark To: libvir-list@redhat.com Date: Mon, 19 Jun 2017 15:09:04 +0200 Message-Id: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] cpu_x86: Properly disable unknown CPU features 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 19 Jun 2017 13:09:17 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" CPU features unknown to a hypervisor will not be present in dataDisabled even though the feature won't naturally be enabled because it is unknown. Thus any features we asked for which are not in dataEnabled should be considered disabled. Signed-off-by: Jiri Denemark --- src/cpu/cpu_x86.c | 9 +- tests/cputest.c | 1 + .../x86_64-cpuid-Core-i7-5600U-arat-disabled.xml | 5 + .../x86_64-cpuid-Core-i7-5600U-arat-enabled.xml | 8 + .../x86_64-cpuid-Core-i7-5600U-arat-guest.xml | 29 +++ .../x86_64-cpuid-Core-i7-5600U-arat-host.xml | 30 +++ .../x86_64-cpuid-Core-i7-5600U-arat-json.xml | 14 ++ .../x86_64-cpuid-Core-i7-5600U-arat.json | 202 +++++++++++++++++= ++++ .../x86_64-cpuid-Core-i7-5600U-arat.xml | 41 +++++ 9 files changed, 335 insertions(+), 4 deletions(-) create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disab= led.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabl= ed.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest= .xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.= xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-json.= xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.json create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.xml diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 53359ff9b..286445421 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2664,12 +2664,11 @@ virCPUx86UpdateLive(virCPUDefPtr cpu, x86DataCopy(&disabled, &dataDisabled->data.x86) < 0) goto cleanup; =20 - x86DataSubtract(&enabled, &model->data); - for (i =3D 0; i < map->nfeatures; i++) { virCPUx86FeaturePtr feature =3D map->features[i]; =20 - if (x86DataIsSubset(&enabled, &feature->data)) { + if (x86DataIsSubset(&enabled, &feature->data) && + !x86DataIsSubset(&model->data, &feature->data)) { VIR_DEBUG("Feature '%s' enabled by the hypervisor", feature->n= ame); if (cpu->check =3D=3D VIR_CPU_CHECK_FULL) virBufferAsprintf(&bufAdded, "%s,", feature->name); @@ -2678,7 +2677,9 @@ virCPUx86UpdateLive(virCPUDefPtr cpu, goto cleanup; } =20 - if (x86DataIsSubset(&disabled, &feature->data)) { + if (x86DataIsSubset(&disabled, &feature->data) || + (x86DataIsSubset(&model->data, &feature->data) && + !x86DataIsSubset(&enabled, &feature->data))) { VIR_DEBUG("Feature '%s' disabled by the hypervisor", feature->= name); if (cpu->check =3D=3D VIR_CPU_CHECK_FULL) virBufferAsprintf(&bufRemoved, "%s,", feature->name); diff --git a/tests/cputest.c b/tests/cputest.c index 89c645e64..ebcade6be 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -991,6 +991,7 @@ mymain(void) DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-4600U", true); DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-4510U", true); DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-5600U", true); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-5600U-arat", true); DO_TEST_CPUID(VIR_ARCH_X86_64, "Core2-E6850", true); DO_TEST_CPUID(VIR_ARCH_X86_64, "Core2-Q9500", false); DO_TEST_CPUID(VIR_ARCH_X86_64, "FX-8150", false); diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml= b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml new file mode 100644 index 000000000..4a0477f78 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml = b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml new file mode 100644 index 000000000..5cffacef5 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml b/= tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml new file mode 100644 index 000000000..877895cf1 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml @@ -0,0 +1,29 @@ + + Broadwell + Intel + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml b/t= ests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml new file mode 100644 index 000000000..9b24941e0 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml @@ -0,0 +1,30 @@ + + x86_64 + Broadwell + Intel + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-json.xml b/t= ests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-json.xml new file mode 100644 index 000000000..4f253fc08 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-json.xml @@ -0,0 +1,14 @@ + + Broadwell + Intel + + + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.json b/tests= /cputestdata/x86_64-cpuid-Core-i7-5600U-arat.json new file mode 100644 index 000000000..f2aa7f318 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.json @@ -0,0 +1,202 @@ +{ + "return": { + "model": { + "name": "base", + "props": { + "pfthreshold": false, + "pku": false, + "rtm": true, + "tsc_adjust": true, + "tsc-deadline": true, + "xstore-en": false, + "tsc-scale": false, + "sse": true, + "smap": true, + "stepping": 4, + "tce": false, + "kvm_steal_time": true, + "smep": true, + "rdpid": false, + "xcrypt": false, + "sse4_2": true, + "monitor": false, + "sse4_1": true, + "kvm-mmu": false, + "flushbyasid": false, + "kvm-steal-time": true, + "lm": true, + "tsc": true, + "adx": true, + "fxsr": true, + "sha-ni": false, + "tm": false, + "pclmuldq": true, + "xgetbv1": false, + "xstore": false, + "vmcb_clean": false, + "vme": true, + "vendor": "GenuineIntel", + "ffxsr": false, + "de": true, + "avx512f": false, + "pse": true, + "ds-cpl": false, + "tbm": false, + "ia64": false, + "phe-en": false, + "f16c": true, + "ds": false, + "mpx": false, + "tsc-adjust": true, + "aes": true, + "avx2": true, + "pbe": false, + "cx16": true, + "ds_cpl": false, + "movbe": true, + "perfctr-nb": false, + "nrip_save": false, + "kvm_mmu": false, + "ospke": false, + "avx512ifma": false, + "vmx": true, + "sep": true, + "xsaveopt": true, + "sse4a": false, + "avx512dq": false, + "i64": true, + "avx512-4vnniw": false, + "xsave": true, + "erms": true, + "hle": true, + "nodeid_msr": false, + "est": false, + "svm_lock": false, + "xop": false, + "model-id": "Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz", + "abm": true, + "avx512er": false, + "sse4.1": true, + "sse4.2": true, + "pause-filter": false, + "lahf-lm": true, + "kvm-nopiodelay": true, + "cmp_legacy": false, + "acpi": false, + "fma4": false, + "popcnt": true, + "mmx": true, + "osxsave": false, + "pcommit": false, + "avx512pf": false, + "clwb": false, + "dca": false, + "pdcm": false, + "xcrypt-en": false, + "3dnow": false, + "invtsc": false, + "tm2": false, + "hypervisor": true, + "kvmclock-stable-bit": true, + "fxsr-opt": false, + "pcid": true, + "sse4-1": true, + "sse4-2": true, + "avx512-vpopcntdq": false, + "avx512-4fmaps": false, + "pause_filter": false, + "svm-lock": false, + "rdrand": true, + "nrip-save": false, + "avx512vl": false, + "x2apic": true, + "kvmclock": true, + "pge": true, + "family": 6, + "dtes64": false, + "xd": true, + "kvm_pv_eoi": true, + "ace2": false, + "kvm_pv_unhalt": true, + "xtpr": false, + "perfctr_nb": false, + "avx512bw": false, + "nx": true, + "lwp": false, + "msr": true, + "ace2-en": false, + "decodeassists": false, + "perfctr-core": false, + "pn": false, + "fma": true, + "nodeid-msr": false, + "kvm_asyncpf": true, + "clflush": true, + "cx8": true, + "mce": true, + "avx512cd": false, + "cr8legacy": false, + "mca": true, + "pni": true, + "rdseed": true, + "apic": true, + "fsgsbase": true, + "cmp-legacy": false, + "kvm-pv-unhalt": true, + "rdtscp": true, + "mmxext": false, + "cid": false, + "ssse3": true, + "extapic": false, + "pse36": true, + "mtrr": true, + "ibs": false, + "la57": false, + "avx": true, + "syscall": true, + "umip": false, + "invpcid": true, + "avx512vbmi": false, + "kvm-asyncpf": true, + "vmcb-clean": false, + "pmm": false, + "cmov": true, + "perfctr_core": false, + "misalignsse": false, + "clflushopt": false, + "pat": true, + "lbrv": false, + "3dnowprefetch": true, + "fpu": true, + "pae": true, + "wdt": false, + "tsc_scale": false, + "skinit": false, + "fxsr_opt": false, + "kvm_nopiodelay": true, + "pmm-en": false, + "phe": false, + "3dnowext": false, + "osvw": false, + "ht": false, + "pdpe1gb": true, + "kvm-pv-eoi": true, + "npt": false, + "xsavec": false, + "lahf_lm": true, + "pclmulqdq": true, + "svm": false, + "sse3": true, + "sse2": true, + "ss": true, + "topoext": false, + "smx": false, + "bmi1": true, + "bmi2": true, + "xsaves": false, + "model": 61 + } + } + }, + "id": "model-expansion" +} diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.xml b/tests/= cputestdata/x86_64-cpuid-Core-i7-5600U-arat.xml new file mode 100644 index 000000000..ecb4a6e15 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.13.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list