From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316675; cv=none; d=zohomail.com; s=zohoarc; b=IXcSfo0qa/8ruagntwXn3BpPLMRCthBOYXqaNJ/TkD2j4DtPYkER706pvqSWsC8uZx+9dp/fsjr1OOu4MleW0h61WqRnydfeWtvvGfLIMVB0mjJ/UeMaYg2L0XxUuMLcYkOC6Yv8rya+PgWVSX/HE2UDEvEJWZS56ZEMD4OEa3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316675; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=X6uBmDR6amGlHfX4//uxh5aLvPKcsrSnvmq8/98MkaY=; b=L/m5dwHLecWpKiFtjsNT7b3WaeQYrDK9OtjYW2bro8SBo29ZGRy3rJfQDUtl8GRBSLulgz1AVcewDq50+53kDlHsytZ3ONqtEhmE/Idwjgxt7iNxuRvJd1xDKF5A8Wob2TaYA8Zt9uGiM/dyG6WBANUK29RPsoUrZG/ygcqWx3Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585316675089750.4730595939236; Fri, 27 Mar 2020 06:44:35 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-187-5ZH_8wBlNFaQClWHy_V5Jw-1; Fri, 27 Mar 2020 09:44:29 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 388541005512; Fri, 27 Mar 2020 13:44:24 +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 E035B60C18; Fri, 27 Mar 2020 13:44:23 +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 4766718089CD; Fri, 27 Mar 2020 13:44:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiJdw006276 for ; Fri, 27 Mar 2020 09:44:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3610219756; Fri, 27 Mar 2020 13:44:19 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 05A3419925 for ; Fri, 27 Mar 2020 13:44:16 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id C681F18003A; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316671; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=X6uBmDR6amGlHfX4//uxh5aLvPKcsrSnvmq8/98MkaY=; b=YTgDngzLqf6oe8VNkhmk4S7DN41OojF81A9PdEgGntB0vYpzoXwy+WdYkwasq/VKilxTbc fM/WEl/7y/9ok5lFhq9gmcl0U2RYcbDuj5dDTJrCe7QlR52n32EoGcexi/IMuZhNGQVW2c m4lADe3huZps4oBfQ/5s59MyJ6HQdQ8= X-MC-Unique: 5ZH_8wBlNFaQClWHy_V5Jw-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 01/39] cpu_x86: Drop noTSX hint for incompatible CPUs Date: Fri, 27 Mar 2020 14:43:30 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The hint was introduced a long time ago when broken TSX implementation was found in Haswell and Broadwell CPUs. Since then many more CPUs with TSX were introduced and and disabled due to TAA vulnerability. Thus the hint is not very useful and I think removing it is a better choice then updating it to cover all current noTSX models. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 42 ++++++------------------------------------ 1 file changed, 6 insertions(+), 36 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ce15bb0454..eeb16c2763 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1937,7 +1937,6 @@ virCPUx86Compare(virCPUDefPtr host, bool failIncompatible) { virCPUCompareResult ret =3D VIR_CPU_COMPARE_ERROR; - virCPUx86MapPtr map; virCPUx86ModelPtr model =3D NULL; char *message =3D NULL; =20 @@ -1954,41 +1953,12 @@ virCPUx86Compare(virCPUDefPtr host, =20 ret =3D x86Compute(host, cpu, NULL, &message); =20 - if (ret =3D=3D VIR_CPU_COMPARE_INCOMPATIBLE) { - bool noTSX =3D false; - - if (STREQ_NULLABLE(cpu->model, "Haswell") || - STREQ_NULLABLE(cpu->model, "Broadwell")) { - if (!(map =3D virCPUx86GetMap())) - goto cleanup; - - if (!(model =3D x86ModelFromCPU(cpu, map, -1))) - goto cleanup; - - noTSX =3D !x86FeatureInData("hle", &model->data, map) || - !x86FeatureInData("rtm", &model->data, map); - } - - if (failIncompatible) { - ret =3D VIR_CPU_COMPARE_ERROR; - if (message) { - if (noTSX) { - virReportError(VIR_ERR_CPU_INCOMPATIBLE, - _("%s; try using '%s-noTSX' CPU model"), - message, cpu->model); - } else { - virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message= ); - } - } else { - if (noTSX) { - virReportError(VIR_ERR_CPU_INCOMPATIBLE, - _("try using '%s-noTSX' CPU model"), - cpu->model); - } else { - virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL); - } - } - } + if (ret =3D=3D VIR_CPU_COMPARE_INCOMPATIBLE && failIncompatible) { + ret =3D VIR_CPU_COMPARE_ERROR; + if (message) + virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message); + else + virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL); } =20 cleanup: --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316691; cv=none; d=zohomail.com; s=zohoarc; b=jc39pwdjcyjhgCnRwMtOOocXDm+2C68ucv6FZ4b1Iw4FQvvj54RamcXLv5AaDTo7YydYErus8iZf1uTGgkwAw7MtXSoq4wjOxwOuYOC7zDYTA8Ycc42isfmLB1m5nVbetissurBkGiGftj2fY//xmWkmbiz/uD928EIAJQq+D4A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316691; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jv6vHldytRZ3ja/1I2ol67EIGjltpDJRjKV6G08XI2U=; b=HtJeLpxOOe6/2gggNGglji2I/UjoXncB8v7emNkPUy02syG4etB6KG/zYOY7LrOF5gKTxUyua1zgdCX/C82tV9ArMNfQBonpb+0d4aBXuai4wYBz0Fz8R/4YK98nF+FBjcQQyKPtPaYCvyLV0pLJLZiwewqX075REXzsCPBqbxQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316691478294.0240207475139; Fri, 27 Mar 2020 06:44:51 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-64-w8M71WQmPX-Nxh6stJCwow-1; Fri, 27 Mar 2020 09:44:45 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6A95F149C9; Fri, 27 Mar 2020 13:44:39 +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 3E5B45E038; Fri, 27 Mar 2020 13:44:39 +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 E6A9C1808878; Fri, 27 Mar 2020 13:44:38 +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 02RDiJ2p006272 for ; Fri, 27 Mar 2020 09:44:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2C24C5E039; Fri, 27 Mar 2020 13:44:19 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F27AF5E038 for ; Fri, 27 Mar 2020 13:44:16 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id C7E9D18CF24; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316690; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jv6vHldytRZ3ja/1I2ol67EIGjltpDJRjKV6G08XI2U=; b=avlgNjN3Bi+kAVHMVatNlGdhzhvdeDktKpBSt94rd6BYWGCQwLToJ4lubLSoZ0yUH8Eh3H 4lSCxe9clT3IfcyVIVioT3ap5Tn1BfoYNu4MRd9hI5yCqL8ouV9Wazk+tKNF7I38meAAh2 Ut4CMJJwngfJyR0ItYIaA/WOa4eJSOs= X-MC-Unique: w8M71WQmPX-Nxh6stJCwow-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 02/39] cpu_x86: Use glib allocation for virCPU{, x86}Data Date: Fri, 27 Mar 2020 14:43:31 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index eeb16c2763..f0d9b7056a 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -468,8 +468,9 @@ virCPUx86DataClear(virCPUx86Data *data) if (!data) return; =20 - VIR_FREE(data->items); + g_free(data->items); } +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virCPUx86Data, virCPUx86DataClear); =20 =20 static void @@ -481,21 +482,19 @@ virCPUx86DataFree(virCPUDataPtr data) virCPUx86DataClear(&data->data.x86); VIR_FREE(data); } +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUData, virCPUx86DataFree); =20 =20 -static int +static void x86DataCopy(virCPUx86Data *dst, const virCPUx86Data *src) { size_t i; =20 - if (VIR_ALLOC_N(dst->items, src->len) < 0) - return -1; - + dst->items =3D g_new0(virCPUx86DataItem, src->len); dst->len =3D src->len; + for (i =3D 0; i < src->len; i++) dst->items[i] =3D src->items[i]; - - return 0; } =20 =20 @@ -781,9 +780,8 @@ x86DataToCPU(const virCPUx86Data *data, =20 cpu->model =3D g_strdup(model->name); =20 - if (x86DataCopy(©, data) < 0 || - x86DataCopy(&modelData, &model->data) < 0) - goto error; + x86DataCopy(©, data); + x86DataCopy(&modelData, &model->data); =20 if ((vendor =3D x86DataToVendor(©, map))) cpu->vendor =3D g_strdup(vendor->name); @@ -1183,11 +1181,11 @@ x86ModelCopy(virCPUx86ModelPtr model) =20 copy->name =3D g_strdup(model->name); =20 - if (x86ModelCopySignatures(copy, model) < 0 || - x86DataCopy(©->data, &model->data) < 0) { + if (x86ModelCopySignatures(copy, model) < 0) { x86ModelFree(copy); return NULL; } + x86DataCopy(©->data, &model->data); =20 copy->vendor =3D model->vendor; =20 @@ -1415,10 +1413,11 @@ x86ModelParseAncestor(virCPUx86ModelPtr model, } =20 model->vendor =3D ancestor->vendor; - if (x86ModelCopySignatures(model, ancestor) < 0 || - x86DataCopy(&model->data, &ancestor->data) < 0) + if (x86ModelCopySignatures(model, ancestor) < 0) return -1; =20 + x86DataCopy(&model->data, &ancestor->data); + return 0; } =20 @@ -1904,9 +1903,9 @@ x86Compute(virCPUDefPtr host, =20 x86DataSubtract(&guest_model->data, &cpu_disable->data); =20 - if (!(guestData =3D virCPUDataNew(arch)) || - x86DataCopy(&guestData->data.x86, &guest_model->data) < 0) + if (!(guestData =3D virCPUDataNew(arch))) goto error; + x86DataCopy(&guestData->data.x86, &guest_model->data); =20 *guest =3D guestData; } @@ -2141,9 +2140,11 @@ x86Decode(virCPUDefPtr cpu, ssize_t i; int rc; =20 - if (!cpuData || x86DataCopy(&data, cpuData) < 0) + if (!cpuData) return -1; =20 + x86DataCopy(&data, cpuData); + if (!(map =3D virCPUx86GetMap())) goto cleanup; =20 @@ -3057,13 +3058,11 @@ virCPUx86UpdateLive(virCPUDefPtr cpu, !(modelDisabled =3D x86ModelFromCPU(cpu, map, VIR_CPU_FEATURE_DISA= BLE))) goto cleanup; =20 - if (dataEnabled && - x86DataCopy(&enabled, &dataEnabled->data.x86) < 0) - goto cleanup; + if (dataEnabled) + x86DataCopy(&enabled, &dataEnabled->data.x86); =20 - if (dataDisabled && - x86DataCopy(&disabled, &dataDisabled->data.x86) < 0) - goto cleanup; + if (dataDisabled) + x86DataCopy(&disabled, &dataDisabled->data.x86); =20 for (i =3D 0; i < map->nfeatures; i++) { virCPUx86FeaturePtr feature =3D map->features[i]; --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316674; cv=none; d=zohomail.com; s=zohoarc; b=ecw+tVTAbTr+217rt4zOqeJnkK4lxZQqAt1LJDRDGdcNbA6c/WNKKP56gU+fWWcNbf5+A9cqw9HFSMLoiQhf570KeboPYz7SbDfmsq/AKmsePBUwJy5v6v7SZdAWTHDzAnJnOM6GaRKEa01Olh6AYJg9lwRx2kPqEC6MgXzkFDo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316674; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=O/KDyZwtK5WZJzJ8GRplMz0FmPHzp71TW6snUUaxP0o=; b=cMScMRgOx8G4lO8b/DPgBB3cE+/+6sKl1FE+6sKtj+N9QJzvu7gj37JZmhqEByo4Y9wiYMaGUVqVDzUlHCEgcaw8fPZs5pfSLXkXwic4Woo1kH0amguJTEj/GKmoQk1VNUxVsTrZP7x8+E3bPJqSZgzyKj+/3SJ7T68CHT9J2tQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585316674849379.2300289056386; Fri, 27 Mar 2020 06:44:34 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-331-n07iIHt8N9y5INvlwJzTPg-1; Fri, 27 Mar 2020 09:44:30 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 40D751B18BC2; Fri, 27 Mar 2020 13:44:24 +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 18C3A5E03B; Fri, 27 Mar 2020 13:44:24 +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 3CD028A057; Fri, 27 Mar 2020 13:44:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiJwr006274 for ; Fri, 27 Mar 2020 09:44:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 329E060BF4; Fri, 27 Mar 2020 13:44:19 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0402660BF3 for ; Fri, 27 Mar 2020 13:44:16 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id CA4BA18D00E; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316672; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=O/KDyZwtK5WZJzJ8GRplMz0FmPHzp71TW6snUUaxP0o=; b=eFcu9+7Rs3KI9JhaDcR+w98fx7icm7J6uNq16Je2W8k8+lRHnakMHSuEo+fkwxcMMxg799 pnmCgNj1RrWcFzpFHL2jaUxDVxqG22GhJ3CLpfFa/KgmVppmiBGkneSrvjbKjZRorQH/wQ y4H81TQ622Rv1vrwjlKENYCtD0OVvgs= X-MC-Unique: n07iIHt8N9y5INvlwJzTPg-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 03/39] cpu_x86: Use glib allocation for virCPUx86Vendor Date: Fri, 27 Mar 2020 14:43:32 +0100 Message-Id: <3458047ab76aad89ffb6d2bb116b5fbcc53f5d42.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index f0d9b7056a..6fad4af922 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -830,9 +830,10 @@ x86VendorFree(virCPUx86VendorPtr vendor) if (!vendor) return; =20 - VIR_FREE(vendor->name); - VIR_FREE(vendor); + g_free(vendor->name); + g_free(vendor); } +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Vendor, x86VendorFree); =20 =20 static virCPUx86VendorPtr @@ -860,9 +861,7 @@ x86VendorParse(xmlXPathContextPtr ctxt, char *string =3D NULL; int ret =3D -1; =20 - if (VIR_ALLOC(vendor) < 0) - goto cleanup; - + vendor =3D g_new0(virCPUx86Vendor, 1); vendor->name =3D g_strdup(name); =20 if (x86VendorFind(map, vendor->name)) { --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316675; cv=none; d=zohomail.com; s=zohoarc; b=Ig7QRm+4bLNHSqC8S4ZIAx14AMRfE9QO8oXXLZ8Nu+duOORMRpPNmQKETt+SoYj1tvgO0Iqk3vIKNK90SJl8BXr4BEEwZm//CvaBk1gCcX51HnFhiyRmiSDXbyzRWbA9Nsgro9JgLJvmHf8ozQlly8/eOqmrq/6IWV8cS42CdqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316675; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MIi+p8Ss14jPmIxmEyWJOddkna+vL2OI/AILOtOZO5w=; b=cnUCRVS3LpNu04IlWNv4FKuahVfEtGv4k/8MkXqSqUc6P0nlbZNxIOtihnlk4b9XiYiEW7fYD5EnaapFQF6/glnQesRUt2RYROXZPFDZN9Mhyjao0tjmtqSOrghl1InvO2eYefKoWx6EESalljOqvRAgNDVc1QIxX7K3faqaIjk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585316675178657.4597862881378; Fri, 27 Mar 2020 06:44:35 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-283-uZh7bq-wN5O_zkHwWmBWZQ-1; Fri, 27 Mar 2020 09:44:30 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 433051005514; Fri, 27 Mar 2020 13:44:24 +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 0D9CF96FA4; Fri, 27 Mar 2020 13:44:24 +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 031978A055; Fri, 27 Mar 2020 13:44:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiJm3006266 for ; Fri, 27 Mar 2020 09:44:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id F1D035C1D8; Fri, 27 Mar 2020 13:44:18 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C36165C1D4 for ; Fri, 27 Mar 2020 13:44:16 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id CCAA318D070; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316671; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MIi+p8Ss14jPmIxmEyWJOddkna+vL2OI/AILOtOZO5w=; b=gP8VtuAeUt7hu7NrnLyLYyvsj2kdOy6GARDsZDs6boUyjt4B2BVgLSgjCWQvlscUExCHWD DI0+M71l30pSCxJBHKlnivkRfvHbIiWZTto3jXJz06zyYIsD9eoTdImb/2eUDybhfhwyro 0JlKmTWjPLiqbEDAHmlEIkZtmKG1f9o= X-MC-Unique: uZh7bq-wN5O_zkHwWmBWZQ-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 04/39] cpu_x86: Use glib allocation for virCPUx86Feature Date: Fri, 27 Mar 2020 14:43:33 +0100 Message-Id: <47a46bf4d35b847f634c8d23473e8638ead5e33a.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 6fad4af922..cfb8a2e4a5 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -893,28 +893,17 @@ x86VendorParse(xmlXPathContextPtr ctxt, } =20 =20 -static virCPUx86FeaturePtr -x86FeatureNew(void) -{ - virCPUx86FeaturePtr feature; - - if (VIR_ALLOC(feature) < 0) - return NULL; - - return feature; -} - - static void x86FeatureFree(virCPUx86FeaturePtr feature) { if (!feature) return; =20 - VIR_FREE(feature->name); + g_free(feature->name); virCPUx86DataClear(&feature->data); - VIR_FREE(feature); + g_free(feature); } +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Feature, x86FeatureFree); =20 =20 static int @@ -1056,11 +1045,8 @@ x86FeatureParse(xmlXPathContextPtr ctxt, char *str =3D NULL; int ret =3D -1; =20 - if (!(feature =3D x86FeatureNew())) - goto cleanup; - + feature =3D g_new0(virCPUx86Feature, 1); feature->migratable =3D true; - feature->name =3D g_strdup(name); =20 if (x86FeatureFind(map, feature->name)) { --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316687; cv=none; d=zohomail.com; s=zohoarc; b=a9kRTyhSs3O/IA6Xe5qMpeGfSna80QSajU/PfTRPMpdFHWdl7YM79FBGJbteq8jTMWW4var4Cqy1/UcFhmGWLW7r/cUy7MDwO3bgxxpWITIrne0/vAHtQWFzcwLlizinj4Pvo3zhdeKMc5TvWl36J+AqB8itQa2zNibtl2AwPzI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316687; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ewUbTkP55IFI/4ugFSy0BXKJaXmSAhwFeBwg9pdcTKE=; b=ImjewjqiBGIObg5W7ZdbJLGM7TRmknMy3Ffh0h+BVdKnkPErKk4CEGQZVW0IOVg9UNWRxtaVvuRmzAZzQzw61wCvNJb0bOs46GiFgvDqTyuu/U01+7j4wwkTfmyWOgNN4SKwTMnwnHe9HR7vzP1IoxtAd4SbHrztwEJMcjIKC3o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585316687649108.64176167390144; Fri, 27 Mar 2020 06:44:47 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-159-Uu2TKSEnPrmr2Ko6M_a1FQ-1; Fri, 27 Mar 2020 09:44:41 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D91D41005516; Fri, 27 Mar 2020 13:44:35 +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 A54865E038; Fri, 27 Mar 2020 13:44:35 +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 5EA9D18089D0; Fri, 27 Mar 2020 13:44:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiKvU006292 for ; Fri, 27 Mar 2020 09:44:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8D8345C1D6; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5D6645C1D4 for ; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id CEA5818D071; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316683; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ewUbTkP55IFI/4ugFSy0BXKJaXmSAhwFeBwg9pdcTKE=; b=YBDXZzMfE8SlqJQw09l2ntrBvJpR/aA1KDZFNkNJ5V0VPf67FdS53tez6zOyxyyrmcKqHr xl99HqvOYT5UdGt3OnYkBc0K6vWeIjlsS13vHLRZuSavm0x+hL97u+jgyyyuI8vVFZ0VTd uYu36yhUGyR5U4DYcLXll4uHN48t9Hk= X-MC-Unique: Uu2TKSEnPrmr2Ko6M_a1FQ-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 05/39] cpu_x86: Use glib allocation for virCPUx86Model Date: Fri, 27 Mar 2020 14:43:34 +0100 Message-Id: <281aa0eea858efd398a93a1ea692c9d8e3fea55f.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index cfb8a2e4a5..4a0413db16 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1111,29 +1111,18 @@ x86FeatureParse(xmlXPathContextPtr ctxt, } =20 =20 -static virCPUx86ModelPtr -x86ModelNew(void) -{ - virCPUx86ModelPtr model; - - if (VIR_ALLOC(model) < 0) - return NULL; - - return model; -} - - static void x86ModelFree(virCPUx86ModelPtr model) { if (!model) return; =20 - VIR_FREE(model->name); - VIR_FREE(model->signatures); + g_free(model->name); + g_free(model->signatures); virCPUx86DataClear(&model->data); - VIR_FREE(model); + g_free(model); } +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Model, x86ModelFree); =20 =20 static int @@ -1161,9 +1150,7 @@ x86ModelCopy(virCPUx86ModelPtr model) { virCPUx86ModelPtr copy; =20 - if (VIR_ALLOC(copy) < 0) - return NULL; - + copy =3D g_new0(virCPUx86Model, 1); copy->name =3D g_strdup(model->name); =20 if (x86ModelCopySignatures(copy, model) < 0) { @@ -1216,7 +1203,7 @@ x86ModelFromCPU(const virCPUDef *cpu, if (cpu->type =3D=3D VIR_CPU_TYPE_HOST && policy !=3D VIR_CPU_FEATURE_REQUIRE && policy !=3D -1) - return x86ModelNew(); + return g_new0(virCPUx86Model, 1); =20 if (cpu->model && (policy =3D=3D VIR_CPU_FEATURE_REQUIRE || policy =3D=3D -1)) { @@ -1228,7 +1215,7 @@ x86ModelFromCPU(const virCPUDef *cpu, =20 model =3D x86ModelCopy(model); } else { - model =3D x86ModelNew(); + model =3D g_new0(virCPUx86Model, 1); } =20 if (!model) @@ -1540,9 +1527,7 @@ x86ModelParse(xmlXPathContextPtr ctxt, goto cleanup; } =20 - if (!(model =3D x86ModelNew())) - goto cleanup; - + model =3D g_new0(virCPUx86Model, 1); model->name =3D g_strdup(name); =20 if (x86ModelParseDecode(model, ctxt) < 0) --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316697; cv=none; d=zohomail.com; s=zohoarc; b=bYBkZidqlISHkUVyk0QA4vjbzp2INMuJ1lulrqmfIr5+InaFGDdDfLIi2cGNbDxX4miC0p5Vj6QS/qhSl7lrDLfRHacFM87s4yhJLmBpeVj6nXKBG3Kkc7dKG9bWvf3fbB3LtIsCG2M8jdnuarwxKyfYC/wYq/HQm9FeUlWNQO8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316697; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=33Gq6dYk4vI2aqG4vi7ioJZAdjf6WMpDFbtqPDMtqS8=; b=kCfdPyKTvX3by0E+jySND3EAcgM62xzRUjlpWRLDppnDeB1YP8vFCyXTx1Up5ITj0aZC7dFxk/oCypkCvV0A3oi5xzjjDQlMgeXlo695LEAlVhr+6gpNiYNDIy5p7PBAD9tAfBnGeE2QEDPM5Tg5BDzuyaT7ooVScmD2HkFe46s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316697045567.6548220757676; Fri, 27 Mar 2020 06:44:57 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-480-to84yN5NOmSgF8a8Q0lE2A-1; Fri, 27 Mar 2020 09:44:52 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id D768F1B18BCC; Fri, 27 Mar 2020 13:44:46 +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 B167B5DA85; Fri, 27 Mar 2020 13:44:46 +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 6BE0A1803C33; Fri, 27 Mar 2020 13:44:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiNSV006340 for ; Fri, 27 Mar 2020 09:44:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4EA645DA7D; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1D4FC5DA84 for ; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id D0E6718D072; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316695; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=33Gq6dYk4vI2aqG4vi7ioJZAdjf6WMpDFbtqPDMtqS8=; b=FWasue462BLPL1bSJPlmcYUGfFGYeCM5zmZqjHqy4RqTVFr3anwWYNXFMwJN0s95nKFX+v t/yjy7qN/JbyYrkIs9nnVfxFPJVlBRKQbXc9ylDpKV2gV5tlBvOQjfgm5vylEjLOS3cThi vu/eSjbXDJTbhQ6nf9mPI0+eVUgZBVA= X-MC-Unique: to84yN5NOmSgF8a8Q0lE2A-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 06/39] cpu_x86: Use glib allocation for virCPUx86Map Date: Fri, 27 Mar 2020 14:43:35 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 4a0413db16..bcb87d6f93 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1566,23 +1566,24 @@ x86MapFree(virCPUx86MapPtr map) =20 for (i =3D 0; i < map->nfeatures; i++) x86FeatureFree(map->features[i]); - VIR_FREE(map->features); + g_free(map->features); =20 for (i =3D 0; i < map->nmodels; i++) x86ModelFree(map->models[i]); - VIR_FREE(map->models); + g_free(map->models); =20 for (i =3D 0; i < map->nvendors; i++) x86VendorFree(map->vendors[i]); - VIR_FREE(map->vendors); + g_free(map->vendors); =20 /* migrate_blockers only points to the features from map->features lis= t, * which were already freed above */ - VIR_FREE(map->migrate_blockers); + g_free(map->migrate_blockers); =20 - VIR_FREE(map); + g_free(map); } +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Map, x86MapFree); =20 =20 static virCPUx86MapPtr @@ -1590,8 +1591,7 @@ virCPUx86LoadMap(void) { virCPUx86MapPtr map; =20 - if (VIR_ALLOC(map) < 0) - return NULL; + map =3D g_new0(virCPUx86Map, 1); =20 if (cpuMapLoad("x86", x86VendorParse, x86FeatureParse, x86ModelParse, = map) < 0) goto error; --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316764; cv=none; d=zohomail.com; s=zohoarc; b=PdELb/cqNIRaXZJSqw4yvqg/ce/YGuQ4OeOzdbVe33Q/CYFxFjBzVFn4fwBsAWn9LkCcmHc43MmfM4pePjI/dQoKQLLtcEvXNJep5N4EUfte9kJxvimfpFUqhqWW0ts0XqoYXWpVf5gXcE0CPxGkLeKesjiaSPQU9T6QSWzJwUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316764; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=i4euikkD3g3fpB22Jez6aRTFxhaXZhbQNZPfLMQtAnM=; b=nnBDQam4JAvqmGgKTABdmFK3z0XhP+8ZJow75L9owXTVxg57vkj0wV5Brx4V1KTP9ez1E06X/EzjS0Agp4hD2kXDr3O2qo9a7GzZsVQcdSs7Ogx0cW4tK1Fk6OlpU4PTaQEjVYin6omwIc3MZjJrrv9t/4KNPyoS+ib0aujuHCQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316764602455.74535461926405; Fri, 27 Mar 2020 06:46:04 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-423-feJLkbmVOFyX1cBhW8vjBA-1; Fri, 27 Mar 2020 09:45:08 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 38C0C1088380; Fri, 27 Mar 2020 13:45:01 +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 09BAE5E03E; Fri, 27 Mar 2020 13:45:01 +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 ADCDF1803500; Fri, 27 Mar 2020 13:45:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiNDU006338 for ; Fri, 27 Mar 2020 09:44:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4BC215DA88; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1CD2A5DA7D for ; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id D316018D095; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316763; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=i4euikkD3g3fpB22Jez6aRTFxhaXZhbQNZPfLMQtAnM=; b=AbHMKMc7tgqtdgTCg4nSm8ZvntDq4wj+9HHDvt3jSNhq01HrbL+J0eWzuFUK6WcN1oHQ2x XNAZfK0OIz7t5Gz7vUjkP6Rsq98Lalmb/bLsGILWvBoq5extCAlvDuaxz1cI43oOTK0uag cyXTwsOQkKd+PUlTmWKc4JYJUww3y/k= X-MC-Unique: feJLkbmVOFyX1cBhW8vjBA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 07/39] cpu_x86: Use glib allocation in virCPUx86GetModels Date: Fri, 27 Mar 2020 14:43:36 +0100 Message-Id: <23f673cdb42c263584cc5b195ccc59638fdf653d.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index bcb87d6f93..fce7a2b8c5 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -3123,21 +3123,13 @@ virCPUx86GetModels(char ***models) return -1; =20 if (models) { - if (VIR_ALLOC_N(*models, map->nmodels + 1) < 0) - goto error; + *models =3D g_new0(char *, map->nmodels + 1); =20 for (i =3D 0; i < map->nmodels; i++) (*models)[i] =3D g_strdup(map->models[i]->name); } =20 return map->nmodels; - - error: - if (models) { - virStringListFree(*models); - *models =3D NULL; - } - return -1; } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316892; cv=none; d=zohomail.com; s=zohoarc; b=Fj/UfL+VTVjgr8i8s6CbXUKMTOm+h1o/TZnzGhIREit0Z/IlLqF2rDkRiW58Wbm1yPzcTgN9WdeV8xPHZtuGslDkpIW1uvrX/dkuUoSAoFrtzNF5ldj8qKJUYMUAqD9MwT+RocPHAgW+5vDVz60julKvGXE32K02dKWFuE4zu0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316892; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pLSaiP/wZeXX4OBQPAK4yRBVmmyJo6APBJ+/cOQLStw=; b=ASINk11ldqZ3dZM0j+vSzXuyB9emKAw6hgjKph+ejc0dpb6OKvQcsG312c3XCCIyCihifo6+dPY6UHyhBzp5ftyg0pcQT14lm09JnJjVy/G2GqvBEv/WIlvEJwkA4Ne6Oozu+xsTPPI+JdSFETPwNsQ345fjI7x4uzm1MpFf7jY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316892971579.15252507585; Fri, 27 Mar 2020 06:48:12 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-389-XujP--sIPQSy7ThWFxlG4Q-1; Fri, 27 Mar 2020 09:45:12 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AA375107ACCC; Fri, 27 Mar 2020 13:45:06 +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 67C305E03C; Fri, 27 Mar 2020 13:45:06 +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 DE2E41803516; Fri, 27 Mar 2020 13:45:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiNnE006382 for ; Fri, 27 Mar 2020 09:44:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 90115A0A98; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 16760CDBD5 for ; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id D560318D190; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316891; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=pLSaiP/wZeXX4OBQPAK4yRBVmmyJo6APBJ+/cOQLStw=; b=WbvrH2Dy3q1zonbY0d+8X7LUkWTRAQZeSsJAbbrUxVCTcThxyg38VAbvOSRvO9r9G9SWnR rc8myhsDQOlTOEYTpP8nRdAT2bAe/qYVnOZEFWlvQDjMBOLuJ4Gt/LsAOKgRCLx/a8zmyy wuqRdjZ/WFCM3/gZ4GszuH+E1aNOKaU= X-MC-Unique: XujP--sIPQSy7ThWFxlG4Q-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 08/39] cpu_x86: Use g_auto* in x86DataToCPU Date: Fri, 27 Mar 2020 14:43:37 +0100 Message-Id: <05192fd2e107c1b7f20dfd7968dad197279de479.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index fce7a2b8c5..d0ef66f1e3 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -771,9 +771,9 @@ x86DataToCPU(const virCPUx86Data *data, virCPUx86MapPtr map, virDomainCapsCPUModelPtr hvModel) { - virCPUDefPtr cpu; - virCPUx86Data copy =3D VIR_CPU_X86_DATA_INIT; - virCPUx86Data modelData =3D VIR_CPU_X86_DATA_INIT; + g_autoptr(virCPUDef) cpu =3D NULL; + g_auto(virCPUx86Data) copy =3D VIR_CPU_X86_DATA_INIT; + g_auto(virCPUx86Data) modelData =3D VIR_CPU_X86_DATA_INIT; virCPUx86VendorPtr vendor; =20 cpu =3D virCPUDefNew(); @@ -801,7 +801,7 @@ x86DataToCPU(const virCPUx86Data *data, if ((feature =3D x86FeatureFind(map, *blocker)) && !x86DataIsSubset(©, &feature->data)) if (x86DataAdd(&modelData, &feature->data) < 0) - goto error; + return NULL; } } =20 @@ -810,17 +810,9 @@ x86DataToCPU(const virCPUx86Data *data, =20 if (x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_REQUIRE, ©, map) || x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_DISABLE, &modelData, map= )) - goto error; - - cleanup: - virCPUx86DataClear(&modelData); - virCPUx86DataClear(©); - return cpu; + return NULL; =20 - error: - virCPUDefFree(cpu); - cpu =3D NULL; - goto cleanup; + return g_steal_pointer(&cpu); } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316703; cv=none; d=zohomail.com; s=zohoarc; b=B9a6TeAxXuWtq1NiR3ZsCYfeqLTmEuTVcaSp2x/KWWl980jN0HvDwi/4qVxqy2ANyqGAj/12quCUfVxUuqT7fEEr/QkjiWaorNP2TWK+n2M55SYP1w37O5CIQrCrq18S+gPEoB4bilJiyw0ZljJ8locz3DiOk0AMRjeoLV0DXyE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316703; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CBsjbnqdCFB6GYJvYe4VhyBdAD4fZG22oF3vb1QTD3k=; b=cpkqjsTNU0C2ALvrDfSKSsNQ+BOE0dkzMNsPVMqGF9PsYBh97mtYmbGWdO8zwncFvzpYE6R/Jg8dumKfu3DQTtzJfa07tYEmAZR/FZ2Ag22oOE4rvIwjLH19F1w5mpVSfmYM7KskXMaChIBXIUDrtHExi90yx36E1b7cPtworAw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585316703551917.8305459544749; Fri, 27 Mar 2020 06:45:03 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-217-lCIDNu06OdquMLcSPOefWQ-1; Fri, 27 Mar 2020 09:45:00 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 94E22800D6C; Fri, 27 Mar 2020 13:44:54 +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 6F45460C87; Fri, 27 Mar 2020 13:44:54 +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 28ED7942B4; Fri, 27 Mar 2020 13:44:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiNVE006366 for ; Fri, 27 Mar 2020 09:44:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 68EAF10027A3; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 383F51001925 for ; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id D80F618D191; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316702; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=CBsjbnqdCFB6GYJvYe4VhyBdAD4fZG22oF3vb1QTD3k=; b=Jr27shNNYDpGBl3gL+IVHNn21Cv91YIFaZ9PI6cd+SkjqeFkosrNrB6k4cTnkWHr1vVF67 teheZBAhgd9UAmt7nmcCSCupQbB4V8kiaC/t63VUTYIqu+WhsvirXoHvbyjOzspyZNNkNN n8Iz53eYLtLtlwlOkDlMj7irCjsFiXQ= X-MC-Unique: lCIDNu06OdquMLcSPOefWQ-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 09/39] cpu_x86: Use g_auto* in x86VendorParse Date: Fri, 27 Mar 2020 14:43:38 +0100 Message-Id: <31e9d138c672d144c5418f850e9e84c494eeae8c.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index d0ef66f1e3..a678bcde61 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -849,9 +849,8 @@ x86VendorParse(xmlXPathContextPtr ctxt, void *data) { virCPUx86MapPtr map =3D data; - virCPUx86VendorPtr vendor =3D NULL; - char *string =3D NULL; - int ret =3D -1; + g_autoptr(virCPUx86Vendor) vendor =3D NULL; + g_autofree char *string =3D NULL; =20 vendor =3D g_new0(virCPUx86Vendor, 1); vendor->name =3D g_strdup(name); @@ -859,7 +858,7 @@ x86VendorParse(xmlXPathContextPtr ctxt, if (x86VendorFind(map, vendor->name)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("CPU vendor %s already defined"), vendor->name); - goto cleanup; + return -1; } =20 string =3D virXPathString("string(@string)", ctxt); @@ -867,21 +866,16 @@ x86VendorParse(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("Missing vendor string for CPU vendor %s"), vendor->name); - goto cleanup; + return -1; } =20 if (virCPUx86VendorToData(string, &vendor->data) < 0) - goto cleanup; + return -1; =20 if (VIR_APPEND_ELEMENT(map->vendors, map->nvendors, vendor) < 0) - goto cleanup; - - ret =3D 0; + return -1; =20 - cleanup: - x86VendorFree(vendor); - VIR_FREE(string); - return ret; + return 0; } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316689; cv=none; d=zohomail.com; s=zohoarc; b=LYBGCaLj3sp/t3vQkFIo4SE13rmlO2PDa1FgzpAMQZcyo1sIVrZPLMG31YNJDvlOhQsLBRBdSgSuw1TwGVz049sS5YU44LbPThQgSHRe8MHH3dl7YjA50x5ZF9zrwjdWMXp7nuBDNSlz5mfErRPYDLCf5C5gymGassRrBvsFcqU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316689; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yrPByb0fu39jCGmrSLslIhsAdgV5U++3Hr46VIZj/Hg=; b=jKk/ECabjHvzsh47lX5S5nMp9hN4yMDcsldHBUOXMHE7NNPB0r7f0AcskyBQexUtvC2A4Guf52Oz8PIdFY7UOSvilV8nDOlYCJXZ1YIcgnHhwyv55G5ND7ngWb9u2C1ynUVHpR7CyFZkItBUTpGkBPp0b9QG3RChaQyX759iyW8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 158531668943739.02930704772359; Fri, 27 Mar 2020 06:44:49 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-154-ZrM7p7o5N3OWUwUoRMqwcA-1; Fri, 27 Mar 2020 09:44:44 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5C6EC1B18BC1; Fri, 27 Mar 2020 13:44:39 +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 360B096FA5; Fri, 27 Mar 2020 13:44:39 +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 E16041808855; Fri, 27 Mar 2020 13:44:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiKgC006297 for ; Fri, 27 Mar 2020 09:44:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id BFAB160BF4; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8FE7C60BF3 for ; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id DB33918D192; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316687; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=yrPByb0fu39jCGmrSLslIhsAdgV5U++3Hr46VIZj/Hg=; b=N2Lr5m+3UZ8/5ruqONIHz0nA0sza/pOeUnvTQsr3ws9wb7J4ICXtkpfbQn7nn3VvBmbNSu OXvGUZ0evO5NrqShGTg56DE3E0i2kd3ZT/lUwf0MuYwGCM71fidGG1lque5cfIhUMdluVX NKzX+lTipHbzqBgSWMLKxBH1ON0vbF4= X-MC-Unique: ZrM7p7o5N3OWUwUoRMqwcA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 10/39] cpu_x86: Use g_auto* in x86FeatureParse Date: Fri, 27 Mar 2020 14:43:39 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index a678bcde61..d2bbcbd891 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1023,13 +1023,12 @@ x86FeatureParse(xmlXPathContextPtr ctxt, void *data) { virCPUx86MapPtr map =3D data; - xmlNodePtr *nodes =3D NULL; - virCPUx86FeaturePtr feature; + g_autofree xmlNodePtr *nodes =3D NULL; + g_autoptr(virCPUx86Feature) feature =3D NULL; virCPUx86DataItem item; size_t i; int n; - char *str =3D NULL; - int ret =3D -1; + g_autofree char *str =3D NULL; =20 feature =3D g_new0(virCPUx86Feature, 1); feature->migratable =3D true; @@ -1038,7 +1037,7 @@ x86FeatureParse(xmlXPathContextPtr ctxt, if (x86FeatureFind(map, feature->name)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("CPU feature %s already defined"), feature->name); - goto cleanup; + return -1; } =20 str =3D virXPathString("string(@migratable)", ctxt); @@ -1047,13 +1046,13 @@ x86FeatureParse(xmlXPathContextPtr ctxt, =20 n =3D virXPathNodeSet("./cpuid|./msr", ctxt, &nodes); if (n < 0) - goto cleanup; + return -1; =20 if (n =3D=3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Missing cpuid or msr element in feature %s"), feature->name); - goto cleanup; + return -1; } =20 for (i =3D 0; i < n; i++) { @@ -1063,37 +1062,31 @@ x86FeatureParse(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid cpuid[%zu] in %s feature"), i, feature->name); - goto cleanup; + return -1; } } else { if (x86ParseMSR(ctxt, &item) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid msr[%zu] in %s feature"), i, feature->name); - goto cleanup; + return -1; } } =20 if (virCPUx86DataAddItem(&feature->data, &item)) - goto cleanup; + return -1; } =20 if (!feature->migratable && VIR_APPEND_ELEMENT_COPY(map->migrate_blockers, map->nblockers, feature) < 0) - goto cleanup; + return -1; =20 if (VIR_APPEND_ELEMENT(map->features, map->nfeatures, feature) < 0) - goto cleanup; - - ret =3D 0; + return -1; =20 - cleanup: - x86FeatureFree(feature); - VIR_FREE(nodes); - VIR_FREE(str); - return ret; + return 0; } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316699; cv=none; d=zohomail.com; s=zohoarc; b=S8Fu+gW9C+gHx1Z4M8RJ4G4JHElp+Cq2aY7xWs2V5o9KsjgkASSXwsV88mHf0VXegteITTXdoaG5HFQPEQgs4rPuieQ9AbLpc6CI/OrQcWNxvNb/Nva/Gq77bgNUS9/lcEq+QvvLd2KH9HJnKrY5GsXGikOz1STq9svm1mK7pIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316699; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OvvmQrVjOqarS+fB+IEjdpbBsHD7Jq2bNHkSvTm9BBA=; b=AEMHXqGNLYlWXBsC5n/VMJ/qrKNAYLLXZDld7yv7VEmW9RmTTJ9ImehRyAMWgcHou09KDZeHxHcvoxzbrmtylT5DGLkZIRSecr1923G3mtBMFCev7TgNSYXdS+dRWcDOpDisTN8IrtdHVQjLid5AabytA6u63+iDkGRujrZtKcA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585316699538829.1858009586311; Fri, 27 Mar 2020 06:44:59 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-87-HBSKK65qOhaicbWJfyOGFA-1; Fri, 27 Mar 2020 09:44:56 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1BAB71088382; Fri, 27 Mar 2020 13:44:50 +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 E91C55DA89; Fri, 27 Mar 2020 13:44:49 +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 792FB1803C43; Fri, 27 Mar 2020 13:44:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiNbZ006336 for ; Fri, 27 Mar 2020 09:44:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 47F58CDBE1; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 162D3A0A98 for ; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id DE1C718D193; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316698; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=OvvmQrVjOqarS+fB+IEjdpbBsHD7Jq2bNHkSvTm9BBA=; b=LsXJOk3UFf6aNBFrpaz+jhweK/3H/J/ZoZ8F/mvQApow5PFl8Zem/K8P61y8T7dU3FQi9a eypHLLHgu97JnCsCfSiKP1FHyP0MYpiiPQ7htZGMdsmcBdRt5t7v99Wgnlpq2RLxNSwI2N yNujZcKskIvi7iFlffTMIKktsSmtx3E= X-MC-Unique: HBSKK65qOhaicbWJfyOGFA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 11/39] cpu_x86: Use g_auto* in x86ModelFromCPU Date: Fri, 27 Mar 2020 14:43:40 +0100 Message-Id: <993736712c5124dd65e80e8ad36251b77f73b7aa.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index d2bbcbd891..9455fd1440 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1173,7 +1173,7 @@ x86ModelFromCPU(const virCPUDef *cpu, virCPUx86MapPtr map, int policy) { - virCPUx86ModelPtr model =3D NULL; + g_autoptr(virCPUx86Model) model =3D NULL; size_t i; =20 /* host CPU only contains required features; requesting other features @@ -1216,7 +1216,7 @@ x86ModelFromCPU(const virCPUDef *cpu, if (!(feature =3D x86FeatureFind(map, cpu->features[i].name))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown CPU feature %s"), cpu->features[i].n= ame); - goto error; + return NULL; } =20 if (policy =3D=3D -1) { @@ -1224,7 +1224,7 @@ x86ModelFromCPU(const virCPUDef *cpu, case VIR_CPU_FEATURE_FORCE: case VIR_CPU_FEATURE_REQUIRE: if (x86DataAdd(&model->data, &feature->data) < 0) - goto error; + return NULL; break; =20 case VIR_CPU_FEATURE_DISABLE: @@ -1238,15 +1238,11 @@ x86ModelFromCPU(const virCPUDef *cpu, break; } } else if (x86DataAdd(&model->data, &feature->data) < 0) { - goto error; + return NULL; } } =20 - return model; - - error: - x86ModelFree(model); - return NULL; + return g_steal_pointer(&model); } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316694; cv=none; d=zohomail.com; s=zohoarc; b=NXAfICN4icQYuMsyt8k6yso3P6MKrutTCphg9hP5vlcBYyl8GhWV8iOwlCS4d63IQeO/r/8H2/E87vSuGD9/WsfaQSgttthXmc5tw8fDVrJ3Q2mrQ6FzXO14cEz8Z3ws/SBvS8BCBatK7G9G0eRtdfHTX69mDHBKELKJEdar5q4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316694; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gAOGYYpUNLXrV1rFTvigXXvAcrurDVHA7j7EjdU2HpQ=; b=LIOKeZ1CkLJ7CjDz0cv/2Vf9GDx4XZber89hDFjsj/daSdoaqK0bMpwjSyko9rPZJMZAAXvKb332ZyvFvv7UWNYuYQca5MtYcwVUT79uk2YYiXdNitRFChMCLOiCxM0ZhuGJtcceb0asbI2cGRGDQYRXQ9QlHmnAhQK6yNkCOjk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316694799172.5128500940806; Fri, 27 Mar 2020 06:44:54 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-286-CjALv-hrMvSD_GH22Q0mkA-1; Fri, 27 Mar 2020 09:44:51 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 21CEA1005516; Fri, 27 Mar 2020 13:44:43 +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 E09435C298; Fri, 27 Mar 2020 13:44:42 +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 757838A057; Fri, 27 Mar 2020 13:44:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiKwF006298 for ; Fri, 27 Mar 2020 09:44:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id C22F019925; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9453E19756 for ; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id E12C518D1B1; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316693; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=gAOGYYpUNLXrV1rFTvigXXvAcrurDVHA7j7EjdU2HpQ=; b=R7R37FR0E4qTw1cm/ITox0iraQksR31vcomBmOzpleznN1sx+3ZhAgugRjl3aDKq2S9Mxw BNqF/Ep/0nVdcuosnjTep7E2XhOpbM4GbclQ8A3tjq7jz8uBDJPjptfSAiyU0ikHQsM7SC N+ZhpbQZojqC4OWvt2b9jHsneOe5h08= X-MC-Unique: CjALv-hrMvSD_GH22Q0mkA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 12/39] cpu_x86: Use g_auto* in x86ModelParse Date: Fri, 27 Mar 2020 14:43:41 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 9455fd1440..fc94c029e4 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1493,41 +1493,36 @@ x86ModelParse(xmlXPathContextPtr ctxt, void *data) { virCPUx86MapPtr map =3D data; - virCPUx86ModelPtr model =3D NULL; - int ret =3D -1; + g_autoptr(virCPUx86Model) model =3D NULL; =20 if (x86ModelFind(map, name)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Multiple definitions of CPU model '%s'"), name); - goto cleanup; + return -1; } =20 model =3D g_new0(virCPUx86Model, 1); model->name =3D g_strdup(name); =20 if (x86ModelParseDecode(model, ctxt) < 0) - goto cleanup; + return -1; =20 if (x86ModelParseAncestor(model, ctxt, map) < 0) - goto cleanup; + return -1; =20 if (x86ModelParseSignatures(model, ctxt) < 0) - goto cleanup; + return -1; =20 if (x86ModelParseVendor(model, ctxt, map) < 0) - goto cleanup; + return -1; =20 if (x86ModelParseFeatures(model, ctxt, map) < 0) - goto cleanup; + return -1; =20 if (VIR_APPEND_ELEMENT(map->models, map->nmodels, model) < 0) - goto cleanup; - - ret =3D 0; + return -1; =20 - cleanup: - x86ModelFree(model); - return ret; + return 0; } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316699; cv=none; d=zohomail.com; s=zohoarc; b=cnoGpKPfuhUsT7GLiDZoFr0PkvJxJJi2Nbdt7TJWib5ZsOeEbLFb452E0RmqyQmd9A/pPw6QYA/FPtXG8KviirjezPnmSBtb4L8pOuWVOwF/reSDE2BGjIYfA9M0s1iU9L2dvn37fVF1Gq2l8w+h1ErOFYuMOJgkxBb+3vS58Ro= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316699; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aA25cM3LzJIQiI+/H+bwgQN2X26kKfiG3n+LYBWItdQ=; b=j2dqe3VJMj9herEVkwYP02zxk0VJ67VMrskobFaOuNVhwtd4yX5b2PVlvWM7ItzEfblu7LbJNYzomQrnScZ7gudlkVQh429AGYPMjipAZICRqDAl+wTopwDV0NgwCm/wRRp7Ub3UuG0yhcQkPLFxlBeZj2SbDTOxo/nqsfBuWQU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316699558314.0942167705157; Fri, 27 Mar 2020 06:44:59 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-242-zz-rc_i4NUqb9xhuVIx3yQ-1; Fri, 27 Mar 2020 09:44:56 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B2F781088383; Fri, 27 Mar 2020 13:44:50 +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 80FB63A0; Fri, 27 Mar 2020 13:44:50 +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 28C469428F; Fri, 27 Mar 2020 13:44:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiNDF006357 for ; Fri, 27 Mar 2020 09:44:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5D1865C1BA; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2DC6996FA4 for ; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id E485F18D4A8; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316698; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aA25cM3LzJIQiI+/H+bwgQN2X26kKfiG3n+LYBWItdQ=; b=DNBz8OtsAehIbPxaDp7Hkt7xlpa3536emiWKa4DnZNfps523kHPXSTZpES1S72Gwlo3nxZ CVBbFIzmmWwI+emVjE4cHe5Any9Z0jj7vuKlP8ajRsy5i7gKVIaNaAbl6J627qK81pREr2 cOa1VBhb4uc1HJXJhOtkgoHIeQKkaF4= X-MC-Unique: zz-rc_i4NUqb9xhuVIx3yQ-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 13/39] cpu_x86: Use g_auto* in virCPUx86LoadMap Date: Fri, 27 Mar 2020 14:43:42 +0100 Message-Id: <43ec7702a6f3f7424b33d78612ad1404b2f5c8b1.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index fc94c029e4..ba269df66d 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1559,18 +1559,14 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Map, x86MapF= ree); static virCPUx86MapPtr virCPUx86LoadMap(void) { - virCPUx86MapPtr map; + g_autoptr(virCPUx86Map) map =3D NULL; =20 map =3D g_new0(virCPUx86Map, 1); =20 if (cpuMapLoad("x86", x86VendorParse, x86FeatureParse, x86ModelParse, = map) < 0) - goto error; - - return map; + return NULL; =20 - error: - x86MapFree(map); - return NULL; + return g_steal_pointer(&map); } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316900; cv=none; d=zohomail.com; s=zohoarc; b=cYa8YiQP7yywwdhthnJ5jwd7eeK9UrxhkrlDdPrDQW05SsWOaNEmKkrhyBWGxwNM77qqp2LAz7kTrkQUuvKykaHaRPTHhGcoziJxJlajaD2dnRHnZIvGg1ZOHo238dlX9AqEs9A0GHSbg9NZY8gKUOqnPdA+iWEaDZ83/E8+6Rs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316900; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CxpLTXyG8C6CSt0M2N1m3citRphfqRUx7dy9g/p3NZg=; b=Y8OeqQC6MvayPiKpzLohddPJq238njSCYC/2zsRx0Ba7/e0ARL83WQI2XvcQKccei/XGhsrftfNqy1HAIOO+ph/+yV+ZxaCtz+sumq8VpGIygW8QCtfxlYAWll1Pgoh/kOnue+OBRtDRGVQc/6e0eW7jwgrdzWnzTwGxvN//p6U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585316900726219.14693896352878; Fri, 27 Mar 2020 06:48:20 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-269-9zaRXvYdOBqpPO11nmxOxA-1; Fri, 27 Mar 2020 09:45:07 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 90390149C3; Fri, 27 Mar 2020 13:44:57 +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 667F35C3FA; Fri, 27 Mar 2020 13:44:57 +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 1B68218034FA; Fri, 27 Mar 2020 13:44:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiNRf006339 for ; Fri, 27 Mar 2020 09:44:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4E7375DA75; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C70C5DA2C for ; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id E721618D5A9; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316899; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=CxpLTXyG8C6CSt0M2N1m3citRphfqRUx7dy9g/p3NZg=; b=iYsZYk7JHOX82cFXQyBqqpTdhfSqDgq3TRTx2b7Ciy4coxkf6Tj1ApSEx1Q7TkUvHi5LGD as01Fp3Cd6yETfMszise+qoJFdGUSMFAA86/gEGsW9b3qH4kpT3oKiVMG5x0smROG6zmF4 PRSwz3Q/0Aky2Xkx0E+qiF2UgdLI1V0= X-MC-Unique: 9zaRXvYdOBqpPO11nmxOxA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 14/39] cpu_x86: Use g_auto* in virCPUx86DataParse Date: Fri, 27 Mar 2020 14:43:43 +0100 Message-Id: <486aca441933d1ab2fb5a6fe5bc3159e10d2a5aa.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ba269df66d..6c3f9fc0be 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1636,8 +1636,8 @@ virCPUx86DataFormat(const virCPUData *data) static virCPUDataPtr virCPUx86DataParse(xmlXPathContextPtr ctxt) { - xmlNodePtr *nodes =3D NULL; - virCPUDataPtr cpuData =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; + g_autoptr(virCPUData) cpuData =3D NULL; virCPUx86DataItem item; size_t i; int n; @@ -1646,11 +1646,11 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt) if (n <=3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no x86 CPU data found")); - goto error; + return NULL; } =20 if (!(cpuData =3D virCPUDataNew(VIR_ARCH_X86_64))) - goto error; + return NULL; =20 for (i =3D 0; i < n; i++) { ctxt->node =3D nodes[i]; @@ -1658,28 +1658,21 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt) if (x86ParseCPUID(ctxt, &item) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to parse cpuid[%zu]"), i); - goto error; + return NULL; } } else { if (x86ParseMSR(ctxt, &item) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to parse msr[%zu]"), i); - goto error; + return NULL; } } =20 if (virCPUx86DataAdd(cpuData, &item) < 0) - goto error; + return NULL; } =20 - cleanup: - VIR_FREE(nodes); - return cpuData; - - error: - virCPUx86DataFree(cpuData); - cpuData =3D NULL; - goto cleanup; + return g_steal_pointer(&cpuData); } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316687; cv=none; d=zohomail.com; s=zohoarc; b=CfYFziXrnzBpULdTgnSGC6BgOjI19ArD3zFNJuW+glzWJ37GfZGOIsx0VmyZWKw3I4lNR1yf9Vf/v5Be8AM0Ukf/J1E+7UFdTE5qj0OcX8TIMXBUHJluOK9oa8tuox1T45ubeDisfsVNKejs3cBeUftlkZuAaOgDqoqrQIxUvgw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316687; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=g9xE7GUnUYdrz+tpK3lcdC2q5v4WzTUvO2+4G5W1G1Y=; b=W42flCyGdOah841foTpHeeR/PKyojYmcHl8NXYx6X/LD2GNsSq+c/oAhQqdFlvcAOB/qE9WEDqYxAWDJudmSQTT1vw+D/t9rJdH13QkyftPcaP07cU0Bdx375mLOFfAfV9BzsbrP2ncU5HJPdYXGTZIi1zbcfxWzdrP9ZDAl/Ug= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 15853166878571014.2445283735942; Fri, 27 Mar 2020 06:44:47 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-401-KyRP-jk6MbuDC2J_KAC17A-1; Fri, 27 Mar 2020 09:44:41 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D8DF61005514; Fri, 27 Mar 2020 13:44:35 +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 A7F7119757; Fri, 27 Mar 2020 13:44:35 +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 608278A056; Fri, 27 Mar 2020 13:44:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiMxm006320 for ; Fri, 27 Mar 2020 09:44:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 55A9F19925; Fri, 27 Mar 2020 13:44:22 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F1F1D19756 for ; Fri, 27 Mar 2020 13:44:21 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id EA19118D5AA; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316683; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=g9xE7GUnUYdrz+tpK3lcdC2q5v4WzTUvO2+4G5W1G1Y=; b=PfWOm8l3FMknqPLvG88c59rD581lAS4A0I8R8SRPGshhePTAFMG+QC+rLIqrJ3ZEsM84ba 3bSipgRN/5oMq61f2wYqHFljlqDJyk5p1wkvIB3fC1OTCBbPxZ6PcyXR561h7dYa7VBPb1 1WjXKHw1f1Ur8F32st1EyN3dWl0+Z/I= X-MC-Unique: KyRP-jk6MbuDC2J_KAC17A-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 15/39] cpu_x86: Use g_auto* in x86Compute Date: Fri, 27 Mar 2020 14:43:44 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 64 ++++++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 40 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 6c3f9fc0be..6758fcc170 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1689,13 +1689,12 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt) char *flagsStr =3D NULL; \ if (!(flagsStr =3D x86FeatureNames(map, ", ", (CPU_DEF)))) { \ virReportOOMError(); \ - goto error; \ + return VIR_CPU_COMPARE_ERROR; \ } \ if (message) \ *message =3D g_strdup_printf("%s: %s", _(MSG), flagsStr); \ VIR_DEBUG("%s: %s", MSG, flagsStr); \ VIR_FREE(flagsStr); \ - ret =3D VIR_CPU_COMPARE_INCOMPATIBLE; \ } while (0) =20 =20 @@ -1706,15 +1705,15 @@ x86Compute(virCPUDefPtr host, char **message) { virCPUx86MapPtr map =3D NULL; - virCPUx86ModelPtr host_model =3D NULL; - virCPUx86ModelPtr cpu_force =3D NULL; - virCPUx86ModelPtr cpu_require =3D NULL; - virCPUx86ModelPtr cpu_optional =3D NULL; - virCPUx86ModelPtr cpu_disable =3D NULL; - virCPUx86ModelPtr cpu_forbid =3D NULL; - virCPUx86ModelPtr diff =3D NULL; - virCPUx86ModelPtr guest_model =3D NULL; - virCPUDataPtr guestData =3D NULL; + g_autoptr(virCPUx86Model) host_model =3D NULL; + g_autoptr(virCPUx86Model) cpu_force =3D NULL; + g_autoptr(virCPUx86Model) cpu_require =3D NULL; + g_autoptr(virCPUx86Model) cpu_optional =3D NULL; + g_autoptr(virCPUx86Model) cpu_disable =3D NULL; + g_autoptr(virCPUx86Model) cpu_forbid =3D NULL; + g_autoptr(virCPUx86Model) diff =3D NULL; + g_autoptr(virCPUx86Model) guest_model =3D NULL; + g_autoptr(virCPUData) guestData =3D NULL; virCPUCompareResult ret; virCPUx86CompareResult result; virArch arch; @@ -1764,13 +1763,13 @@ x86Compute(virCPUDefPtr host, !(cpu_optional =3D x86ModelFromCPU(cpu, map, VIR_CPU_FEATURE_OPTIO= NAL)) || !(cpu_disable =3D x86ModelFromCPU(cpu, map, VIR_CPU_FEATURE_DISABL= E)) || !(cpu_forbid =3D x86ModelFromCPU(cpu, map, VIR_CPU_FEATURE_FORBID)= )) - goto error; + return VIR_CPU_COMPARE_ERROR; =20 x86DataIntersect(&cpu_forbid->data, &host_model->data); if (!x86DataIsEmpty(&cpu_forbid->data)) { virX86CpuIncompatible(N_("Host CPU provides forbidden features"), &cpu_forbid->data); - goto cleanup; + return VIR_CPU_COMPARE_INCOMPATIBLE; } =20 /* first remove features that were inherited from the CPU model and we= re @@ -1785,20 +1784,20 @@ x86Compute(virCPUDefPtr host, virX86CpuIncompatible(N_("Host CPU does not provide required " "features"), &cpu_require->data); - goto cleanup; + return VIR_CPU_COMPARE_INCOMPATIBLE; } =20 - ret =3D VIR_CPU_COMPARE_IDENTICAL; - if (!(diff =3D x86ModelCopy(host_model))) - goto error; + return VIR_CPU_COMPARE_ERROR; =20 x86DataSubtract(&diff->data, &cpu_optional->data); x86DataSubtract(&diff->data, &cpu_require->data); x86DataSubtract(&diff->data, &cpu_disable->data); x86DataSubtract(&diff->data, &cpu_force->data); =20 - if (!x86DataIsEmpty(&diff->data)) + if (x86DataIsEmpty(&diff->data)) + ret =3D VIR_CPU_COMPARE_IDENTICAL; + else ret =3D VIR_CPU_COMPARE_SUPERSET; =20 if (ret =3D=3D VIR_CPU_COMPARE_SUPERSET @@ -1807,54 +1806,39 @@ x86Compute(virCPUDefPtr host, virX86CpuIncompatible(N_("Host CPU does not strictly match guest C= PU: " "Extra features"), &diff->data); - goto cleanup; + return VIR_CPU_COMPARE_INCOMPATIBLE; } =20 if (guest) { if (!(guest_model =3D x86ModelCopy(host_model))) - goto error; + return VIR_CPU_COMPARE_ERROR; =20 if (cpu->vendor && host_model->vendor && virCPUx86DataAddItem(&guest_model->data, &host_model->vendor->data) < 0) - goto error; + return VIR_CPU_COMPARE_ERROR; =20 if (host_model->signatures && x86DataAddSignature(&guest_model->data, *host_model->signature= s) < 0) - goto error; + return VIR_CPU_COMPARE_ERROR; =20 if (cpu->type =3D=3D VIR_CPU_TYPE_GUEST && cpu->match =3D=3D VIR_CPU_MATCH_EXACT) x86DataSubtract(&guest_model->data, &diff->data); =20 if (x86DataAdd(&guest_model->data, &cpu_force->data)) - goto error; + return VIR_CPU_COMPARE_ERROR; =20 x86DataSubtract(&guest_model->data, &cpu_disable->data); =20 if (!(guestData =3D virCPUDataNew(arch))) - goto error; + return VIR_CPU_COMPARE_ERROR; x86DataCopy(&guestData->data.x86, &guest_model->data); =20 - *guest =3D guestData; + *guest =3D g_steal_pointer(&guestData); } =20 - cleanup: - x86ModelFree(host_model); - x86ModelFree(diff); - x86ModelFree(cpu_force); - x86ModelFree(cpu_require); - x86ModelFree(cpu_optional); - x86ModelFree(cpu_disable); - x86ModelFree(cpu_forbid); - x86ModelFree(guest_model); - return ret; - - error: - virCPUx86DataFree(guestData); - ret =3D VIR_CPU_COMPARE_ERROR; - goto cleanup; } #undef virX86CpuIncompatible =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316697; cv=none; d=zohomail.com; s=zohoarc; b=A5pumWWBT8E9xHRdCmW3HDAMnPKWnInUEv2QMCbEpe6ZH9+m1TCWUDvv7H9lwvLYSNDla5sJdLuESmu/Ok6nkjDcTOsq5Pex0rjg/sj2yjZbEWfcQlkzv4tT/N6EDA0oCDfXgiiB+/dv4/3daLVv+YVbS46DZk3o4PvV2hBrcgE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316697; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aMiooGJ+2sjhLn/TJVx2p4qFhmWCeRM6MSFIKZD3NCU=; b=PLqAmSJxjCMMlEG+wD4WFDpbccVIBglB9Sa37Yz/TiyEtxom24jdah6uv8aucLAICnyqJorFrC9WWgfQLo0eWvHVS7XA0U8TujOrBYm+ea6SqKvhuwbTyXT7d10YjpB2KWeFeYYeS7FiAKL5igtQK4qMM8jMK0+GxVi+K+CKkMM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316697363967.2084796600277; Fri, 27 Mar 2020 06:44:57 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-318-jdtITHgUPXKPsbK488JgAw-1; Fri, 27 Mar 2020 09:44:51 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2B099149C1; Fri, 27 Mar 2020 13:44:46 +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 028525DA85; Fri, 27 Mar 2020 13:44:46 +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 A7A928A057; Fri, 27 Mar 2020 13:44:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiMOh006315 for ; Fri, 27 Mar 2020 09:44:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2B9EC19757; Fri, 27 Mar 2020 13:44:22 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F0ED819925 for ; Fri, 27 Mar 2020 13:44:21 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id ED14018D5AB; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316694; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aMiooGJ+2sjhLn/TJVx2p4qFhmWCeRM6MSFIKZD3NCU=; b=W75bYpki7DiboeEqHgxdSRWWWBCIndtCu+yUVnbs+lFmiCPAWXw/VkpBVf/RzYn+aSSQHp u8RppzmNG600/0elsKbGiIqxauVhXClgXxS0qM5D08xsLm8EsoqoLq85rF74OIyEfP6g1A fD7aS3ynqYwWNsTpMD3xenXESYyWFEg= X-MC-Unique: jdtITHgUPXKPsbK488JgAw-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 16/39] cpu_x86: Use g_auto* in virCPUx86Compare Date: Fri, 27 Mar 2020 14:43:45 +0100 Message-Id: <270840e44357428aac8694a1a5ef74c4a4fe471c.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 6758fcc170..e4e21fbed4 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1848,34 +1848,31 @@ virCPUx86Compare(virCPUDefPtr host, virCPUDefPtr cpu, bool failIncompatible) { - virCPUCompareResult ret =3D VIR_CPU_COMPARE_ERROR; - virCPUx86ModelPtr model =3D NULL; - char *message =3D NULL; + virCPUCompareResult ret; + g_autoptr(virCPUx86Model) model =3D NULL; + g_autofree char *message =3D NULL; =20 if (!host || !host->model) { if (failIncompatible) { virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", _("unknown host CPU")); - } else { - VIR_WARN("unknown host CPU"); - ret =3D VIR_CPU_COMPARE_INCOMPATIBLE; + return VIR_CPU_COMPARE_ERROR; } - goto cleanup; + + VIR_WARN("unknown host CPU"); + return VIR_CPU_COMPARE_INCOMPATIBLE; } =20 ret =3D x86Compute(host, cpu, NULL, &message); =20 if (ret =3D=3D VIR_CPU_COMPARE_INCOMPATIBLE && failIncompatible) { - ret =3D VIR_CPU_COMPARE_ERROR; if (message) virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message); else virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL); + return VIR_CPU_COMPARE_ERROR; } =20 - cleanup: - VIR_FREE(message); - x86ModelFree(model); return ret; } =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316689; cv=none; d=zohomail.com; s=zohoarc; b=easi5e8dva9gU3CSmJEeJKwdIT+cDf6gBCgvHhStSxj1S18iLzwgE07qjlue2bIQ8YLWxuTet9aUJeEURr8rR6su7Tps7KdDTaxO302wBQww+K3HCyRyf4FwZ07C/OgapNgUlsZFS29rs/Avsov5iqRiIr58cW7YJbbXs+d0nmg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316689; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ayWFIXYdjUOqSNClM2t8msdJdPR8CPdQdcZ/XY8TEjg=; b=cx/GSkaQJDxb5mqMMsuTTwxpdrv40DpLSAzkEqSB4vYe1C+juINz22FmmmnovliXAy9/la/bJKGlgfUVfZzvncfpkOZ7jxkdWVS4K0D89v6g5yQ8ppHEQ1IwnyQVr7i9vFgbV3A58pvCuhjwtlGEbWybXRhySnh2bNzRvqyaiPM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316689238535.6790629134225; Fri, 27 Mar 2020 06:44:49 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-466-ifzUlxdDN2uAzHa0M-2AlQ-1; Fri, 27 Mar 2020 09:44:45 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 854B4149CA; Fri, 27 Mar 2020 13:44:39 +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 5532D19756; Fri, 27 Mar 2020 13:44:39 +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 0B24D180880B; Fri, 27 Mar 2020 13:44:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiMdC006321 for ; Fri, 27 Mar 2020 09:44:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5C8BA5C1D6; Fri, 27 Mar 2020 13:44:22 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D08F5C1D4 for ; Fri, 27 Mar 2020 13:44:22 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id F01F418D5AC; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316688; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ayWFIXYdjUOqSNClM2t8msdJdPR8CPdQdcZ/XY8TEjg=; b=HwEvJDLiI2+LpKyd8ddZW7CmTyeqZ4nbBUfbSrjrUd7zSGyrffU0EQ0/pu7wckDF62V26O qXTf1iVvPxntQMQtfiJ77QuLrEQJW2yojG0IBzvr4DuLBmhDtyolpy4EnozOz8R+6OLYbw VKax4vVY4TdC6pHvfX5wcRYht/l2W9w= X-MC-Unique: ifzUlxdDN2uAzHa0M-2AlQ-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 17/39] cpu_x86: Use g_auto* in x86Decode Date: Fri, 27 Mar 2020 14:43:46 +0100 Message-Id: <2dd6937284fd953fbd7a0686ae4cb86758857270.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index e4e21fbed4..26d872622e 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2034,15 +2034,14 @@ x86Decode(virCPUDefPtr cpu, const char *preferred, bool migratable) { - int ret =3D -1; virCPUx86MapPtr map; virCPUx86ModelPtr candidate; virCPUDefPtr cpuCandidate; virCPUx86ModelPtr model =3D NULL; - virCPUDefPtr cpuModel =3D NULL; - virCPUx86Data data =3D VIR_CPU_X86_DATA_INIT; - virCPUx86Data copy =3D VIR_CPU_X86_DATA_INIT; - virCPUx86Data features =3D VIR_CPU_X86_DATA_INIT; + g_autoptr(virCPUDef) cpuModel =3D NULL; + g_auto(virCPUx86Data) data =3D VIR_CPU_X86_DATA_INIT; + g_auto(virCPUx86Data) copy =3D VIR_CPU_X86_DATA_INIT; + g_auto(virCPUx86Data) features =3D VIR_CPU_X86_DATA_INIT; virCPUx86VendorPtr vendor; virDomainCapsCPUModelPtr hvModel =3D NULL; g_autofree char *sigs =3D NULL; @@ -2056,7 +2055,7 @@ x86Decode(virCPUDefPtr cpu, x86DataCopy(&data, cpuData); =20 if (!(map =3D virCPUx86GetMap())) - goto cleanup; + return -1; =20 vendor =3D x86DataToVendor(&data, map); signature =3D x86DataToSignature(&data); @@ -2075,7 +2074,7 @@ x86Decode(virCPUDefPtr cpu, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("CPU model %s is not supported by hyp= ervisor"), preferred); - goto cleanup; + return -1; } else { VIR_WARN("Preferred CPU model %s not allowed by" " hypervisor; closest supported model will be" @@ -2098,7 +2097,7 @@ x86Decode(virCPUDefPtr cpu, } =20 if (!(cpuCandidate =3D x86DataToCPU(&data, candidate, map, hvModel= ))) - goto cleanup; + return -1; cpuCandidate->type =3D cpu->type; =20 if ((rc =3D x86DecodeUseCandidate(model, cpuModel, @@ -2117,7 +2116,7 @@ x86Decode(virCPUDefPtr cpu, if (!cpuModel) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot find suitable CPU model for given d= ata")); - goto cleanup; + return -1; } =20 /* Remove non-migratable features if requested @@ -2151,14 +2150,7 @@ x86Decode(virCPUDefPtr cpu, cpu->nfeatures_max =3D cpuModel->nfeatures_max; cpuModel->nfeatures_max =3D 0; =20 - ret =3D 0; - - cleanup: - virCPUDefFree(cpuModel); - virCPUx86DataClear(&data); - virCPUx86DataClear(©); - virCPUx86DataClear(&features); - return ret; + return 0; } =20 static int --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316692; cv=none; d=zohomail.com; s=zohoarc; b=KBXqElH8q72hjgoyKLMY4uWYRcGeMpUwYMmo3t0dsDCo3BkCHBupJ96YuHtXU+GyCoRQjf5Qi51gKikzbu2G6oGFA4LQZb+K0fgQYHhr4/xDWuhUW36XiHZoDZdbFL+vLEZAX9QdNZHXVt19ooU+ahF59ZUbCuL41vVFmnt2h7I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316692; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pRU+6pz8C0v6hNN8cwzs6+SAvQn6W+hvICKrEK2i6Kk=; b=ZK7v03nEefKfM5haX7/b1QCZ6VbEdUpVH1diSgGbMqAU+lU1cnhzoGO5Ud8/eduk/76fo+pf12U9b56MRDrHGZ+qfarhevpuQgJxWOM9S7ownEzQleFuUen+8ZeLxjUsnuaSyIknzdnYQ4wtvbpwG290MyUXZmqoLbihr4tN91Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316692222307.64683201499645; Fri, 27 Mar 2020 06:44:52 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-352-XgzRxkkqOMCEaiKvvI4fqg-1; Fri, 27 Mar 2020 09:44:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 35B931B18BC9; Fri, 27 Mar 2020 13:44:43 +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 05A655C28D; Fri, 27 Mar 2020 13:44:43 +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 916BF8A055; Fri, 27 Mar 2020 13:44:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiNFc006335 for ; Fri, 27 Mar 2020 09:44:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 45A37CDBE8; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 167BCCDBE1 for ; Fri, 27 Mar 2020 13:44:22 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id F338918D5AD; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316691; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=pRU+6pz8C0v6hNN8cwzs6+SAvQn6W+hvICKrEK2i6Kk=; b=h3uke3bEv2+WM9gk2ZfAFKsc1i4xfVkh4RngTBSnJEVY6HObeMGePHcyvG4FUhZVyleF+J O6zaZWD3VGYIzD5Iu3C6eTNAZea1NHNknibhEeNAocm+xiRt21EMKxSOFT+vMLhekUyC7F tXCVncDSkvnw+XtBXm9r26kXOmnqJVU= X-MC-Unique: XgzRxkkqOMCEaiKvvI4fqg-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 18/39] cpu_x86: Use g_auto* in x86EncodePolicy Date: Fri, 27 Mar 2020 14:43:47 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 26d872622e..ce43da2bfa 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2168,7 +2168,7 @@ x86EncodePolicy(virCPUx86Data *data, virCPUx86MapPtr map, virCPUFeaturePolicy policy) { - virCPUx86ModelPtr model; + g_autoptr(virCPUx86Model) model =3D NULL; =20 if (!(model =3D x86ModelFromCPU(cpu, map, policy))) return -1; @@ -2176,7 +2176,6 @@ x86EncodePolicy(virCPUx86Data *data, *data =3D model->data; model->data.len =3D 0; model->data.items =3D NULL; - x86ModelFree(model); =20 return 0; } --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316763; cv=none; d=zohomail.com; s=zohoarc; b=ILhuIW1XTRDmmuOAiQkgdjO30CaXzOQLi2BbIOBhPF8jiWEJo9QuAp5/YahC69s322kW3B17o/ePTwI4iEvPMHD9/wJCgGy1xPPjA4yZaPn6l4JDSbCte1KUvAtasI/LlsET1ow0SE0qCmB4kH6zDVtuNDOpD06KAdQ4G7uOsrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316763; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kXgQKzdiK8kTzDrbUSu4igSxhcAjM+f/QbDO3wrTK6M=; b=L/Jo/oFN+oCbdPQ1+ohdQcnwZZbDnh3jqqV2XlMMGTK7IpasD+MXC9t7UKhF6MD7xK92lCho8nu5aCHRSBxPrhjcafd9zBduHd80FpIQshKaIjVR70Bpe7fWjx4lxWukGVq6e63oyYCpUd8hXXzE6Xt3LCzsaZy51TNixuvDV78= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316763680897.1601569753052; Fri, 27 Mar 2020 06:46:03 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-36-1_zfCkfIOB21QgqgAq8Egw-1; Fri, 27 Mar 2020 09:44:59 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D1CFA149C2; Fri, 27 Mar 2020 13:44:53 +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 A36C510027AC; Fri, 27 Mar 2020 13:44:53 +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 5720818034EF; Fri, 27 Mar 2020 13:44:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiNqp006337 for ; Fri, 27 Mar 2020 09:44:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4B4795DA87; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C9D45DA75 for ; Fri, 27 Mar 2020 13:44:22 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 0246918D5AE; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316762; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=kXgQKzdiK8kTzDrbUSu4igSxhcAjM+f/QbDO3wrTK6M=; b=NPt83Hn4LbKjq2uphr22edLlEpxX7L/GdNfkHWqrsrBSJLi1sQyPhAnAJZFEKFtGF6ZkFb pNDpCfcxSamSFm8ZjTBTlkwV61zjNQgvDLjN0BW4IqFytu9L4gPhc1Kz5hISIYBul+R6we Ob3lL4hesNPKezc62QPZXsqTPWjGm18= X-MC-Unique: 1_zfCkfIOB21QgqgAq8Egw-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 19/39] cpu_x86: Use g_auto* in x86Encode Date: Fri, 27 Mar 2020 14:43:48 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 51 +++++++++++++++++++---------------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ce43da2bfa..431fbd8ec6 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2192,12 +2192,12 @@ x86Encode(virArch arch, virCPUDataPtr *vendor) { virCPUx86MapPtr map =3D NULL; - virCPUDataPtr data_forced =3D NULL; - virCPUDataPtr data_required =3D NULL; - virCPUDataPtr data_optional =3D NULL; - virCPUDataPtr data_disabled =3D NULL; - virCPUDataPtr data_forbidden =3D NULL; - virCPUDataPtr data_vendor =3D NULL; + g_autoptr(virCPUData) data_forced =3D NULL; + g_autoptr(virCPUData) data_required =3D NULL; + g_autoptr(virCPUData) data_optional =3D NULL; + g_autoptr(virCPUData) data_disabled =3D NULL; + g_autoptr(virCPUData) data_forbidden =3D NULL; + g_autoptr(virCPUData) data_vendor =3D NULL; =20 if (forced) *forced =3D NULL; @@ -2213,37 +2213,37 @@ x86Encode(virArch arch, *vendor =3D NULL; =20 if (!(map =3D virCPUx86GetMap())) - goto error; + return -1; =20 if (forced && (!(data_forced =3D virCPUDataNew(arch)) || x86EncodePolicy(&data_forced->data.x86, cpu, map, VIR_CPU_FEATURE_FORCE) < 0)) - goto error; + return -1; =20 if (required && (!(data_required =3D virCPUDataNew(arch)) || x86EncodePolicy(&data_required->data.x86, cpu, map, VIR_CPU_FEATURE_REQUIRE) < 0)) - goto error; + return -1; =20 if (optional && (!(data_optional =3D virCPUDataNew(arch)) || x86EncodePolicy(&data_optional->data.x86, cpu, map, VIR_CPU_FEATURE_OPTIONAL) < 0)) - goto error; + return -1; =20 if (disabled && (!(data_disabled =3D virCPUDataNew(arch)) || x86EncodePolicy(&data_disabled->data.x86, cpu, map, VIR_CPU_FEATURE_DISABLE) < 0)) - goto error; + return -1; =20 if (forbidden && (!(data_forbidden =3D virCPUDataNew(arch)) || x86EncodePolicy(&data_forbidden->data.x86, cpu, map, VIR_CPU_FEATURE_FORBID) < 0)) - goto error; + return -1; =20 if (vendor) { virCPUx86VendorPtr v =3D NULL; @@ -2251,39 +2251,30 @@ x86Encode(virArch arch, if (cpu->vendor && !(v =3D x86VendorFind(map, cpu->vendor))) { virReportError(VIR_ERR_OPERATION_FAILED, _("CPU vendor %s not found"), cpu->vendor); - goto error; + return -1; } =20 if (!(data_vendor =3D virCPUDataNew(arch))) - goto error; + return -1; =20 if (v && virCPUx86DataAdd(data_vendor, &v->data) < 0) - goto error; + return -1; } =20 if (forced) - *forced =3D data_forced; + *forced =3D g_steal_pointer(&data_forced); if (required) - *required =3D data_required; + *required =3D g_steal_pointer(&data_required); if (optional) - *optional =3D data_optional; + *optional =3D g_steal_pointer(&data_optional); if (disabled) - *disabled =3D data_disabled; + *disabled =3D g_steal_pointer(&data_disabled); if (forbidden) - *forbidden =3D data_forbidden; + *forbidden =3D g_steal_pointer(&data_forbidden); if (vendor) - *vendor =3D data_vendor; + *vendor =3D g_steal_pointer(&data_vendor); =20 return 0; - - error: - virCPUx86DataFree(data_forced); - virCPUx86DataFree(data_required); - virCPUx86DataFree(data_optional); - virCPUx86DataFree(data_disabled); - virCPUx86DataFree(data_forbidden); - virCPUx86DataFree(data_vendor); - return -1; } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316766; cv=none; d=zohomail.com; s=zohoarc; b=Jx1vTi/1sTE09UVVjTVFibyuPy/4Rw8YTuGAWPeBZ/8Ny8i2ox0IJ9NqA2+lXgU/qhPjion6snNu8fOL8tirhl2f3U2pX5x1Z4TJ8X+QZBHWR6eQUQu2lYcCwFmkoUeqlbe3M8534g33iqemGaWV4MxnduPveDncY4aVTPsVRKc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316766; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=usASXfhvU+yQEus3qY7DjyihNoGKDH6i1/G4zTpWgg8=; b=lWoFgCW+5JUfLId9FbgwdbJ4ZlC3MVsrxGyjLN5Su8jn7idGPuJ52SzN1QcwEF+me0/NuCQ80sB8PFvBsw83XvQA9FYSwwtVGvKmP/J7ALg9FmEA0lqBKKqsHo+I6V+ewASvmFxJJevE6tu7rf3iZNG8fDLHWfWfK2Wy9gWx69U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585316766396688.1862677106575; Fri, 27 Mar 2020 06:46:06 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-236-OyoIbqLRMXy3xLCzm1Y0wA-1; Fri, 27 Mar 2020 09:44:52 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0158C800D4E; Fri, 27 Mar 2020 13:44:47 +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 CCF2062662; Fri, 27 Mar 2020 13:44:46 +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 8AD561803C37; Fri, 27 Mar 2020 13:44:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiNVR006343 for ; Fri, 27 Mar 2020 09:44:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 517E65DA84; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1D5EA5DA85 for ; Fri, 27 Mar 2020 13:44:22 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 04C3118D5AF; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316765; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=usASXfhvU+yQEus3qY7DjyihNoGKDH6i1/G4zTpWgg8=; b=FXoNAzrdeDc0AqfPeoYFaT/ftCL0Sxrz9NH4D2wNwSlP26g2sSzBC49sBsA26Hyaq/lECU xsysUg6YQrIErdURbywMT12QlKtaV6g31xsgNLVSPaYlibYAJUMCwAS4hUS8mWy3VgoXXG MDaf+l8YbdPRqZEIL8MwHEfGDgFy5xY= X-MC-Unique: OyoIbqLRMXy3xLCzm1Y0wA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 20/39] cpu_x86: Use g_auto* in virCPUx86CheckFeature Date: Fri, 27 Mar 2020 14:43:49 +0100 Message-Id: <5e6d979e8d601ab37d8d4bd5e667dec9e7b2da94.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 431fbd8ec6..3b3a428ecd 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2282,21 +2282,16 @@ static int virCPUx86CheckFeature(const virCPUDef *cpu, const char *name) { - int ret =3D -1; virCPUx86MapPtr map; - virCPUx86ModelPtr model =3D NULL; + g_autoptr(virCPUx86Model) model =3D NULL; =20 if (!(map =3D virCPUx86GetMap())) return -1; =20 if (!(model =3D x86ModelFromCPU(cpu, map, -1))) - goto cleanup; - - ret =3D x86FeatureInData(name, &model->data, map); + return -1; =20 - cleanup: - x86ModelFree(model); - return ret; + return x86FeatureInData(name, &model->data, map); } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316722; cv=none; d=zohomail.com; s=zohoarc; b=A6Sdx1y2o8KFD+zjJ3PCy8IiqPZ/cnz63eYxwgfAkhXr/2PFkxBpv97mpSJfRPym73XFriyDgTEkHLrpL6gW9MEIwwiFWUrxXNg1y/4frYC3Du2OtS6S3UOBLZ31sqoVHV3/h92UsoAzf0Zp2bqR50GHvFOnWXpUTnVV988NZZg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316722; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1RQQGPVJ+M/7qJSpm1iZMnxEjPVAw+MMe84XOgzD9+M=; b=MpPPB8GivXTytHKplJ2zsJ54VO6hs1ejKzRsOwiTlVyZePws/MIR2oHHoFLjbcYpU1inUeyOPKdAEnbHE9QjPS4Agqbi30OcmDjcjjeansdVa5t/XhyEJheU/OTcg6oYNkuBEzEG5MhbvMj+OMShEaizqmmG87nuyf2KAIFUy6Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585316722288462.16276774442485; Fri, 27 Mar 2020 06:45:22 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-415-szceZEGPMH6MsvjLiELIqQ-1; Fri, 27 Mar 2020 09:45:18 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0C61B149C0; Fri, 27 Mar 2020 13:45:13 +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 BDD475DA85; Fri, 27 Mar 2020 13:45:12 +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 11C3118033C7; Fri, 27 Mar 2020 13:45:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiNEn006390 for ; Fri, 27 Mar 2020 09:44:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id B9A037E303; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C1465C1BA for ; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 07AF918D5B0; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316721; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=1RQQGPVJ+M/7qJSpm1iZMnxEjPVAw+MMe84XOgzD9+M=; b=Z9S3+LnB46UUixg6FiMe3hkedDSSzInSTOFNCpCQxna26ONtCzraoW7/Rx5+iXnSIIml9B iCHYApAUDASfahiiRi5my3oWZXXWXn1ZXMJV3IH7XMD8zndA6VFc9JIHHLpXUJvB0kyO8E l20+CqaE/6DTAWmDfjY2HJoVgz2pZEk= X-MC-Unique: szceZEGPMH6MsvjLiELIqQ-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 21/39] cpu_x86: Use g_auto* in virCPUx86GetHost Date: Fri, 27 Mar 2020 14:43:50 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 3b3a428ecd..7bd19a1676 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2641,18 +2641,18 @@ static int virCPUx86GetHost(virCPUDefPtr cpu, virDomainCapsCPUModelsPtr models) { - virCPUDataPtr cpuData =3D NULL; - int ret =3D -1; + g_autoptr(virCPUData) cpuData =3D NULL; + int ret; =20 if (virCPUx86DriverInitialize() < 0) - goto cleanup; + return -1; =20 if (!(cpuData =3D virCPUDataNew(archs[0]))) - goto cleanup; + return -1; =20 if (cpuidSet(CPUX86_BASIC, cpuData) < 0 || cpuidSet(CPUX86_EXTENDED, cpuData) < 0) - goto cleanup; + return -1; =20 /* Read the IA32_ARCH_CAPABILITIES MSR (0x10a) if supported. * This is best effort since there might be no way to read the MSR @@ -2672,7 +2672,7 @@ virCPUx86GetHost(virCPUDefPtr cpu, }; =20 if (virCPUx86DataAdd(cpuData, &item) < 0) - goto cleanup; + return -1; } } =20 @@ -2688,8 +2688,6 @@ virCPUx86GetHost(virCPUDefPtr cpu, VIR_DEBUG("Host CPU does not support invariant TSC"); } =20 - cleanup: - virCPUx86DataFree(cpuData); return ret; } #endif --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316729; cv=none; d=zohomail.com; s=zohoarc; b=OE+GpvClExLmSM7tNa5Wf2/HRyYuiuGl+U8PDVS5pciTboW3LiOQ/oAzki+KjPrmnhJchrclSqOy3/z13CU5VsdTFDVI3ccG4kz+m5hX2v2MF8wUrOn7EovoaszHsBafnv9cuOQPXNRw7FVvKLzfCQO+z5kT1FgSQhZ77mnBphQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316729; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YkGExBvJfQ5qhuc8WQ/OYdoglp4KPVXNqd1UZ24P5tI=; b=cHp6B9IkKzN0f6M7p19vUVCOMDn5KYbVP459HAAsy+SUQyX2orw1E5Rpgvm6w0lyUTb4Veeu34LSGIP4ZgnH+SkZ6fGYY0kmb0ykK5fzT7PFHHUF9y85oMYN9KqRQQ+puVUriOu8yjAiP6gsyCOmoWWxt2zPKm1IcpgTiBtpcWA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316729365308.99380449446664; Fri, 27 Mar 2020 06:45:29 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-136-UfuPtLwiMf-RL3Ik5HE9yA-1; Fri, 27 Mar 2020 09:45:25 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3055C1088386; Fri, 27 Mar 2020 13:45:19 +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 ED2CE5C28D; Fri, 27 Mar 2020 13:45:18 +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 8048D180338F; Fri, 27 Mar 2020 13:45:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiNcS006395 for ; Fri, 27 Mar 2020 09:44:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id E619E3A0; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8F3B919925 for ; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 0AD7418D5B1; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316728; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=YkGExBvJfQ5qhuc8WQ/OYdoglp4KPVXNqd1UZ24P5tI=; b=CpAzOeuiFXkrk2c0Ja+C3w/6eEdRpG0DrIiUVQPpz+veauT5yUCn8eNx840XtC9d4jv8Cg gYPhfXNdyMEhZ+fsisYaSgOPVYUPKeMA34vE4KntZaGrpjuzZgmjNKsDVaAGG7wHQU5suB Nz7o8iXtpe++edwX0qoFVuYgUVsOMtI= X-MC-Unique: UfuPtLwiMf-RL3Ik5HE9yA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 22/39] cpu_x86: Use g_auto* in virCPUx86Baseline Date: Fri, 27 Mar 2020 14:43:51 +0100 Message-Id: <91d382cfe9d70533dadfab404fb971689688849e.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 46 +++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 7bd19a1676..ccbae3dabd 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2701,21 +2701,20 @@ virCPUx86Baseline(virCPUDefPtr *cpus, bool migratable) { virCPUx86MapPtr map =3D NULL; - virCPUx86ModelPtr base_model =3D NULL; - virCPUDefPtr cpu =3D NULL; + g_autoptr(virCPUx86Model) base_model =3D NULL; + g_autoptr(virCPUDef) cpu =3D NULL; size_t i; virCPUx86VendorPtr vendor =3D NULL; - virCPUx86ModelPtr model =3D NULL; bool outputVendor =3D true; const char *modelName; bool matchingNames =3D true; - virCPUDataPtr featData =3D NULL; + g_autoptr(virCPUData) featData =3D NULL; =20 if (!(map =3D virCPUx86GetMap())) - goto error; + return NULL; =20 if (!(base_model =3D x86ModelFromCPU(cpus[0], map, -1))) - goto error; + return NULL; =20 cpu =3D virCPUDefNew(); =20 @@ -2727,11 +2726,12 @@ virCPUx86Baseline(virCPUDefPtr *cpus, } else if (!(vendor =3D x86VendorFind(map, cpus[0]->vendor))) { virReportError(VIR_ERR_OPERATION_FAILED, _("Unknown CPU vendor %s"), cpus[0]->vendor); - goto error; + return NULL; } =20 modelName =3D cpus[0]->model; for (i =3D 1; i < ncpus; i++) { + g_autoptr(virCPUx86Model) model =3D NULL; const char *vn =3D NULL; =20 if (matchingNames && cpus[i]->model) { @@ -2744,14 +2744,14 @@ virCPUx86Baseline(virCPUDefPtr *cpus, } =20 if (!(model =3D x86ModelFromCPU(cpus[i], map, -1))) - goto error; + return NULL; =20 if (cpus[i]->vendor && model->vendor && STRNEQ(cpus[i]->vendor, model->vendor->name)) { virReportError(VIR_ERR_OPERATION_FAILED, _("CPU vendor %s of model %s differs from vendo= r %s"), model->vendor->name, model->name, cpus[i]->vend= or); - goto error; + return NULL; } =20 if (cpus[i]->vendor) { @@ -2767,30 +2767,28 @@ virCPUx86Baseline(virCPUDefPtr *cpus, if (!(vendor =3D x86VendorFind(map, vn))) { virReportError(VIR_ERR_OPERATION_FAILED, _("Unknown CPU vendor %s"), vn); - goto error; + return NULL; } } else if (STRNEQ(vendor->name, vn)) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("CPU vendors do not match")); - goto error; + return NULL; } } =20 x86DataIntersect(&base_model->data, &model->data); - x86ModelFree(model); - model =3D NULL; } =20 if (features) { virCPUx86FeaturePtr feat; =20 if (!(featData =3D virCPUDataNew(archs[0]))) - goto cleanup; + return NULL; =20 for (i =3D 0; features[i]; i++) { if ((feat =3D x86FeatureFind(map, features[i])) && x86DataAdd(&featData->data.x86, &feat->data) < 0) - goto cleanup; + return NULL; } =20 x86DataIntersect(&base_model->data, &featData->data.x86); @@ -2799,15 +2797,15 @@ virCPUx86Baseline(virCPUDefPtr *cpus, if (x86DataIsEmpty(&base_model->data)) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("CPUs are incompatible")); - goto error; + return NULL; } =20 if (vendor && virCPUx86DataAddItem(&base_model->data, &vendor->data) < 0) - goto error; + return NULL; =20 if (x86Decode(cpu, &base_model->data, models, modelName, migratable) <= 0) - goto error; + return NULL; =20 if (STREQ_NULLABLE(cpu->model, modelName)) cpu->fallback =3D VIR_CPU_FALLBACK_FORBID; @@ -2815,17 +2813,7 @@ virCPUx86Baseline(virCPUDefPtr *cpus, if (!outputVendor) VIR_FREE(cpu->vendor); =20 - cleanup: - x86ModelFree(base_model); - virCPUx86DataFree(featData); - - return cpu; - - error: - x86ModelFree(model); - virCPUDefFree(cpu); - cpu =3D NULL; - goto cleanup; + return g_steal_pointer(&cpu); } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316702; cv=none; d=zohomail.com; s=zohoarc; b=bD7es/yp42IKLl2+NjLNp4MNfoRsd5HW4JLiaX2d8Nwi9N4bacVRhOT3b0kxXqx6HbqyPl8qSE0uivopp8Xwp8Txvq/p3x4SWdTauTeo+A+ACbUKFdknqr55qttMAC5WNGJpn/KfBN2h6FamxVpxoN3D5AFTOwZyHazgIcQPOww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316702; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dxIRbniAtP+QxonVJrdnsWlOoj2fb5Trj8iIjCybkAM=; b=GnUtRkVoiRGIx4eMjlgQfeWvbMezoiMB+UZ0Sv0Q124w5oOMNan44AHHTXN7T3pG995N7S/0EDPjmhfofVW2WwfMLZNYdgV/NnpZtFpNTsXv8xVwYkLTYdItFx1yObfLdc6KVN7eXPWPM+tGPtLrYz9ACOduJsKIuBfxMSoeH2w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316702527739.1758918777771; Fri, 27 Mar 2020 06:45:02 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-34-g_kUwgDGMN6P9QZfvP_IAA-1; Fri, 27 Mar 2020 09:44:58 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 853768017CC; Fri, 27 Mar 2020 13:44:50 +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 580C960C87; Fri, 27 Mar 2020 13:44:50 +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 06E9718034EA; Fri, 27 Mar 2020 13:44:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiOex006415 for ; Fri, 27 Mar 2020 09:44:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 851CE5C1D8; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 579CA5C219 for ; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 0D91718D5B2; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316701; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=dxIRbniAtP+QxonVJrdnsWlOoj2fb5Trj8iIjCybkAM=; b=AhDdQZZwRNs6Vntpbq3WQeoeLyXnXxxJbiFLu1U4wL+gldcb7NgIEOCfY1QxP/wn0ulCr+ MHS7LJRSXlcpsvYILhVsiRH3u4kssH927UnnS5X9hEFnv6fIRV2XSrvjaMRRGEXSfvjHW5 HRl69FvzBNotwTGDGOQlPKoz/ztgDhk= X-MC-Unique: g_kUwgDGMN6P9QZfvP_IAA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 23/39] cpu_x86: Use g_auto* in x86UpdateHostModel Date: Fri, 27 Mar 2020 14:43:52 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ccbae3dabd..9f6027ec5c 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2821,17 +2821,16 @@ static int x86UpdateHostModel(virCPUDefPtr guest, const virCPUDef *host) { - virCPUDefPtr updated =3D NULL; + g_autoptr(virCPUDef) updated =3D NULL; size_t i; - int ret =3D -1; =20 if (!(updated =3D virCPUDefCopyWithoutModel(host))) - goto cleanup; + return -1; =20 updated->type =3D VIR_CPU_TYPE_GUEST; updated->mode =3D VIR_CPU_MODE_CUSTOM; if (virCPUDefCopyModel(updated, host, true) < 0) - goto cleanup; + return -1; =20 if (guest->vendor_id) { VIR_FREE(updated->vendor_id); @@ -2842,18 +2841,15 @@ x86UpdateHostModel(virCPUDefPtr guest, if (virCPUDefUpdateFeature(updated, guest->features[i].name, guest->features[i].policy) < 0) - goto cleanup; + return -1; } =20 virCPUDefStealModel(guest, updated, guest->mode =3D=3D VIR_CPU_MODE_CUSTOM); guest->mode =3D VIR_CPU_MODE_CUSTOM; guest->match =3D VIR_CPU_MATCH_EXACT; - ret =3D 0; =20 - cleanup: - virCPUDefFree(updated); - return ret; + return 0; } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316832; cv=none; d=zohomail.com; s=zohoarc; b=SKyzNleELr1HOUt79e5oTyASakXTwKBu/XWh/ZwXGIbeaYGjpf/zJmDl59fD8znApmHNN9k4Wwmqh8kunJR7rCbbsLnxed6dFeBrbDV8Y8KlC92/rO5ikyRre+XwpLHenEyELsrmV1qK0+vlVMeQIdHT48bwYa458wEF+0kCTFA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316832; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NrHxo5soyBTVN+7GMWjzVYFoD1/yH1+OEqn1XSrXhe8=; b=BI71sEMIwkSUVIHJ4JSmXc9MC0Za1bE+3kBBdFPbGFjh43T7uEO2CUhBIFy5rEtuSNAUHF5QE+9SWd6LwwDkUCsXJBnOZwvfuhDFAn/0bkXjG2lVHxEE32RZJY9nOM/yV8gIwjofTxbqtWnse9dqIy1ACOAReh1KhtpmLZBKaSs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316832470181.14532918498537; Fri, 27 Mar 2020 06:47:12 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-159-PvR3ZUPKPpCKC_Sfzb0RaQ-1; Fri, 27 Mar 2020 09:45:09 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 665F9107B275; Fri, 27 Mar 2020 13:45:03 +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 2065FCDBF2; Fri, 27 Mar 2020 13:45:03 +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 8C65E944AB; Fri, 27 Mar 2020 13:45:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiQPb006478 for ; Fri, 27 Mar 2020 09:44:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7620CA0A98; Fri, 27 Mar 2020 13:44:26 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 488AACDBE8 for ; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 101A018D5B3; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316831; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=NrHxo5soyBTVN+7GMWjzVYFoD1/yH1+OEqn1XSrXhe8=; b=PIOaSlzUr2FYfh4bBfmNmc5nZmifnRmqPBXOFeI5sJL/GJkcWplsJ+fGqsDoUj4TEID6pC uv9OAw88McpNTMZ3gKdCUnoOnjz72lk8QbIFRWau4jpLOUk1gexnaZbIR78NgYiZ65n50K 8iPfZQ9K+URL7AbLBbwixAy/XMv4zGw= X-MC-Unique: PvR3ZUPKPpCKC_Sfzb0RaQ-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 24/39] cpu_x86: Use g_auto* in virCPUx86Update Date: Fri, 27 Mar 2020 14:43:53 +0100 Message-Id: <0bc6ad3bd930420c570d6cc4c523be27f5bfd808.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 9f6027ec5c..8da8b3ada2 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2857,9 +2857,8 @@ static int virCPUx86Update(virCPUDefPtr guest, const virCPUDef *host) { - virCPUx86ModelPtr model =3D NULL; + g_autoptr(virCPUx86Model) model =3D NULL; virCPUx86MapPtr map; - int ret =3D -1; size_t i; =20 if (!host) { @@ -2872,14 +2871,14 @@ virCPUx86Update(virCPUDefPtr guest, return -1; =20 if (!(model =3D x86ModelFromCPU(host, map, -1))) - goto cleanup; + return -1; =20 for (i =3D 0; i < guest->nfeatures; i++) { if (guest->features[i].policy =3D=3D VIR_CPU_FEATURE_OPTIONAL) { int supported =3D x86FeatureInData(guest->features[i].name, &model->data, map); if (supported < 0) - goto cleanup; + return -1; else if (supported) guest->features[i].policy =3D VIR_CPU_FEATURE_REQUIRE; else @@ -2889,13 +2888,9 @@ virCPUx86Update(virCPUDefPtr guest, =20 if (guest->mode =3D=3D VIR_CPU_MODE_HOST_MODEL || guest->match =3D=3D VIR_CPU_MATCH_MINIMUM) - ret =3D x86UpdateHostModel(guest, host); - else - ret =3D 0; + return x86UpdateHostModel(guest, host); =20 - cleanup: - x86ModelFree(model); - return ret; + return 0; } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316733; cv=none; d=zohomail.com; s=zohoarc; b=HyzjJk2Mz7xQJJy+jbmnoV3CMpGUBNwLG4wcv7GGRAfDzd87WmURdXc81jfUX612/ZXelP4PjBnxxUZMilI44OTvp6wfsySLh1hxUaXKGGrnsWGgLVX8reQGwsaEH2MG4XvWqWZLyAnVp89vtiEwvHvAL4wSCaHZVl2+mXpHKk4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316733; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LXYNSpujIw5NXRYmqfn0xKcYP4p65iT7PEVxio1GWd0=; b=SC7dlLzdPE+6NXtaAaT3fwS2T11oyMLs6b7BzDRyrpKsAm2oWaAr9L3YyEryiSESY9j+g1O7FD/PO8JDtefxaJeshPGTihniKXr8+KqM7KjiRrU1df8oRD4LVvOEkQsVP7mtRI7CSXLK9vrj0ogP4f52DJgg55qh1iYo3w5CZYM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 15853167337181016.5391192856924; Fri, 27 Mar 2020 06:45:33 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-415-k2yyV4h5O_yaoR4t4jqSFw-1; Fri, 27 Mar 2020 09:45:30 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 96DFE149C6; Fri, 27 Mar 2020 13:45:24 +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 61CF59B922; Fri, 27 Mar 2020 13:45:24 +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 0212B18033B0; Fri, 27 Mar 2020 13:45:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiNwP006396 for ; Fri, 27 Mar 2020 09:44:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id EAF1E60BF4; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BD0E960BF3 for ; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 131BC18D5B4; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316732; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=LXYNSpujIw5NXRYmqfn0xKcYP4p65iT7PEVxio1GWd0=; b=gQ8KSrfgEOyBDNW8stHAvIf6BpM0MMym0JNIhrgN909a+8liCuqZYYBNEIBtgNziKLkPly oc+sZAcN0kZngVSjpeCrYPcHh+aLFPjpIpnbumICQvFfxBmGJmES7MJ4EQKtc+F1gcXev4 HuF8Ie1P7/OGsNMiQRXFsr6/i/9zrfc= X-MC-Unique: k2yyV4h5O_yaoR4t4jqSFw-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 25/39] cpu_x86: Use g_auto* in virCPUx86UpdateLive Date: Fri, 27 Mar 2020 14:43:54 +0100 Message-Id: <3f7c051ce1cad28d267925ac5adf41b021cfb0a5.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 8da8b3ada2..0be2cf517d 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2901,26 +2901,25 @@ virCPUx86UpdateLive(virCPUDefPtr cpu, { bool hostPassthrough =3D cpu->mode =3D=3D VIR_CPU_MODE_HOST_PASSTHROUG= H; virCPUx86MapPtr map; - virCPUx86ModelPtr model =3D NULL; - virCPUx86ModelPtr modelDisabled =3D NULL; - virCPUx86Data enabled =3D VIR_CPU_X86_DATA_INIT; - virCPUx86Data disabled =3D VIR_CPU_X86_DATA_INIT; - virBuffer bufAdded =3D VIR_BUFFER_INITIALIZER; - virBuffer bufRemoved =3D VIR_BUFFER_INITIALIZER; - char *added =3D NULL; - char *removed =3D NULL; + g_autoptr(virCPUx86Model) model =3D NULL; + g_autoptr(virCPUx86Model) modelDisabled =3D NULL; + g_auto(virCPUx86Data) enabled =3D VIR_CPU_X86_DATA_INIT; + g_auto(virCPUx86Data) disabled =3D VIR_CPU_X86_DATA_INIT; + g_auto(virBuffer) bufAdded =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) bufRemoved =3D VIR_BUFFER_INITIALIZER; + g_autofree char *added =3D NULL; + g_autofree char *removed =3D NULL; size_t i; - int ret =3D -1; =20 if (!(map =3D virCPUx86GetMap())) return -1; =20 if (!(model =3D x86ModelFromCPU(cpu, map, -1))) - goto cleanup; + return -1; =20 if (hostPassthrough && !(modelDisabled =3D x86ModelFromCPU(cpu, map, VIR_CPU_FEATURE_DISA= BLE))) - goto cleanup; + return -1; =20 if (dataEnabled) x86DataCopy(&enabled, &dataEnabled->data.x86); @@ -2945,7 +2944,7 @@ virCPUx86UpdateLive(virCPUDefPtr cpu, virBufferAsprintf(&bufAdded, "%s,", feature->name); else if (virCPUDefUpdateFeature(cpu, feature->name, VIR_CPU_FEATURE_REQUIRE) < 0) - goto cleanup; + return -1; } =20 if (x86DataIsSubset(&disabled, &feature->data) || @@ -2956,7 +2955,7 @@ virCPUx86UpdateLive(virCPUDefPtr cpu, virBufferAsprintf(&bufRemoved, "%s,", feature->name); else if (virCPUDefUpdateFeature(cpu, feature->name, VIR_CPU_FEATURE_DISABLE) < 0) - goto cleanup; + return -1; } } =20 @@ -2982,28 +2981,17 @@ virCPUx86UpdateLive(virCPUDefPtr cpu, _("guest CPU doesn't match specification: " "missing features: %s"), removed); - goto cleanup; + return -1; } =20 if (cpu->check =3D=3D VIR_CPU_CHECK_FULL && !x86DataIsEmpty(&disabled)) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("guest CPU doesn't match specification")); - goto cleanup; + return -1; } =20 - ret =3D 0; - - cleanup: - x86ModelFree(model); - x86ModelFree(modelDisabled); - virCPUx86DataClear(&enabled); - virCPUx86DataClear(&disabled); - VIR_FREE(added); - VIR_FREE(removed); - virBufferFreeAndReset(&bufAdded); - virBufferFreeAndReset(&bufRemoved); - return ret; + return 0; } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316739; cv=none; d=zohomail.com; s=zohoarc; b=EQOCue1TRxUUZvEI1D0FOPtPidj4LZ7B7JdG+fL8iSknX5Tc1FTyW1QEjRMR/UQFIGepU0kscmm86W0BB5dZ+rwujh4AzBCrbxQSARQzLHIBbuUgTlXRVbBvtRjyKf9NIzdErCASmRjnoH0FWZeTE2dXX33hnHtylYT6URU6OWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316739; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9w4Qed/dlPyJtiNTyDUr+7cfWlujIsI1gQUwKlNVpf0=; b=in1TH5GWIr/NhP14stghcdwmO4bvIcTnVQebEOEC/5xapz+kgP0hE1N9Sve2fJY3I4Ezu0/mhlfe0VNRRwXzKuuF9UvTTau0zncHg8fkA3lGAV0c3Ok+xcMZI531J3tIhrTWVr8gGGJuvTQXInQ0HI4GFiOFzKT5dvE0VjWVY9o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585316739657683.8245511722901; Fri, 27 Mar 2020 06:45:39 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-289-giThKjE7ObmFek2eZCYFZw-1; Fri, 27 Mar 2020 09:45:36 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 903451088389; Fri, 27 Mar 2020 13:45:29 +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 5B5455E03F; Fri, 27 Mar 2020 13:45:29 +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 027D81802225; Fri, 27 Mar 2020 13:45:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiNQ9006399 for ; Fri, 27 Mar 2020 09:44:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id EE54719925; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C0E3E19757 for ; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 162E818D5B5; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316738; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=9w4Qed/dlPyJtiNTyDUr+7cfWlujIsI1gQUwKlNVpf0=; b=U8ppb4fD6AYJxl3KmJkS1GxYP6pXsW/FMMHw27LKuu3AIqpedKCXKIM3ppa1n7WXA5GjPv osiy4LpwmNSMGk2L6TjO/YaCpOVPCxxoa9taBDshgHxGwSOIvrx1LPgbc6NHm2T+1nUUP0 xA3eHTvnsHoVMiqDbV1JI3iTtlORRic= X-MC-Unique: giThKjE7ObmFek2eZCYFZw-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 26/39] cpu_x86: Use g_auto* in virCPUx86Translate Date: Fri, 27 Mar 2020 14:43:55 +0100 Message-Id: <077ddc4c8d48b73b2f5ada8d2033ba0a5a922190.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 0be2cf517d..3f6d889722 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -3019,45 +3019,39 @@ static int virCPUx86Translate(virCPUDefPtr cpu, virDomainCapsCPUModelsPtr models) { - virCPUDefPtr translated =3D NULL; + g_autoptr(virCPUDef) translated =3D NULL; virCPUx86MapPtr map; - virCPUx86ModelPtr model =3D NULL; + g_autoptr(virCPUx86Model) model =3D NULL; size_t i; - int ret =3D -1; =20 if (!(map =3D virCPUx86GetMap())) - goto cleanup; + return -1; =20 if (!(model =3D x86ModelFromCPU(cpu, map, -1))) - goto cleanup; + return -1; =20 if (model->vendor && virCPUx86DataAddItem(&model->data, &model->vendor->data) < 0) - goto cleanup; + return -1; =20 if (model->signatures && x86DataAddSignature(&model->data, model->signatures[0]) < 0) - goto cleanup; + return -1; =20 if (!(translated =3D virCPUDefCopyWithoutModel(cpu))) - goto cleanup; + return -1; =20 if (x86Decode(translated, &model->data, models, NULL, false) < 0) - goto cleanup; + return -1; =20 for (i =3D 0; i < cpu->nfeatures; i++) { virCPUFeatureDefPtr f =3D cpu->features + i; if (virCPUDefUpdateFeature(translated, f->name, f->policy) < 0) - goto cleanup; + return -1; } =20 virCPUDefStealModel(cpu, translated, true); - ret =3D 0; - - cleanup: - virCPUDefFree(translated); - x86ModelFree(model); - return ret; + return 0; } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316800; cv=none; d=zohomail.com; s=zohoarc; b=fLNAa6XjYFJZVcHU9IBzbwWr+pHT8iBlXtTiyLsGrH1qk6v5n1h2GvyByNo6TXHE9jzISvzOwwF4v2jn9zJGWDq0d47B0HbJqJloOk8LGuYTZ1dn+/U3jc6WwV7gMnawGGO2QyGQtzhQTb4CVPnqSox/u510OnqTmPBc3+W6o4I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316800; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6nj42ZU2aI7S2LfyYRA8/uC6t+yNeHpt4ojaO5rwnoo=; b=EzGdxrhO7p7Z1eQBRQOHr0QlJNfmzF9oD+2v4b55f1GtkZNvHPoo+WPFbOybGqbq6bZQDBJFTRUG20TDMABYFWZwXAZkr1PvgtUSIEEL1/opAA4IdzrRk9GspXnLJ3tpbm8Juy+73NRg0NPjBZAYeRp//P74Lg8K5CL9piz7ido= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316800399772.0129919295205; Fri, 27 Mar 2020 06:46:40 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-494-2YcpHVRsO2q77_Z2O4schw-1; Fri, 27 Mar 2020 09:45:43 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F0904107B7D7; Fri, 27 Mar 2020 13:45:37 +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 C3710CDBE1; Fri, 27 Mar 2020 13:45: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 69EDD944CB; Fri, 27 Mar 2020 13:45:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiOXS006424 for ; Fri, 27 Mar 2020 09:44:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id DA864CDBE9; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A994ECDBE8 for ; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 18FC018F8B8; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316799; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=6nj42ZU2aI7S2LfyYRA8/uC6t+yNeHpt4ojaO5rwnoo=; b=NMek8gMmm9ube4ensJt5cbqP44cOQ81frq715yylLMMGdBV+LAm+Rv+Qnw69v6zdQlF0xs jQmAOJLQYW+MLL3EGyePKTcUjArBvQfP7qtKe+pWO1RhSyo7HGM5W+bM6s3YJkIMAWN7zo Qvk9j2TUzFqIGYQmpxx2k1AKFsXSSSs= X-MC-Unique: 2YcpHVRsO2q77_Z2O4schw-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 27/39] cpu_x86: Use g_auto* in virCPUx86ExpandFeatures Date: Fri, 27 Mar 2020 14:43:56 +0100 Message-Id: <7ecdf220f3ee3f2bfb7889af8a67bb36787e7fe6.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 3f6d889722..a65215caed 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -3059,30 +3059,29 @@ static int virCPUx86ExpandFeatures(virCPUDefPtr cpu) { virCPUx86MapPtr map; - virCPUDefPtr expanded =3D NULL; - virCPUx86ModelPtr model =3D NULL; + g_autoptr(virCPUDef) expanded =3D NULL; + g_autoptr(virCPUx86Model) model =3D NULL; bool host =3D cpu->type =3D=3D VIR_CPU_TYPE_HOST; size_t i; - int ret =3D -1; =20 if (!(map =3D virCPUx86GetMap())) - goto cleanup; + return -1; =20 if (!(expanded =3D virCPUDefCopy(cpu))) - goto cleanup; + return -1; =20 virCPUDefFreeFeatures(expanded); =20 if (!(model =3D x86ModelFind(map, cpu->model))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown CPU model %s"), cpu->model); - goto cleanup; + return -1; } =20 if (!(model =3D x86ModelCopy(model)) || x86DataToCPUFeatures(expanded, host ? -1 : VIR_CPU_FEATURE_REQUIRE, &model->data, map) < 0) - goto cleanup; + return -1; =20 for (i =3D 0; i < cpu->nfeatures; i++) { virCPUFeatureDefPtr f =3D cpu->features + i; @@ -3093,17 +3092,12 @@ virCPUx86ExpandFeatures(virCPUDefPtr cpu) continue; =20 if (virCPUDefUpdateFeature(expanded, f->name, f->policy) < 0) - goto cleanup; + return -1; } =20 virCPUDefFreeModel(cpu); =20 - ret =3D virCPUDefCopyModel(cpu, expanded, false); - - cleanup: - virCPUDefFree(expanded); - x86ModelFree(model); - return ret; + return virCPUDefCopyModel(cpu, expanded, false); } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316767; cv=none; d=zohomail.com; s=zohoarc; b=m5K2oS2GcuVjvnAz0/F/SiJzbVZHonfnaSxr1Plb64dX1713xAGncEnYjDWlQHmoXcQ/fub72BdNvyWmnkXDwQi9QEly+KDwYmhRudHcVcqTvIpz1LZITyO83ZkQkZoqJrKlPxvMp6JQz6Z2JqijMMJfGlPVefLEheuVy/S5YAo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316767; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+HCA0hiQQFI3e7MJ8bQy5+vGjezjynnUUktknS5LrmE=; b=cvbvmkS9yrYtzUwGApW7bArBzgIExdApVe4jfR1t6WgKwQsQmQ0vlrkaAZQkRAGsL8O/ftZpaYan4cYeTU2obFGrAE02QXW7RcmIKNgGKnoIe5F7/b4JMURS/o+QV7shAm77UJ87iOMCjsHcMmHzH1tC2Hdvejq6swltznisSv4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316767206103.42504220401668; Fri, 27 Mar 2020 06:46:07 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-247-y1jELW2fPPiR7lTjA7lr9w-1; Fri, 27 Mar 2020 09:45:00 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 54A701B18BC2; Fri, 27 Mar 2020 13:44:54 +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 2EAB5CDBE6; Fri, 27 Mar 2020 13:44:54 +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 D9FEB942B2; Fri, 27 Mar 2020 13:44:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiOHs006420 for ; Fri, 27 Mar 2020 09:44:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id D7E1D5DA84; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A99865DA75 for ; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 1BB2718F8B9; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316765; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=+HCA0hiQQFI3e7MJ8bQy5+vGjezjynnUUktknS5LrmE=; b=gVC1k9Ag5xiJ88Bgqc5KkZ71AXnVL+RTfrPTYC97BXex2MNYRA9BxiAOiNJzooFOdXvZT/ hrAN+jAUa3oLeuFY6sjjbGGxsYFajLdq9HZrKEllOCxANIQvzg3FEWx8m+t/joqlWmGeig PeB3jpEnjReLWqh2BOL7NIafDxu//f0= X-MC-Unique: y1jELW2fPPiR7lTjA7lr9w-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 28/39] cpu_x86: Use g_auto* in virCPUx86CopyMigratable Date: Fri, 27 Mar 2020 14:43:57 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index a65215caed..16e73b5b98 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -3113,7 +3113,7 @@ x86FeatureFilterMigratable(const char *name, static virCPUDefPtr virCPUx86CopyMigratable(virCPUDefPtr cpu) { - virCPUDefPtr copy; + g_autoptr(virCPUDef) copy =3D NULL; virCPUx86MapPtr map; =20 if (!(map =3D virCPUx86GetMap())) @@ -3124,13 +3124,9 @@ virCPUx86CopyMigratable(virCPUDefPtr cpu) =20 if (virCPUDefCopyModelFilter(copy, cpu, false, x86FeatureFilterMigratable, map) < 0) - goto error; - - return copy; + return NULL; =20 - error: - virCPUDefFree(copy); - return NULL; + return g_steal_pointer(©); } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316725; cv=none; d=zohomail.com; s=zohoarc; b=D2cAoGpSOWhKXvxdzyr5LPk5niMJHkEj/I7y7lH/g4to9GlNoJ4AC3nDi0SJbPiKBxs0L2uza3gNyFSOU22+oBzeq1kXJi2Ah8UTIX63+n/ivpmUv+vXE5SradQ1ZHHVH91ao97KTXG16Remzv/gPLU9rqYy0p2HWH2oS6Qdlr4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316725; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4W2+jY5ncw73XshEmfT6UFdAiU0a77neXnZ+dFYtChs=; b=BN8+VjcSi2Lz6Fv2Yw/yQ6j8zuruAqkfMnmpAn/+S1KssigXQvwBC5v1TODJPreUG79UUZ/IwuSR1bSXBwekXql6NCpFP5y/TcVv9BpjruymzyAMxkobsghUn6B/0vt55Ytch6JOYQdeOZ3cdMH2gn4j/rLbr5K9VLOrVD0+G2M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585316725680974.968802108281; Fri, 27 Mar 2020 06:45:25 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-199-setJw8xnP3aRDz26CeOd9A-1; Fri, 27 Mar 2020 09:45:22 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BF442107B281; Fri, 27 Mar 2020 13:45:15 +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 8A1A360C87; Fri, 27 Mar 2020 13:45: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 08E08944C2; Fri, 27 Mar 2020 13:45:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiRiP006492 for ; Fri, 27 Mar 2020 09:44:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 11BCB5C219; Fri, 27 Mar 2020 13:44:27 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D7A315C1D8 for ; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 1ED7218F8BA; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316724; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=4W2+jY5ncw73XshEmfT6UFdAiU0a77neXnZ+dFYtChs=; b=ZyIh31w8vxx+xzBk0SVwAh77XFxVDQR3a53XP7KRMzXV5DNS1ABnVpRWPinH1a06Al7BfX LW7OKs5WtOVPsJhqC8e2249CZtPJRqcvA20wjZlJBsyZpUPn2YcOXx5j70jbSLgieLeZgu w7jXYU1m6gzNv2jw1zjKfPRbatJSdD4= X-MC-Unique: setJw8xnP3aRDz26CeOd9A-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 29/39] cpu_x86: Move and rename x86ModelCopySignatures Date: Fri, 27 Mar 2020 14:43:58 +0100 Message-Id: <6828d8ead3cd85e47b3a3df62ccbfb1fe50ee553.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Later in this series the function will work on a newly introduced virCPUx86Signatures structure. Let's move it to the place were all related functions will be added and rename the function as virCPUx86SignaturesCopy for easier review of the virCPUx86Signatures patch. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 16e73b5b98..4b6eaf8060 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1090,23 +1090,9 @@ x86FeatureParse(xmlXPathContextPtr ctxt, } =20 =20 -static void -x86ModelFree(virCPUx86ModelPtr model) -{ - if (!model) - return; - - g_free(model->name); - g_free(model->signatures); - virCPUx86DataClear(&model->data); - g_free(model); -} -G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Model, x86ModelFree); - - static int -x86ModelCopySignatures(virCPUx86ModelPtr dst, - virCPUx86ModelPtr src) +virCPUx86SignaturesCopy(virCPUx86ModelPtr dst, + virCPUx86ModelPtr src) { size_t i; =20 @@ -1124,6 +1110,20 @@ x86ModelCopySignatures(virCPUx86ModelPtr dst, } =20 =20 +static void +x86ModelFree(virCPUx86ModelPtr model) +{ + if (!model) + return; + + g_free(model->name); + g_free(model->signatures); + virCPUx86DataClear(&model->data); + g_free(model); +} +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Model, x86ModelFree); + + static virCPUx86ModelPtr x86ModelCopy(virCPUx86ModelPtr model) { @@ -1132,7 +1132,7 @@ x86ModelCopy(virCPUx86ModelPtr model) copy =3D g_new0(virCPUx86Model, 1); copy->name =3D g_strdup(model->name); =20 - if (x86ModelCopySignatures(copy, model) < 0) { + if (virCPUx86SignaturesCopy(copy, model) < 0) { x86ModelFree(copy); return NULL; } @@ -1360,7 +1360,7 @@ x86ModelParseAncestor(virCPUx86ModelPtr model, } =20 model->vendor =3D ancestor->vendor; - if (x86ModelCopySignatures(model, ancestor) < 0) + if (virCPUx86SignaturesCopy(model, ancestor) < 0) return -1; =20 x86DataCopy(&model->data, &ancestor->data); --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316886; cv=none; d=zohomail.com; s=zohoarc; b=SnI8u5jMkC4mooMosm+DX3jEXhzlFLK7Bx2yLBD/xkzgSv8JIDhyiO4aQ5AKJEdWKQ8aX5ua6CQWLKeb8mJ70RqBlHHEv1gue63EiUiGUukK1T/odHEFmAzdiqTu5kkL18/AJSlgYMUm8i+0JiULS4E/Du0fGvVJdz7gn9wWmwY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316886; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pVTvrnGGrKJa1R1EnT9UJrTHDeZUzyY8LQEeq+u3uNw=; b=Pw2vFyGcWmRdojHeuKcaIiSMwupolqZc34ABquLmcOMeE/U9IahV9MkIRMtN14XY0APSIjd4vZBEljJlg/P+VywCfFAcYz8Uy0aPEylGv/+gpryJj1IXbpuhEvaqwhzEMK1X9p+dccNLVfTG0v9JDoaIhq2+scEg22InUH4ESKI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316886604367.6671777741617; Fri, 27 Mar 2020 06:48:06 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-87-8jRJcvK7PgqbPaJvC4eyfg-1; Fri, 27 Mar 2020 09:46:11 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2B13C1005509; Fri, 27 Mar 2020 13:46:04 +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 E7F5F5DDA5; Fri, 27 Mar 2020 13:46:03 +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 666A6944D1; Fri, 27 Mar 2020 13:46:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiQXo006473 for ; Fri, 27 Mar 2020 09:44:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5CE1160BF4; Fri, 27 Mar 2020 13:44:26 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E8C860C18 for ; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 2242618F8BB; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316885; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=pVTvrnGGrKJa1R1EnT9UJrTHDeZUzyY8LQEeq+u3uNw=; b=c5yJUNSdafhcp+D484NxylPPfknAY7JSaE40yURfoXnOUGQaH9/sqvUeIQ/FPZWFE9IXA8 J+CJ3+sAkjn0sPLUqlkHuDVTeLjsA8O1O1ylCcdbKU2C3525hJmyvWuy+mrOAQRHpDtxNX WDMfJB3wTqSMC3PEZJH7XXTkfKckQl8= X-MC-Unique: 8jRJcvK7PgqbPaJvC4eyfg-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 30/39] cpu_x86: Move and rename x86ModelHasSignature Date: Fri, 27 Mar 2020 14:43:59 +0100 Message-Id: <4039d8eb1643ae1cd2094d689dc27a852ef655ce.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Later in this series the function will work on a newly introduced virCPUx86Signatures structure. Let's move it to the place were all related functions will be added and rename the function as virCPUx86SignaturesMatch for easier review of the virCPUx86Signatures patch. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 4b6eaf8060..ff44cae77e 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1110,6 +1110,21 @@ virCPUx86SignaturesCopy(virCPUx86ModelPtr dst, } =20 =20 +static bool +virCPUx86SignaturesMatch(virCPUx86ModelPtr model, + uint32_t signature) +{ + size_t i; + + for (i =3D 0; i < model->nsignatures; i++) { + if (model->signatures[i] =3D=3D signature) + return true; + } + + return false; +} + + static void x86ModelFree(virCPUx86ModelPtr model) { @@ -1877,21 +1892,6 @@ virCPUx86Compare(virCPUDefPtr host, } =20 =20 -static bool -x86ModelHasSignature(virCPUx86ModelPtr model, - uint32_t signature) -{ - size_t i; - - for (i =3D 0; i < model->nsignatures; i++) { - if (model->signatures[i] =3D=3D signature) - return true; - } - - return false; -} - - static char * x86FormatSignatures(virCPUx86ModelPtr model) { @@ -1963,8 +1963,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current, * consider candidates with matching family/model. */ if (signature && - x86ModelHasSignature(current, signature) && - !x86ModelHasSignature(candidate, signature)) { + virCPUx86SignaturesMatch(current, signature) && + !virCPUx86SignaturesMatch(candidate, signature)) { VIR_DEBUG("%s differs in signature from matching %s", cpuCandidate->model, cpuCurrent->model); return 0; @@ -1980,8 +1980,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current, * result in longer list of features. */ if (signature && - x86ModelHasSignature(candidate, signature) && - !x86ModelHasSignature(current, signature)) { + virCPUx86SignaturesMatch(candidate, signature) && + !virCPUx86SignaturesMatch(current, signature)) { VIR_DEBUG("%s provides matching signature", cpuCandidate->model); return 1; } --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316770; cv=none; d=zohomail.com; s=zohoarc; b=gC9jTgxoU6QhGluz1Iqoax0eJKa3ANUYkIPiie8KGDMZpSo19Gmc23Z75vuFpgVe3Tsm8swZC95kO6ru9bHJjVG2inEN4HW/0jsM/16vtLfSiGqonRCAnhemoK8wJ0U/4IQ7hnVEdddsTR6qvOogTOXaMsx/Ecgt5GIAxmYcqJc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316770; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ejifzhw4CSpy9tagqkzyIy9831Ak8x6hJPofPrT/gM4=; b=JKlSq2XcQLMsjykUZNFrhIAFhnsOhisokrWXB603FP+r2a9ZvOnlXdYtkHhlL4GYHQGEtnwiF1tkWXU7o2rAsoBXgnX5zc1FoFCfgScu8mlDALrezmncQOSJEk+VixxqXxVMcTmqGN0K40HrusSAgdwpYU64V1jZeZNjVHvV8fQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585316770048428.16229793231344; Fri, 27 Mar 2020 06:46:10 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-413-Ga99MlbLO9C5t5hgXKX9zA-1; Fri, 27 Mar 2020 09:46:06 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DAFE1800D50; Fri, 27 Mar 2020 13:45:58 +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 B03245E01E; Fri, 27 Mar 2020 13:45:58 +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 6ECE21819AD1; Fri, 27 Mar 2020 13:45:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiQke006468 for ; Fri, 27 Mar 2020 09:44:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0E9815DA7D; Fri, 27 Mar 2020 13:44:26 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D52225DA75 for ; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 24FA018F8BC; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316768; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Ejifzhw4CSpy9tagqkzyIy9831Ak8x6hJPofPrT/gM4=; b=eLzCGXBAaBRG53RcS8Tu9kVhQl0F1MFxsgp5xP7mnGQj3TCfiQ2Cszp/AYe+6fhcaoJipf uVUoopSSPcbKQu8hcJRgLlLyBjCLoT4rdt8xAIzerbo0M8pJWDC8La9OerZ0dT/1n3CO0N sit9FyuPQv1iMr/MfMwHQktBRR7L0U4= X-MC-Unique: Ga99MlbLO9C5t5hgXKX9zA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 31/39] cpu_x86: Move and rename x86FormatSignatures Date: Fri, 27 Mar 2020 14:44:00 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Later in this series the function will work on a newly introduced virCPUx86Signatures structure. Let's move it to the place were all related functions will be added and rename the function as virCPUx86SignaturesFormat for easier review of the virCPUx86Signatures patch. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ff44cae77e..182d0da97c 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1125,6 +1125,23 @@ virCPUx86SignaturesMatch(virCPUx86ModelPtr model, } =20 =20 +static char * +virCPUx86SignaturesFormat(virCPUx86ModelPtr model) +{ + virBuffer buf =3D VIR_BUFFER_INITIALIZER; + size_t i; + + for (i =3D 0; i < model->nsignatures; i++) { + virBufferAsprintf(&buf, "%06lx,", + (unsigned long)model->signatures[i]); + } + + virBufferTrim(&buf, ","); + + return virBufferContentAndReset(&buf); +} + + static void x86ModelFree(virCPUx86ModelPtr model) { @@ -1892,23 +1909,6 @@ virCPUx86Compare(virCPUDefPtr host, } =20 =20 -static char * -x86FormatSignatures(virCPUx86ModelPtr model) -{ - virBuffer buf =3D VIR_BUFFER_INITIALIZER; - size_t i; - - for (i =3D 0; i < model->nsignatures; i++) { - virBufferAsprintf(&buf, "%06lx,", - (unsigned long)model->signatures[i]); - } - - virBufferTrim(&buf, ","); - - return virBufferContentAndReset(&buf); -} - - /* * Checks whether a candidate model is a better fit for the CPU data than = the * current model. @@ -2138,7 +2138,7 @@ x86Decode(virCPUDefPtr cpu, if (vendor) cpu->vendor =3D g_strdup(vendor->name); =20 - sigs =3D x86FormatSignatures(model); + sigs =3D virCPUx86SignaturesFormat(model); =20 VIR_DEBUG("Using CPU model %s (signatures %s) for CPU with signature %= 06lx", model->name, NULLSTR(sigs), (unsigned long)signature); --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316708; cv=none; d=zohomail.com; s=zohoarc; b=QGKjMS0rMP+wsLj1VLM2CXSh7xC3G2SzBkUm1/ABHAUPTAIBGd53cQuRgUAUohbnVCM6HMy3tJrG51YHQAmWbRq9HSv8ynjkTV+Ko1d37KXCi28BY9K9sabFbBn68pFTWSl3533UtqapMnB+SOshqgrM1LxT6ny320PiYygbchg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316708; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5xbhKYwety2XEukDB+zjgZfL2xsFxIidZPn4jXWT7Oc=; b=icZvidOFYHZiU8rb4o/SEgEEqTLvhddMH/fvDD6PmHTREx1VUMqXv3Tc6/+CzO7dw9y7h9Veu+W8SlRPeVFc58X/6fX3ER/UZOiEz3DAXuCkNnHDfxAPvpq3AyHTzST6y5FPW3SMQL8TwIAuyScaE1BzaBczF1/TX0dQn53l4UU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316708093987.0510223438479; Fri, 27 Mar 2020 06:45:08 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-476-3uX9S8ReOZSRnN19sJSp_Q-1; Fri, 27 Mar 2020 09:45:04 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 373C6801A07; Fri, 27 Mar 2020 13:44:58 +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 0B5F1CDBEC; Fri, 27 Mar 2020 13:44:58 +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 B407B944A0; Fri, 27 Mar 2020 13:44:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiOsv006423 for ; Fri, 27 Mar 2020 09:44:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id D989F10027A3; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AAABD1001925 for ; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 27E0E18F8BD; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316706; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=5xbhKYwety2XEukDB+zjgZfL2xsFxIidZPn4jXWT7Oc=; b=NZlX9kQYhG+3lVlxfLuS0KysuKyJxFzFA55D5kV+17DIWUfzs7WxjT4YoNf3A1tIXre6bS 4nvb2gD5YzF6KuBppXpATYGUYut8nha87Rs5Xr0qbqtzL0BrcYcSNWpTzrLaTAfGTAkCZk 6ptBnPlrRcz49u3wUY5PCb6xPoQ+mK8= X-MC-Unique: 3uX9S8ReOZSRnN19sJSp_Q-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 32/39] cpu_x86: Introduce virCPUx86SignaturesFree Date: Fri, 27 Mar 2020 14:44:01 +0100 Message-Id: <8ac38bee1a9851eb8d69c3eeeec962ebb38bcb8d.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The function will be used for freeing virCPUx86Signatures structure introduced later in this series. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 182d0da97c..a71b5ccacc 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1090,6 +1090,13 @@ x86FeatureParse(xmlXPathContextPtr ctxt, } =20 =20 +static void +virCPUx86SignaturesFree(uint32_t *signatures) +{ + g_free(signatures); +} + + static int virCPUx86SignaturesCopy(virCPUx86ModelPtr dst, virCPUx86ModelPtr src) @@ -1149,7 +1156,7 @@ x86ModelFree(virCPUx86ModelPtr model) return; =20 g_free(model->name); - g_free(model->signatures); + virCPUx86SignaturesFree(model->signatures); virCPUx86DataClear(&model->data); g_free(model); } @@ -1414,7 +1421,7 @@ x86ModelParseSignatures(virCPUx86ModelPtr model, return n; =20 /* Remove inherited signatures. */ - VIR_FREE(model->signatures); + virCPUx86SignaturesFree(model->signatures); =20 model->nsignatures =3D n; if (VIR_ALLOC_N(model->signatures, n) < 0) --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316709; cv=none; d=zohomail.com; s=zohoarc; b=NH3QgVV/00byoZkhPFELS9oxwjoxeexnVZkfVlc6vO8dW5GdjXZFcLgpk7l38dCi3z9Elhd91hNQlfSGu5uxmjIiOieYi+ZTtYySkRFIfQ/Tp+334VwAv3gw377vtvRQAhK5hw71rpt5/zLEsXe0vMye0e4NQHw4qd9U65Zr6fI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316709; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=R70smNCR7/o/IFpiEk63w5HnkveExdb23fXaAscL4A0=; b=VAulfJQx2tXF2JU52nQORuVeb1mrPpX+YkYkuLACeRYHe+QllN752hifLfp31L4cFEdUzM1RjrYN2uQjt9d/Gu5KUutkbRlg9+HJP3p/4uO13hlFZEOMEihqgLTNSb10DiJPEGJq8pTO8BQvJLTmbpXXmeidRPZzFJZEif58LE4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316709122251.643938987978; Fri, 27 Mar 2020 06:45:09 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-18-0tQn8faiOO-npAnudnyliA-1; Fri, 27 Mar 2020 09:45:05 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7893F149CA; Fri, 27 Mar 2020 13:44:58 +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 53C3E5C298; Fri, 27 Mar 2020 13:44:58 +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 0D87A18034FC; Fri, 27 Mar 2020 13:44:58 +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 02RDiORE006421 for ; Fri, 27 Mar 2020 09:44:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id D8B195E01E; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA3655E039 for ; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 2A9DC18F8BE; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316707; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=R70smNCR7/o/IFpiEk63w5HnkveExdb23fXaAscL4A0=; b=bpTpaXBFS8mQe+9MqrxwqGW62b9Ybv3uf6jiosJO0KxUe/0z7vLMWKZ/VCdgi/RgfCbKhS /ZwoutDrnkc6kM51NKYCRnF4tD+lkTrI7fSgHunCAZxib51cRPL0SYmlW0NM/tdk/cTOEl NAkQwM5msPRpUHIWzz3DDLIrlR2yE4I= X-MC-Unique: 0tQn8faiOO-npAnudnyliA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 33/39] cpu_x86: Introduce virCPUx86SignatureFromCPUID Date: Fri, 27 Mar 2020 14:44:02 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" It can be used for separating family, model, and stepping numbers from a single 32b integer as reported by CPUID. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index a71b5ccacc..29c6e2b6be 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -717,6 +717,18 @@ x86MakeSignature(unsigned int family, } =20 =20 +static void +virCPUx86SignatureFromCPUID(uint32_t sig, + unsigned int *family, + unsigned int *model, + unsigned int *stepping) +{ + *family =3D ((sig >> 20) & 0xff) + ((sig >> 8) & 0xf); + *model =3D ((sig >> 12) & 0xf0) + ((sig >> 4) & 0xf); + *stepping =3D sig & 0xf; +} + + static void x86DataToSignatureFull(const virCPUx86Data *data, unsigned int *family, @@ -725,17 +737,14 @@ x86DataToSignatureFull(const virCPUx86Data *data, { virCPUx86DataItem leaf1 =3D CPUID(.eax_in =3D 0x1); virCPUx86DataItemPtr item; - virCPUx86CPUIDPtr cpuid; =20 *family =3D *model =3D *stepping =3D 0; =20 if (!(item =3D virCPUx86DataGet(data, &leaf1))) return; =20 - cpuid =3D &item->data.cpuid; - *family =3D ((cpuid->eax >> 20) & 0xff) + ((cpuid->eax >> 8) & 0xf); - *model =3D ((cpuid->eax >> 12) & 0xf0) + ((cpuid->eax >> 4) & 0xf); - *stepping =3D cpuid->eax & 0xf; + virCPUx86SignatureFromCPUID(item->data.cpuid.eax, + family, model, stepping); } =20 =20 --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316751; cv=none; d=zohomail.com; s=zohoarc; b=cKmC0e4NImeJUWmDed7THSnDaolZ7DX+XgykHtAwyDxV97RQHnnm73Udw7UYX/XwsOHp2/wvtm5AmOzoHRvhnbyEu25gboaScQJ7tn4v25I+AhiEmzDgnbmTw8i4hHMgeO/BFB6pMO/kj3/If8+Pj5a3oL41p23GV4nxNOMrkEM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316751; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RA92ZkSVBuJwJGTG5QxVSPH741WW12nph1CfXn9AGB8=; b=IsSaUauQVvz5KhNSfWrp7ONlvi+u1ejntSfBmjJOCwdw4/VohZ/b4Y4nwhVoocjTjsnqNAGthy3dF8r0v3FchmYnMeSpxuqEAGpOm9bER+BSyzcdmyyXhWSDm0gd/ep/eTNjmNCC9EA/mKj7Hv2PRaMxDFvboOypKtuXnrXXh0M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585316751304528.5308260658555; Fri, 27 Mar 2020 06:45:51 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-267-8k-5Tq_VO-2HOSXBD9KW3w-1; Fri, 27 Mar 2020 09:45:48 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E0A3107ACCA; Fri, 27 Mar 2020 13:45:42 +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 0E7D7CDBEA; Fri, 27 Mar 2020 13:45:42 +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 B822C944CE; Fri, 27 Mar 2020 13:45:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiPwe006445 for ; Fri, 27 Mar 2020 09:44:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0C9455DA84; Fri, 27 Mar 2020 13:44:25 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA3075DA7D for ; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 2DC9B18F8BF; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316750; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=RA92ZkSVBuJwJGTG5QxVSPH741WW12nph1CfXn9AGB8=; b=Vch7N45DBrpP/SLT264j7NdDZZHDFdtbKDGD3JAz85Ep2jY0VD4WtQ86Tt4yFanDuW5MMU VXPe+eXjQnnEn0ZQB99RwAEJSuVLVxPdoxnNiqMIrXq8o/MkWq5Y3wfhRojAbTIOsOWlvY yiuwSGydEgYEtbgER3THryTXXjRyxdc= X-MC-Unique: 8k-5Tq_VO-2HOSXBD9KW3w-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 34/39] cpu_x86: Replace 32b signatures in virCPUx86Model with a struct Date: Fri, 27 Mar 2020 14:44:03 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The CPU models in our cpu_map define their signatures using separate family and model numbers. Let's store the signatures in the same way in our runtime representation of the cpu_map. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 149 +++++++++++++++++++++++++++++----------------- 1 file changed, 95 insertions(+), 54 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 29c6e2b6be..ed6c1b43d3 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -121,6 +121,19 @@ static virCPUx86Feature x86_kvm_features[] =3D KVM_FEATURE(VIR_CPU_x86_HV_STIMER_DIRECT), }; =20 +typedef struct _virCPUx86Signature virCPUx86Signature; +struct _virCPUx86Signature { + unsigned int family; + unsigned int model; +}; + +typedef struct _virCPUx86Signatures virCPUx86Signatures; +typedef virCPUx86Signatures *virCPUx86SignaturesPtr; +struct _virCPUx86Signatures { + size_t count; + virCPUx86Signature *items; +}; + typedef struct _virCPUx86Model virCPUx86Model; typedef virCPUx86Model *virCPUx86ModelPtr; struct _virCPUx86Model { @@ -128,8 +141,7 @@ struct _virCPUx86Model { bool decodeHost; bool decodeGuest; virCPUx86VendorPtr vendor; - size_t nsignatures; - uint32_t *signatures; + virCPUx86SignaturesPtr signatures; virCPUx86Data data; }; =20 @@ -717,6 +729,13 @@ x86MakeSignature(unsigned int family, } =20 =20 +static uint32_t +virCPUx86SignatureToCPUID(virCPUx86Signature *sig) +{ + return x86MakeSignature(sig->family, sig->model, 0); +} + + static void virCPUx86SignatureFromCPUID(uint32_t sig, unsigned int *family, @@ -1099,41 +1118,65 @@ x86FeatureParse(xmlXPathContextPtr ctxt, } =20 =20 +static virCPUx86SignaturesPtr +virCPUx86SignaturesNew(size_t count) +{ + virCPUx86SignaturesPtr sigs; + + sigs =3D g_new0(virCPUx86Signatures, 1); + sigs->items =3D g_new0(virCPUx86Signature, count); + sigs->count =3D count; + + return sigs; +} + + static void -virCPUx86SignaturesFree(uint32_t *signatures) +virCPUx86SignaturesFree(virCPUx86SignaturesPtr sigs) { - g_free(signatures); + if (!sigs) + return; + + g_free(sigs->items); + g_free(sigs); } =20 =20 -static int -virCPUx86SignaturesCopy(virCPUx86ModelPtr dst, - virCPUx86ModelPtr src) +static virCPUx86SignaturesPtr +virCPUx86SignaturesCopy(virCPUx86SignaturesPtr src) { + virCPUx86SignaturesPtr dst; size_t i; =20 - if (src->nsignatures =3D=3D 0) - return 0; + if (!src || src->count =3D=3D 0) + return NULL; =20 - if (VIR_ALLOC_N(dst->signatures, src->nsignatures) < 0) - return -1; + dst =3D virCPUx86SignaturesNew(src->count); =20 - dst->nsignatures =3D src->nsignatures; - for (i =3D 0; i < src->nsignatures; i++) - dst->signatures[i] =3D src->signatures[i]; + for (i =3D 0; i < src->count; i++) + dst->items[i] =3D src->items[i]; =20 - return 0; + return dst; } =20 =20 static bool -virCPUx86SignaturesMatch(virCPUx86ModelPtr model, +virCPUx86SignaturesMatch(virCPUx86SignaturesPtr sigs, uint32_t signature) { size_t i; + unsigned int family; + unsigned int model; + unsigned int stepping; =20 - for (i =3D 0; i < model->nsignatures; i++) { - if (model->signatures[i] =3D=3D signature) + if (!sigs) + return false; + + virCPUx86SignatureFromCPUID(signature, &family, &model, &stepping); + + for (i =3D 0; i < sigs->count; i++) { + if (sigs->items[i].family =3D=3D family && + sigs->items[i].model =3D=3D model) return true; } =20 @@ -1142,17 +1185,21 @@ virCPUx86SignaturesMatch(virCPUx86ModelPtr model, =20 =20 static char * -virCPUx86SignaturesFormat(virCPUx86ModelPtr model) +virCPUx86SignaturesFormat(virCPUx86SignaturesPtr sigs) { virBuffer buf =3D VIR_BUFFER_INITIALIZER; size_t i; =20 - for (i =3D 0; i < model->nsignatures; i++) { - virBufferAsprintf(&buf, "%06lx,", - (unsigned long)model->signatures[i]); + if (!sigs) + return virBufferContentAndReset(&buf); + + for (i =3D 0; i < sigs->count; i++) { + virBufferAsprintf(&buf, "(%u,%u,0), ", + sigs->items[i].family, + sigs->items[i].model); } =20 - virBufferTrim(&buf, ","); + virBufferTrim(&buf, ", "); =20 return virBufferContentAndReset(&buf); } @@ -1179,16 +1226,11 @@ x86ModelCopy(virCPUx86ModelPtr model) =20 copy =3D g_new0(virCPUx86Model, 1); copy->name =3D g_strdup(model->name); - - if (virCPUx86SignaturesCopy(copy, model) < 0) { - x86ModelFree(copy); - return NULL; - } + copy->signatures =3D virCPUx86SignaturesCopy(model->signatures); x86DataCopy(©->data, &model->data); - copy->vendor =3D model->vendor; =20 - return copy; + return g_steal_pointer(©); } =20 =20 @@ -1408,9 +1450,7 @@ x86ModelParseAncestor(virCPUx86ModelPtr model, } =20 model->vendor =3D ancestor->vendor; - if (virCPUx86SignaturesCopy(model, ancestor) < 0) - return -1; - + model->signatures =3D virCPUx86SignaturesCopy(ancestor->signatures); x86DataCopy(&model->data, &ancestor->data); =20 return 0; @@ -1432,34 +1472,29 @@ x86ModelParseSignatures(virCPUx86ModelPtr model, /* Remove inherited signatures. */ virCPUx86SignaturesFree(model->signatures); =20 - model->nsignatures =3D n; - if (VIR_ALLOC_N(model->signatures, n) < 0) - return -1; + model->signatures =3D virCPUx86SignaturesNew(n); =20 for (i =3D 0; i < n; i++) { - unsigned int sigFamily =3D 0; - unsigned int sigModel =3D 0; + virCPUx86Signature *sig =3D &model->signatures->items[i]; int rc; =20 ctxt->node =3D nodes[i]; =20 - rc =3D virXPathUInt("string(@family)", ctxt, &sigFamily); - if (rc < 0 || sigFamily =3D=3D 0) { + rc =3D virXPathUInt("string(@family)", ctxt, &sig->family); + if (rc < 0 || sig->family =3D=3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid CPU signature family in model %s"), model->name); return -1; } =20 - rc =3D virXPathUInt("string(@model)", ctxt, &sigModel); + rc =3D virXPathUInt("string(@model)", ctxt, &sig->model); if (rc < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid CPU signature model in model %s"), model->name); return -1; } - - model->signatures[i] =3D x86MakeSignature(sigFamily, sigModel, 0); } =20 ctxt->node =3D root; @@ -1866,9 +1901,12 @@ x86Compute(virCPUDefPtr host, &host_model->vendor->data) < 0) return VIR_CPU_COMPARE_ERROR; =20 - if (host_model->signatures && - x86DataAddSignature(&guest_model->data, *host_model->signature= s) < 0) - return VIR_CPU_COMPARE_ERROR; + if (host_model->signatures && host_model->signatures->count > 0) { + virCPUx86Signature *sig =3D &host_model->signatures->items[0]; + if (x86DataAddSignature(&guest_model->data, + virCPUx86SignatureToCPUID(sig)) < 0) + return VIR_CPU_COMPARE_ERROR; + } =20 if (cpu->type =3D=3D VIR_CPU_TYPE_GUEST && cpu->match =3D=3D VIR_CPU_MATCH_EXACT) @@ -1979,8 +2017,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current, * consider candidates with matching family/model. */ if (signature && - virCPUx86SignaturesMatch(current, signature) && - !virCPUx86SignaturesMatch(candidate, signature)) { + virCPUx86SignaturesMatch(current->signatures, signature) && + !virCPUx86SignaturesMatch(candidate->signatures, signature)) { VIR_DEBUG("%s differs in signature from matching %s", cpuCandidate->model, cpuCurrent->model); return 0; @@ -1996,8 +2034,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current, * result in longer list of features. */ if (signature && - virCPUx86SignaturesMatch(candidate, signature) && - !virCPUx86SignaturesMatch(current, signature)) { + virCPUx86SignaturesMatch(candidate->signatures, signature) && + !virCPUx86SignaturesMatch(current->signatures, signature)) { VIR_DEBUG("%s provides matching signature", cpuCandidate->model); return 1; } @@ -2154,7 +2192,7 @@ x86Decode(virCPUDefPtr cpu, if (vendor) cpu->vendor =3D g_strdup(vendor->name); =20 - sigs =3D virCPUx86SignaturesFormat(model); + sigs =3D virCPUx86SignaturesFormat(model->signatures); =20 VIR_DEBUG("Using CPU model %s (signatures %s) for CPU with signature %= 06lx", model->name, NULLSTR(sigs), (unsigned long)signature); @@ -3050,9 +3088,12 @@ virCPUx86Translate(virCPUDefPtr cpu, virCPUx86DataAddItem(&model->data, &model->vendor->data) < 0) return -1; =20 - if (model->signatures && - x86DataAddSignature(&model->data, model->signatures[0]) < 0) - return -1; + if (model->signatures && model->signatures->count > 0) { + virCPUx86Signature *sig =3D &model->signatures->items[0]; + if (x86DataAddSignature(&model->data, + virCPUx86SignatureToCPUID(sig)) < 0) + return -1; + } =20 if (!(translated =3D virCPUDefCopyWithoutModel(cpu))) return -1; --=20 2.26.0 From nobody Mon May 6 21:00:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316766; cv=none; d=zohomail.com; s=zohoarc; b=VCDzJymz7qwV0ApucVjDxGuUfCK1nY1IkHpaTchdQwyLVUtJTFu6rVKFI306HkoeovEJCXB5nZviwk0DRENe67MH4lyp9FKdb4woPaRMeIJrFLdrGlQAJ332EVYXsGLv8Jdwqm5Ch1cgovT13Bv4Aa0uGLUzMhGc7p9b4w2TMxs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316766; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=btUghvX/UBnwr+RJd8LZrhuGSCLEP08Iwl831ulAw6M=; b=cxbxORhFplKX3j/Un7JJBgApccDiH+zoQcvn2V20N2VLQu7Rqwn4CFbJKzFSB8i6mjMlFBy95ZvVcfncfY8O2A7mX1uzZBn4KxrUU5CLcJRQ3zppk8T4S4Ee59qhcvRPrKMlKoDwwiOxPnEd8F8p0mauEMbjyy+/F7IoyEnE2AI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316766612864.4087829906429; Fri, 27 Mar 2020 06:46:06 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-396-jQeFVfi6NmesP7gvl5hB9g-1; Fri, 27 Mar 2020 09:45:39 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CE784149CC; Fri, 27 Mar 2020 13:45:33 +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 9F130953BF; Fri, 27 Mar 2020 13:45:33 +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 3B2AD944C7; Fri, 27 Mar 2020 13:45:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiOAa006422 for ; Fri, 27 Mar 2020 09:44:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id D9841CDBEA; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB370CDBE9 for ; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 30C4018F8C0; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316765; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=btUghvX/UBnwr+RJd8LZrhuGSCLEP08Iwl831ulAw6M=; b=Ow9Ms42iZJImutw8BO+dmNXdbik8oDBT5g+50FqlDw3sym4QmWTKZVRYxbb5qvKoaQa0gz BJKouDFfBTIr41/AoiJKoymBW3/JN/lADsIXg+T7pg7NiGUiZPNXBzrXTHEZWShh9399TN v6+iBgzI/r/y0WK8WMZ+jrbGlOQJHuA= X-MC-Unique: jQeFVfi6NmesP7gvl5hB9g-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 35/39] cpu_x86: Don't check return value of x86ModelCopy Date: Fri, 27 Mar 2020 14:44:04 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Thanks to glib allocation functions which abort on OOM the function cannot ever return NULL. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ed6c1b43d3..51c98efca9 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1287,9 +1287,6 @@ x86ModelFromCPU(const virCPUDef *cpu, model =3D g_new0(virCPUx86Model, 1); } =20 - if (!model) - return NULL; - for (i =3D 0; i < cpu->nfeatures; i++) { virCPUx86FeaturePtr feature; virCPUFeaturePolicy fpol; @@ -1870,9 +1867,7 @@ x86Compute(virCPUDefPtr host, return VIR_CPU_COMPARE_INCOMPATIBLE; } =20 - if (!(diff =3D x86ModelCopy(host_model))) - return VIR_CPU_COMPARE_ERROR; - + diff =3D x86ModelCopy(host_model); x86DataSubtract(&diff->data, &cpu_optional->data); x86DataSubtract(&diff->data, &cpu_require->data); x86DataSubtract(&diff->data, &cpu_disable->data); @@ -1893,8 +1888,7 @@ x86Compute(virCPUDefPtr host, } =20 if (guest) { - if (!(guest_model =3D x86ModelCopy(host_model))) - return VIR_CPU_COMPARE_ERROR; + guest_model =3D x86ModelCopy(host_model); =20 if (cpu->vendor && host_model->vendor && virCPUx86DataAddItem(&guest_model->data, @@ -3135,8 +3129,8 @@ virCPUx86ExpandFeatures(virCPUDefPtr cpu) return -1; } =20 - if (!(model =3D x86ModelCopy(model)) || - x86DataToCPUFeatures(expanded, host ? -1 : VIR_CPU_FEATURE_REQUIRE, + model =3D x86ModelCopy(model); + if (x86DataToCPUFeatures(expanded, host ? -1 : VIR_CPU_FEATURE_REQUIRE, &model->data, map) < 0) return -1; =20 --=20 2.26.0 From nobody Mon May 6 21:00:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316756; cv=none; d=zohomail.com; s=zohoarc; b=OywmYjbpxsM0Xnip8btyIetmPIBP8JecXu5+UHBxT0VNBphicI4y9EjpFCja4WtpwWMHHuAj7ANbyOJgN9siaGhYAYIJ2j5SXW2d9atU3W06LDAkoV+GUcf+WJg4ro9ULzmXYLlGXL4ZEgHCV+L26TtBjqPQicA1IQYdxycenlg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316756; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+ZAi2BFM6aC9ZdaLs8LMDyFLXes3jL5E/EDvC7yN4RQ=; b=hoM1CCUlHvxqbwP1GJueml+jORGfiW2JFvH4zaNSHVnoOyTpdygorwYgUDL8drb7bgbYLO09ABj8cJq8uDJhA2DIatXAAaKkkE0Zl9kpijjPkTpCLZyD4VD+Mb2kp6Vi+x1T3R61MgcikxTBBCY6/CY3OKkjFnWxgXrIP6FsStI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585316756428131.80147769906876; Fri, 27 Mar 2020 06:45:56 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-255-N5grT14MObSXu_c42xXQig-1; Fri, 27 Mar 2020 09:45:52 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 67A2D1B18BC2; Fri, 27 Mar 2020 13:45:46 +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 3D65F3A0; Fri, 27 Mar 2020 13:45:46 +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 E9DAD1802228; Fri, 27 Mar 2020 13:45:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiPKo006446 for ; Fri, 27 Mar 2020 09:44:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 12DAC10027A3; Fri, 27 Mar 2020 13:44:25 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AFCA31001F43 for ; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 3404618F8C1; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316754; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=+ZAi2BFM6aC9ZdaLs8LMDyFLXes3jL5E/EDvC7yN4RQ=; b=HNmkrCPIXtfDw5f/GvghvIoH4sACf+vxySDx8GDZvME8VFvCme+s3hs55v5j3/TN3NRldR O35iqQlgx9ETf1CViPJUVVN4pma2gNwuyILmKSNqwZX6WrNZiX9h7ZBncAoTXajzXE037j H/4UBGL36tCh6pFd5vEedw8DXlm5mQI= X-MC-Unique: N5grT14MObSXu_c42xXQig-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 36/39] cpu_x86: Add support for stepping part of CPU signature Date: Fri, 27 Mar 2020 14:44:05 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" CPU models defined in the cpu_map can use signature/@stepping attribute to match a limited set of stepping numbers. The value is a bitmap for bits 0..15 each corresponding to a single stepping value. For example, stepping=3D'4-6,9' will match 4, 5, 6, and 9. Omitting the attribute is equivalent to stepping=3D'0-15'. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 60 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 51c98efca9..bd224a9d0d 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -125,6 +125,7 @@ typedef struct _virCPUx86Signature virCPUx86Signature; struct _virCPUx86Signature { unsigned int family; unsigned int model; + virBitmapPtr stepping; }; =20 typedef struct _virCPUx86Signatures virCPUx86Signatures; @@ -732,7 +733,17 @@ x86MakeSignature(unsigned int family, static uint32_t virCPUx86SignatureToCPUID(virCPUx86Signature *sig) { - return x86MakeSignature(sig->family, sig->model, 0); + unsigned int stepping =3D 0; + + if (sig->stepping) { + ssize_t fisrtBit; + + fisrtBit =3D virBitmapNextSetBit(sig->stepping, -1); + if (fisrtBit >=3D 0) + stepping =3D fisrtBit; + } + + return x86MakeSignature(sig->family, sig->model, stepping); } =20 =20 @@ -767,8 +778,8 @@ x86DataToSignatureFull(const virCPUx86Data *data, } =20 =20 -/* Mask out irrelevant bits (R and Step) from processor signature. */ -#define SIGNATURE_MASK 0x0fff3ff0 +/* Mask out reserved bits from processor signature. */ +#define SIGNATURE_MASK 0x0fff3fff =20 static uint32_t x86DataToSignature(const virCPUx86Data *data) @@ -1134,9 +1145,14 @@ virCPUx86SignaturesNew(size_t count) static void virCPUx86SignaturesFree(virCPUx86SignaturesPtr sigs) { + size_t i; + if (!sigs) return; =20 + for (i =3D 0; i < sigs->count; i++) + virBitmapFree(sigs->items[i].stepping); + g_free(sigs->items); g_free(sigs); } @@ -1153,8 +1169,12 @@ virCPUx86SignaturesCopy(virCPUx86SignaturesPtr src) =20 dst =3D virCPUx86SignaturesNew(src->count); =20 - for (i =3D 0; i < src->count; i++) - dst->items[i] =3D src->items[i]; + for (i =3D 0; i < src->count; i++) { + dst->items[i].family =3D src->items[i].family; + dst->items[i].model =3D src->items[i].model; + if (src->items[i].stepping) + dst->items[i].stepping =3D virBitmapNewCopy(src->items[i].step= ping); + } =20 return dst; } @@ -1176,7 +1196,9 @@ virCPUx86SignaturesMatch(virCPUx86SignaturesPtr sigs, =20 for (i =3D 0; i < sigs->count; i++) { if (sigs->items[i].family =3D=3D family && - sigs->items[i].model =3D=3D model) + sigs->items[i].model =3D=3D model && + (!sigs->items[i].stepping || + virBitmapIsBitSet(sigs->items[i].stepping, stepping))) return true; } =20 @@ -1194,9 +1216,15 @@ virCPUx86SignaturesFormat(virCPUx86SignaturesPtr sig= s) return virBufferContentAndReset(&buf); =20 for (i =3D 0; i < sigs->count; i++) { - virBufferAsprintf(&buf, "(%u,%u,0), ", + g_autofree char *stepping =3D NULL; + + if (sigs->items[i].stepping) + stepping =3D virBitmapFormat(sigs->items[i].stepping); + + virBufferAsprintf(&buf, "(%u,%u,%s), ", sigs->items[i].family, - sigs->items[i].model); + sigs->items[i].model, + stepping ? stepping : "0-15"); } =20 virBufferTrim(&buf, ", "); @@ -1473,6 +1501,7 @@ x86ModelParseSignatures(virCPUx86ModelPtr model, =20 for (i =3D 0; i < n; i++) { virCPUx86Signature *sig =3D &model->signatures->items[i]; + g_autofree char *stepping =3D NULL; int rc; =20 ctxt->node =3D nodes[i]; @@ -1492,6 +1521,11 @@ x86ModelParseSignatures(virCPUx86ModelPtr model, model->name); return -1; } + + stepping =3D virXPathString("string(@stepping)", ctxt); + /* stepping corresponds to 4 bits in 32b signature, see above */ + if (stepping && virBitmapParse(stepping, &sig->stepping, 16) < 0) + return -1; } =20 ctxt->node =3D root; @@ -2094,6 +2128,9 @@ x86Decode(virCPUDefPtr cpu, virDomainCapsCPUModelPtr hvModel =3D NULL; g_autofree char *sigs =3D NULL; uint32_t signature; + unsigned int sigFamily; + unsigned int sigModel; + unsigned int sigStepping; ssize_t i; int rc; =20 @@ -2107,6 +2144,7 @@ x86Decode(virCPUDefPtr cpu, =20 vendor =3D x86DataToVendor(&data, map); signature =3D x86DataToSignature(&data); + virCPUx86SignatureFromCPUID(signature, &sigFamily, &sigModel, &sigStep= ping); =20 x86DataFilterTSX(&data, vendor, map); =20 @@ -2188,8 +2226,10 @@ x86Decode(virCPUDefPtr cpu, =20 sigs =3D virCPUx86SignaturesFormat(model->signatures); =20 - VIR_DEBUG("Using CPU model %s (signatures %s) for CPU with signature %= 06lx", - model->name, NULLSTR(sigs), (unsigned long)signature); + VIR_DEBUG("Using CPU model %s with signatures [%s] for " + "CPU with signature (%u,%u,%u)", + model->name, NULLSTR(sigs), + sigFamily, sigModel, sigStepping); =20 cpu->model =3D g_steal_pointer(&cpuModel->model); cpu->features =3D g_steal_pointer(&cpuModel->features); --=20 2.26.0 From nobody Mon May 6 21:00:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316764; cv=none; d=zohomail.com; s=zohoarc; b=bQmKH+t2maZ02mXsX9rDYEQ0VsYF93raWf+vacjYP285uOKGJFF7jC+86d5rKuZm37vM0+9Pvo6ARzvLIWt7b3JM+eVzqF++5mF6ng1e4vBiEuj+md2xLYu9H0icdR7jVdw568b0NsPE+O4WIyy1e5D1efXwf1QONtg0UV46Ozk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316764; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=54dFsFnOfd6k6AeFXXKHx3YzWakdmQVH4QxZhA2f9lY=; b=HTAivh/4r1VsJaBxl/T9sLyw7Y0Ee6Poi2azMT0nFYZIqDzI/sWAcLJxOXaSkevR7Cbo6+y5AZd4fMrq4K6z7xc/61Ucy1ht3PLL4g+Ieu6NDnoLx6M5wafnfCJ8JVjLaYWQtl3GdOzsbdLYxgw5daQwXjDv6RWQ2YZdbxiZzg0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316764249822.2482406247395; Fri, 27 Mar 2020 06:46:04 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-144-kQM0WftkMa-zY1nw6fqjFA-1; Fri, 27 Mar 2020 09:45:59 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E4971005512; Fri, 27 Mar 2020 13:45:54 +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 1502DCDBEE; Fri, 27 Mar 2020 13:45:54 +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 C676B1819ACE; Fri, 27 Mar 2020 13:45:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiPhP006462 for ; Fri, 27 Mar 2020 09:44:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 660035DA75; Fri, 27 Mar 2020 13:44:25 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF5E55DA81 for ; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 38F7818F8C2; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316762; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=54dFsFnOfd6k6AeFXXKHx3YzWakdmQVH4QxZhA2f9lY=; b=Kc0Hac6/EuHAKw6qc0xVUvqBcocY2+7J8AtxciPdVBD0frhrkiaet1Iov88KtttF4EhFqk wj5TWklyv088wbRqS8xQrMQo3STXzTjDHohk0IXM/grDZUvvoWHSKK5P44I7ob64dLlaXj Bys8Ks5rWcMqsjNIS2orAKnKp4Mo2lw= X-MC-Unique: kQM0WftkMa-zY1nw6fqjFA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 37/39] cputest: Add data for Intel(R) Xeon(R) Platinum 9242 CPU Date: Fri, 27 Mar 2020 14:44:06 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Cascadelake-Server with family 6, model 85, stepping 7. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- tests/cputest.c | 1 + ...6_64-cpuid-Xeon-Platinum-9242-disabled.xml | 7 + ...86_64-cpuid-Xeon-Platinum-9242-enabled.xml | 10 + .../x86_64-cpuid-Xeon-Platinum-9242-guest.xml | 38 + .../x86_64-cpuid-Xeon-Platinum-9242-host.xml | 39 + .../x86_64-cpuid-Xeon-Platinum-9242-json.xml | 21 + .../x86_64-cpuid-Xeon-Platinum-9242.json | 1405 +++++++++++++++++ .../x86_64-cpuid-Xeon-Platinum-9242.sig | 4 + .../x86_64-cpuid-Xeon-Platinum-9242.xml | 68 + 9 files changed, 1593 insertions(+) create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-disab= led.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-enabl= ed.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-guest= .xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-host.= xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-json.= xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.json create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.sig create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.xml diff --git a/tests/cputest.c b/tests/cputest.c index 1f59f0d3a9..f9f1ca74ff 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -1267,6 +1267,7 @@ mymain(void) DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Gold-5115", JSON_MODELS); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Gold-6148", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Platinum-8268", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Platinum-9242", JSON_MODELS); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-W3520", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-X5460", JSON_NONE); DO_TEST_CPUID(VIR_ARCH_X86_64, "Ice-Lake-Server", JSON_MODELS); diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-disabled.xml= b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-disabled.xml new file mode 100644 index 0000000000..e7c59cef1e --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-disabled.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-enabled.xml = b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-enabled.xml new file mode 100644 index 0000000000..43c3a93a16 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-enabled.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-guest.xml b/= tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-guest.xml new file mode 100644 index 0000000000..faabdde8a0 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-guest.xml @@ -0,0 +1,38 @@ + + Cascadelake-Server + Intel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-host.xml b/t= ests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-host.xml new file mode 100644 index 0000000000..01447f3478 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-host.xml @@ -0,0 +1,39 @@ + + x86_64 + Cascadelake-Server + Intel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-json.xml b/t= ests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-json.xml new file mode 100644 index 0000000000..36e95029be --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-json.xml @@ -0,0 +1,21 @@ + + Cascadelake-Server + Intel + + + + + + + + + + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.json b/tests= /cputestdata/x86_64-cpuid-Xeon-Platinum-9242.json new file mode 100644 index 0000000000..103b094135 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.json @@ -0,0 +1,1405 @@ +{ + "return": { + "model": { + "name": "base", + "props": { + "vmx-entry-load-rtit-ctl": false, + "phys-bits": 0, + "core-id": -1, + "xlevel": 2147483656, + "cmov": true, + "ia64": false, + "ssb-no": false, + "aes": true, + "vmx-apicv-xapic": true, + "mmx": true, + "rdpid": false, + "vmx-page-walk-4": true, + "vmx-page-walk-5": false, + "arat": true, + "gfni": false, + "vmx-desc-exit": true, + "ibrs-all": true, + "pause-filter": false, + "xsavec": true, + "intel-pt": false, + "vmx-cr8-store-exit": true, + "hv-frequencies": false, + "tsc-frequency": 0, + "vmx-rdseed-exit": true, + "xd": true, + "x-intel-pt-auto-level": false, + "hv-vendor-id": "", + "vmx-eptp-switching": true, + "kvm-asyncpf": true, + "kvm_asyncpf": true, + "perfctr_core": false, + "perfctr-core": false, + "mpx": true, + "pbe": false, + "decodeassists": false, + "avx512cd": true, + "vmx-exit-load-efer": true, + "vmx-exit-clear-bndcfgs": false, + "sse4_1": true, + "sse4.1": true, + "sse4-1": true, + "family": 6, + "legacy-cache": true, + "vmx-vmwrite-vmexit-fields": true, + "vmx-vnmi": true, + "vmx-true-ctls": true, + "host-phys-bits-limit": 48, + "vmx-ept-execonly": true, + "vmx-exit-save-efer": true, + "vmx-invept-all-context": true, + "vmware-cpuid-freq": true, + "wbnoinvd": false, + "avx512f": true, + "hv-stimer-direct": false, + "msr": true, + "mce": true, + "mca": true, + "hv-runtime": false, + "xcrypt": false, + "thread-id": -1, + "vmx-exit-load-pat": true, + "vmx-intr-exit": true, + "min-level": 31, + "vmx-flexpriority": true, + "xgetbv1": true, + "cid": false, + "hv-relaxed": false, + "hv-crash": false, + "ds": false, + "fxsr": true, + "avx512-bf16": false, + "vmx-cr8-load-exit": true, + "xsaveopt": true, + "vmx-apicv-vid": true, + "vmx-exit-save-pat": true, + "xtpr": false, + "tsx-ctrl": true, + "vmx-ple": false, + "hv-evmcs": false, + "avx512vl": true, + "avx512-vpopcntdq": false, + "phe": false, + "extapic": false, + "3dnowprefetch": true, + "vmx-vmfunc": true, + "vmx-activity-shutdown": false, + "avx512vbmi2": false, + "vmx-encls-exit": false, + "cr8legacy": false, + "vmx-msr-bitmap": true, + "stibp": true, + "cpuid-0xb": true, + "xcrypt-en": false, + "vmx-mwait-exit": true, + "kvm_pv_eoi": true, + "vmx-pml": true, + "apic-id": 4294967295, + "vmx-nmi-exit": true, + "vmx-invept-single-context-noglobals": true, + "rsba": false, + "pn": false, + "dca": false, + "vendor": "GenuineIntel", + "vmx-unrestricted-guest": true, + "hv-ipi": false, + "vmx-cr3-store-noexit": true, + "pku": true, + "smx": false, + "cmp_legacy": false, + "cmp-legacy": false, + "node-id": -1, + "avx512-4fmaps": false, + "vmcb_clean": false, + "vmcb-clean": false, + "3dnowext": false, + "amd-no-ssb": false, + "hle": true, + "npt": false, + "rdctl-no": true, + "vmx-invvpid": true, + "memory": "/machine/unattached/system[0]", + "clwb": true, + "lbrv": false, + "adx": true, + "ss": true, + "pni": true, + "svm_lock": false, + "svm-lock": false, + "pfthreshold": false, + "smep": true, + "smap": true, + "vmx-invpcid-exit": true, + "x2apic": true, + "avx512vbmi": false, + "avx512vnni": true, + "vmx-apicv-x2apic": true, + "kvm-pv-sched-yield": true, + "hv-stimer": false, + "vmx-invlpg-exit": true, + "x-hv-synic-kvm-only": true, + "vmx-invvpid-all-context": true, + "i64": true, + "vmx-activity-hlt": true, + "flushbyasid": false, + "f16c": true, + "vmx-exit-ack-intr": true, + "ace2-en": false, + "pat": true, + "pae": true, + "sse": true, + "die-id": -1, + "vmx-tsc-offset": true, + "phe-en": false, + "kvm_nopiodelay": true, + "kvm-nopiodelay": true, + "tm": false, + "kvmclock-stable-bit": true, + "vmx-rdtsc-exit": true, + "hypervisor": true, + "vmx-rdtscp-exit": true, + "socket-id": -1, + "mds-no": true, + "pcommit": false, + "vmx-vpid": true, + "syscall": true, + "level": 31, + "avx512dq": true, + "x-migrate-smi-count": false, + "svm": false, + "full-cpuid-auto-level": true, + "hv-reset": false, + "invtsc": false, + "vmx-monitor-exit": true, + "sse3": true, + "sse2": true, + "vmx-wbinvd-exit": true, + "ssbd": true, + "est": false, + "kvm-poll-control": true, + "kvm_poll_control": true, + "avx512ifma": false, + "tm2": false, + "kvm-pv-ipi": true, + "kvm-pv-eoi": true, + "cx8": true, + "vmx-invvpid-single-addr": true, + "waitpkg": false, + "cldemote": false, + "vmx-ept": true, + "hv-reenlightenment": false, + "kvm_mmu": false, + "kvm-mmu": false, + "sse4_2": true, + "sse4.2": true, + "sse4-2": true, + "pge": true, + "fill-mtrr-mask": true, + "avx512bitalg": false, + "nodeid_msr": false, + "vmx-entry-load-bndcfgs": false, + "pdcm": false, + "vmx-exit-clear-rtit-ctl": false, + "movbe": true, + "model": 85, + "nrip_save": false, + "nrip-save": false, + "kvm_pv_unhalt": true, + "ssse3": true, + "sse4a": false, + "vmx-pause-exit": true, + "invpcid": true, + "pdpe1gb": true, + "tsc-deadline": true, + "skip-l1dfl-vmentry": true, + "vmx-exit-load-perf-global-ctrl": false, + "fma": true, + "cx16": true, + "de": true, + "enforce": false, + "stepping": 7, + "xsave": true, + "clflush": true, + "skinit": false, + "tsc": true, + "tce": false, + "fpu": true, + "ibs": false, + "ds_cpl": false, + "ds-cpl": false, + "vmx-exit-nosave-debugctl": true, + "host-phys-bits": true, + "fma4": false, + "vmx-invept": true, + "la57": false, + "osvw": false, + "check": true, + "hv-spinlocks": 4294967295, + "vmx-eptad": true, + "pmu": false, + "pmm": false, + "apic": true, + "vmx-entry-noload-debugctl": true, + "spec-ctrl": true, + "vmx-posted-intr": true, + "vmx-apicv-register": true, + "min-xlevel2": 0, + "tsc-adjust": true, + "tsc_adjust": true, + "kvm-steal-time": true, + "kvm_steal_time": true, + "vmx-zero-len-inject": false, + "kvmclock": true, + "pschange-mc-no": true, + "l3-cache": true, + "vmx-rdrand-exit": true, + "lwp": false, + "hv-passthrough": false, + "amd-ssbd": true, + "ibpb": true, + "xop": false, + "avx": true, + "core-capability": false, + "vmx-invept-single-context": true, + "movdiri": false, + "ace2": false, + "avx512bw": true, + "acpi": false, + "hv-vapic": false, + "fsgsbase": true, + "vmx-ept-1gb": true, + "vmx-ept-2mb": true, + "ht": false, + "vmx-io-exit": true, + "nx": true, + "pclmulqdq": true, + "mmxext": false, + "vaes": false, + "popcnt": true, + "xsaves": true, + "movdir64b": false, + "tcg-cpuid": true, + "vmx-shadow-vmcs": true, + "lm": true, + "vmx-exit-save-preemption-timer": true, + "vmx-entry-load-pat": true, + "vmx-entry-load-perf-global-ctrl": false, + "vmx-io-bitmap": true, + "umip": true, + "vmx-store-lma": true, + "vmx-movdr-exit": true, + "pse": true, + "avx2": true, + "sep": true, + "pclmuldq": true, + "virt-ssbd": false, + "vmx-cr3-load-noexit": true, + "x-hv-max-vps": -1, + "nodeid-msr": false, + "md-clear": true, + "split-lock-detect": false, + "kvm": true, + "misalignsse": false, + "min-xlevel": 2147483656, + "kvm-pv-unhalt": true, + "bmi2": true, + "bmi1": true, + "realized": false, + "tsc_scale": false, + "tsc-scale": false, + "topoext": false, + "hv-vpindex": false, + "hv-no-nonarch-coresharing": "off", + "vmx-preemption-timer": true, + "ucode-rev": 0, + "xlevel2": 0, + "clflushopt": true, + "vmx-vnmi-pending": true, + "kvm-no-smi-migration": false, + "monitor": false, + "vmx-vintr-pending": true, + "avx512er": false, + "pmm-en": false, + "pcid": true, + "taa-no": false, + "vmx-secondary-ctls": true, + "arch-capabilities": true, + "vmx-xsaves": true, + "clzero": false, + "3dnow": false, + "erms": true, + "vmx-entry-ia32e-mode": true, + "x-force-features": false, + "lahf_lm": true, + "lahf-lm": true, + "vpclmulqdq": false, + "vmx-ins-outs": true, + "fxsr-opt": false, + "hv-synic": false, + "xstore": false, + "fxsr_opt": false, + "kvm-hint-dedicated": false, + "rtm": true, + "lmce": true, + "hv-time": false, + "perfctr-nb": false, + "perfctr_nb": false, + "ffxsr": false, + "hv-tlbflush": false, + "rdrand": true, + "rdseed": true, + "avx512-4vnniw": false, + "vmx": true, + "vme": true, + "dtes64": false, + "mtrr": true, + "rdtscp": true, + "xsaveerptr": false, + "pse36": true, + "kvm-pv-tlb-flush": true, + "vmx-activity-wait-sipi": false, + "tbm": false, + "wdt": false, + "vmx-rdpmc-exit": true, + "level-func7": 0, + "vmx-entry-load-efer": true, + "vmx-mtf": true, + "pause_filter": false, + "sha-ni": false, + "model-id": "Intel(R) Xeon(R) Platinum 9242 CPU @ 2.30GHz", + "abm": true, + "vmx-ept-advanced-exitinfo": false, + "avx512pf": false, + "vmx-hlt-exit": true, + "xstore-en": false + } + } + }, + "id": "model-expansion" +} + +{ + "return": [ + { + "name": "max", + "typename": "max-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": false + }, + { + "name": "host", + "typename": "host-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": false + }, + { + "name": "base", + "typename": "base-x86_64-cpu", + "unavailable-features": [], + "static": true, + "migration-safe": true + }, + { + "name": "qemu64-v1", + "typename": "qemu64-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "qemu64", + "typename": "qemu64-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "qemu32-v1", + "typename": "qemu32-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "qemu32", + "typename": "qemu32-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "phenom-v1", + "typename": "phenom-v1-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "3dnowext", + "3dnow", + "sse4a", + "npt" + ], + "static": false, + "migration-safe": true + }, + { + "name": "phenom", + "typename": "phenom-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "3dnowext", + "3dnow", + "sse4a", + "npt" + ], + "static": false, + "migration-safe": true + }, + { + "name": "pentium3-v1", + "typename": "pentium3-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium3", + "typename": "pentium3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium2-v1", + "typename": "pentium2-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium2", + "typename": "pentium2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium-v1", + "typename": "pentium-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium", + "typename": "pentium-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "n270-v1", + "typename": "n270-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "n270", + "typename": "n270-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "kvm64-v1", + "typename": "kvm64-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "kvm64", + "typename": "kvm64-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "kvm32-v1", + "typename": "kvm32-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "kvm32", + "typename": "kvm32-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "coreduo-v1", + "typename": "coreduo-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "coreduo", + "typename": "coreduo-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "core2duo-v1", + "typename": "core2duo-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "core2duo", + "typename": "core2duo-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "athlon-v1", + "typename": "athlon-v1-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "3dnowext", + "3dnow" + ], + "static": false, + "migration-safe": true + }, + { + "name": "athlon", + "typename": "athlon-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "3dnowext", + "3dnow" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere-v2", + "typename": "Westmere-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere-v1", + "typename": "Westmere-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere-IBRS", + "typename": "Westmere-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere", + "typename": "Westmere-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Snowridge-v2", + "typename": "Snowridge-v2-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "gfni", + "cldemote", + "movdiri", + "movdir64b", + "core-capability", + "split-lock-detect" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Snowridge-v1", + "typename": "Snowridge-v1-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "gfni", + "cldemote", + "movdiri", + "movdir64b", + "core-capability", + "split-lock-detect" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Snowridge", + "typename": "Snowridge-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "gfni", + "cldemote", + "movdiri", + "movdir64b", + "core-capability", + "split-lock-detect" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server-v3", + "typename": "Skylake-Server-v3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server-v2", + "typename": "Skylake-Server-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server-v1", + "typename": "Skylake-Server-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server-noTSX-IBRS", + "typename": "Skylake-Server-noTSX-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server-IBRS", + "typename": "Skylake-Server-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server", + "typename": "Skylake-Server-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client-v3", + "typename": "Skylake-Client-v3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client-v2", + "typename": "Skylake-Client-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client-v1", + "typename": "Skylake-Client-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client-noTSX-IBRS", + "typename": "Skylake-Client-noTSX-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client-IBRS", + "typename": "Skylake-Client-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client", + "typename": "Skylake-Client-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge-v2", + "typename": "SandyBridge-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge-v1", + "typename": "SandyBridge-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge-IBRS", + "typename": "SandyBridge-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge", + "typename": "SandyBridge-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Penryn-v1", + "typename": "Penryn-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Penryn", + "typename": "Penryn-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G5-v1", + "typename": "Opteron_G5-v1-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4", + "tbm", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G5", + "typename": "Opteron_G5-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4", + "tbm" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G4-v1", + "typename": "Opteron_G4-v1-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G4", + "typename": "Opteron_G4-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G3-v1", + "typename": "Opteron_G3-v1-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G3", + "typename": "Opteron_G3-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G2-v1", + "typename": "Opteron_G2-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G2", + "typename": "Opteron_G2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G1-v1", + "typename": "Opteron_G1-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G1", + "typename": "Opteron_G1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem-v2", + "typename": "Nehalem-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem-v1", + "typename": "Nehalem-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem-IBRS", + "typename": "Nehalem-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem", + "typename": "Nehalem-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "KnightsMill-v1", + "typename": "KnightsMill-v1-x86_64-cpu", + "unavailable-features": [ + "avx512pf", + "avx512er", + "avx512-vpopcntdq", + "avx512-4vnniw", + "avx512-4fmaps" + ], + "static": false, + "migration-safe": true + }, + { + "name": "KnightsMill", + "typename": "KnightsMill-x86_64-cpu", + "unavailable-features": [ + "avx512pf", + "avx512er", + "avx512-vpopcntdq", + "avx512-4vnniw", + "avx512-4fmaps" + ], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge-v2", + "typename": "IvyBridge-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge-v1", + "typename": "IvyBridge-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge-IBRS", + "typename": "IvyBridge-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge", + "typename": "IvyBridge-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Server-v2", + "typename": "Icelake-Server-v2-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512bitalg", + "avx512-vpopcntdq", + "la57", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Server-v1", + "typename": "Icelake-Server-v1-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512bitalg", + "avx512-vpopcntdq", + "la57", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Server-noTSX", + "typename": "Icelake-Server-noTSX-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512bitalg", + "avx512-vpopcntdq", + "la57", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Server", + "typename": "Icelake-Server-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512bitalg", + "avx512-vpopcntdq", + "la57", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Client-v2", + "typename": "Icelake-Client-v2-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512bitalg", + "avx512-vpopcntdq", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Client-v1", + "typename": "Icelake-Client-v1-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512bitalg", + "avx512-vpopcntdq", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Client-noTSX", + "typename": "Icelake-Client-noTSX-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512bitalg", + "avx512-vpopcntdq", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Client", + "typename": "Icelake-Client-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512bitalg", + "avx512-vpopcntdq", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-v4", + "typename": "Haswell-v4-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-v3", + "typename": "Haswell-v3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-v2", + "typename": "Haswell-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-v1", + "typename": "Haswell-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-noTSX-IBRS", + "typename": "Haswell-noTSX-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-noTSX", + "typename": "Haswell-noTSX-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-IBRS", + "typename": "Haswell-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell", + "typename": "Haswell-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "EPYC-v2", + "typename": "EPYC-v2-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "EPYC-v1", + "typename": "EPYC-v1-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "EPYC-IBPB", + "typename": "EPYC-IBPB-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw" + ], + "static": false, + "migration-safe": true + }, + { + "name": "EPYC", + "typename": "EPYC-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Dhyana-v1", + "typename": "Dhyana-v1-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Dhyana", + "typename": "Dhyana-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Denverton-v1", + "typename": "Denverton-v1-x86_64-cpu", + "unavailable-features": [ + "sha-ni" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Denverton", + "typename": "Denverton-x86_64-cpu", + "unavailable-features": [ + "sha-ni" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Conroe-v1", + "typename": "Conroe-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Conroe", + "typename": "Conroe-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Cascadelake-Server-v3", + "typename": "Cascadelake-Server-v3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Cascadelake-Server-v2", + "typename": "Cascadelake-Server-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Cascadelake-Server-v1", + "typename": "Cascadelake-Server-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Cascadelake-Server-noTSX", + "typename": "Cascadelake-Server-noTSX-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Cascadelake-Server", + "typename": "Cascadelake-Server-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-v4", + "typename": "Broadwell-v4-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-v3", + "typename": "Broadwell-v3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-v2", + "typename": "Broadwell-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-v1", + "typename": "Broadwell-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-noTSX-IBRS", + "typename": "Broadwell-noTSX-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-noTSX", + "typename": "Broadwell-noTSX-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-IBRS", + "typename": "Broadwell-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell", + "typename": "Broadwell-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "486-v1", + "typename": "486-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "486", + "typename": "486-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + } + ], + "id": "definitions" +} diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.sig b/tests/= cputestdata/x86_64-cpuid-Xeon-Platinum-9242.sig new file mode 100644 index 0000000000..082a25b4ee --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.sig @@ -0,0 +1,4 @@ +050657 +family: 6 (0x06) +model: 85 (0x55) +stepping: 7 (0x07) diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.xml b/tests/= cputestdata/x86_64-cpuid-Xeon-Platinum-9242.xml new file mode 100644 index 0000000000..e3bdd881b6 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.26.0 From nobody Mon May 6 21:00:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316768; cv=none; d=zohomail.com; s=zohoarc; b=ez/WpqHw57pL9+LKYusXxh0zn8a4XIoZhWVYMnoL0dR/4ATXUCHaMFMnLtxwbjoOkeYImPuSCnvn/xzJOwXAgwRpkaCv5NAMfOf+NrfeQkqLvUQhICJrO1vqIpXyurOb92z/AbPSa4q3ha7uq8MkT4+796D08ZOHFexdWnTGvV4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316768; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sfpI91nD6UPSnE7I2BjA+oBaVTmJQPP9KVeY6m7X+1w=; b=eG/ki0vOUtY5eQqBbHsP6hYjbU3zezCoLJffYyQEjwYQB9zKX69PoJHpUjrgOwOzEbQRot7yzImMrVUGBv2VlJhF+AuqVjXYefSg//2OdGJEqK9VqSinnRgoNnzroy71TrhZXSKI4HAiDNw2FGb18uYze42+4qzav2fhJA256Ys= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316768816677.0032031201054; Fri, 27 Mar 2020 06:46:08 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-156-_Uh9whTZMtCBcULt5xVKQg-1; Fri, 27 Mar 2020 09:45:14 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1D78F1088399; Fri, 27 Mar 2020 13:45:09 +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 D8B575C1D8; Fri, 27 Mar 2020 13:45:08 +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 5C20E944BA; Fri, 27 Mar 2020 13:45:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiQUl006483 for ; Fri, 27 Mar 2020 09:44:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id CC9FC19488; Fri, 27 Mar 2020 13:44:26 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 22BBF19757 for ; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 3D98018FA6E; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316767; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=sfpI91nD6UPSnE7I2BjA+oBaVTmJQPP9KVeY6m7X+1w=; b=G68Tbr8uq5bFUba/ecKZ/HyBITcTRTV8bPRInyr/Mtuhzm5VL40XhW4aRwM66dNJl6ncee EvyrTjjoC5HxIJXMOw1Ddmi34fQGO05IT2nXqmJuzt9f8ObXxvt8o0qh1KMQS7GVJB1Cct wtE4fSWeI5wCI1t1w9gnmrOym0yXfvw= X-MC-Unique: _Uh9whTZMtCBcULt5xVKQg-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 38/39] cputest: Add data for Intel(R) Xeon(R) Gold 6130 CPU Date: Fri, 27 Mar 2020 14:44:07 +0100 Message-Id: <1775f23e93dfa4ad852d697ca9321cb37bf5fd3c.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Skylake-Server with family 6, model 85, stepping 4, which is currently mis-detected as Cascadelake-Server CPU model. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- tests/cputest.c | 1 + .../x86_64-cpuid-Xeon-Gold-6130-disabled.xml | 7 + .../x86_64-cpuid-Xeon-Gold-6130-enabled.xml | 9 + .../x86_64-cpuid-Xeon-Gold-6130-guest.xml | 33 + .../x86_64-cpuid-Xeon-Gold-6130-host.xml | 35 + .../x86_64-cpuid-Xeon-Gold-6130-json.xml | 16 + .../x86_64-cpuid-Xeon-Gold-6130.json | 1201 +++++++++++++++++ .../x86_64-cpuid-Xeon-Gold-6130.sig | 4 + .../x86_64-cpuid-Xeon-Gold-6130.xml | 54 + 9 files changed, 1360 insertions(+) create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-disabled.= xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-enabled.x= ml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-host.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.json create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.sig create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.xml diff --git a/tests/cputest.c b/tests/cputest.c index f9f1ca74ff..869d016ffc 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -1265,6 +1265,7 @@ mymain(void) DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E7-8890-v3", JSON_MODELS); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E7540", JSON_MODELS); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Gold-5115", JSON_MODELS); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Gold-6130", JSON_MODELS); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Gold-6148", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Platinum-8268", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Platinum-9242", JSON_MODELS); diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-disabled.xml b/t= ests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-disabled.xml new file mode 100644 index 0000000000..e7c59cef1e --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-disabled.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-enabled.xml b/te= sts/cputestdata/x86_64-cpuid-Xeon-Gold-6130-enabled.xml new file mode 100644 index 0000000000..8610577479 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-enabled.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml b/test= s/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml new file mode 100644 index 0000000000..cfb0eb982d --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml @@ -0,0 +1,33 @@ + + Cascadelake-Server + Intel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-host.xml b/tests= /cputestdata/x86_64-cpuid-Xeon-Gold-6130-host.xml new file mode 100644 index 0000000000..207e9e0ee4 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-host.xml @@ -0,0 +1,35 @@ + + x86_64 + Skylake-Server-IBRS + Intel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml b/tests= /cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml new file mode 100644 index 0000000000..968d904557 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml @@ -0,0 +1,16 @@ + + Cascadelake-Server + Intel + + + + + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.json b/tests/cpu= testdata/x86_64-cpuid-Xeon-Gold-6130.json new file mode 100644 index 0000000000..1a22387617 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.json @@ -0,0 +1,1201 @@ +{ + "return": { + "model": { + "name": "base", + "props": { + "phys-bits": 0, + "core-id": -1, + "xlevel": 2147483656, + "cmov": true, + "ia64": false, + "ssb-no": false, + "aes": true, + "mmx": true, + "rdpid": false, + "arat": true, + "gfni": false, + "ibrs-all": false, + "pause-filter": false, + "xsavec": true, + "intel-pt": false, + "hv-frequencies": false, + "tsc-frequency": 0, + "xd": true, + "x-intel-pt-auto-level": false, + "hv-vendor-id": "", + "kvm-asyncpf": true, + "kvm_asyncpf": true, + "perfctr_core": false, + "perfctr-core": false, + "mpx": true, + "pbe": false, + "decodeassists": false, + "avx512cd": true, + "sse4_1": true, + "sse4.1": true, + "sse4-1": true, + "family": 6, + "legacy-cache": true, + "host-phys-bits-limit": 48, + "vmware-cpuid-freq": true, + "wbnoinvd": false, + "avx512f": true, + "hv-stimer-direct": false, + "msr": true, + "mce": true, + "mca": true, + "hv-runtime": false, + "xcrypt": false, + "thread-id": -1, + "min-level": 13, + "xgetbv1": true, + "cid": false, + "hv-relaxed": false, + "hv-crash": false, + "ds": false, + "fxsr": true, + "xsaveopt": true, + "xtpr": false, + "hv-evmcs": false, + "avx512vl": true, + "avx512-vpopcntdq": false, + "phe": false, + "extapic": false, + "3dnowprefetch": true, + "avx512vbmi2": false, + "cr8legacy": false, + "stibp": true, + "cpuid-0xb": true, + "xcrypt-en": false, + "kvm_pv_eoi": true, + "apic-id": 4294967295, + "rsba": false, + "pn": false, + "dca": false, + "vendor": "GenuineIntel", + "hv-ipi": false, + "pku": true, + "smx": false, + "cmp_legacy": false, + "cmp-legacy": false, + "node-id": -1, + "avx512-4fmaps": false, + "vmcb_clean": false, + "vmcb-clean": false, + "3dnowext": false, + "amd-no-ssb": false, + "hle": true, + "npt": false, + "rdctl-no": false, + "memory": "/machine/unattached/system[0]", + "clwb": true, + "lbrv": false, + "adx": true, + "ss": true, + "pni": true, + "svm_lock": false, + "svm-lock": false, + "pfthreshold": false, + "smep": true, + "smap": true, + "x2apic": true, + "avx512vbmi": false, + "avx512vnni": false, + "hv-stimer": false, + "x-hv-synic-kvm-only": true, + "i64": true, + "flushbyasid": false, + "f16c": true, + "ace2-en": false, + "pat": true, + "pae": true, + "sse": true, + "die-id": -1, + "phe-en": false, + "kvm_nopiodelay": true, + "kvm-nopiodelay": true, + "tm": false, + "kvmclock-stable-bit": true, + "hypervisor": true, + "socket-id": -1, + "mds-no": false, + "pcommit": false, + "syscall": true, + "level": 13, + "avx512dq": true, + "x-migrate-smi-count": false, + "svm": false, + "full-cpuid-auto-level": true, + "hv-reset": false, + "invtsc": false, + "sse3": true, + "sse2": true, + "ssbd": true, + "est": false, + "avx512ifma": false, + "tm2": false, + "kvm-pv-ipi": true, + "kvm-pv-eoi": true, + "cx8": true, + "cldemote": false, + "hv-reenlightenment": false, + "kvm_mmu": false, + "kvm-mmu": false, + "sse4_2": true, + "sse4.2": true, + "sse4-2": true, + "pge": true, + "fill-mtrr-mask": true, + "avx512bitalg": false, + "nodeid_msr": false, + "pdcm": false, + "movbe": true, + "model": 85, + "nrip_save": false, + "nrip-save": false, + "kvm_pv_unhalt": true, + "ssse3": true, + "sse4a": false, + "invpcid": true, + "pdpe1gb": true, + "tsc-deadline": true, + "skip-l1dfl-vmentry": true, + "fma": true, + "cx16": true, + "de": true, + "enforce": false, + "stepping": 4, + "xsave": true, + "clflush": true, + "skinit": false, + "tsc": true, + "tce": false, + "fpu": true, + "ibs": false, + "ds_cpl": false, + "ds-cpl": false, + "host-phys-bits": true, + "fma4": false, + "la57": false, + "osvw": false, + "check": true, + "hv-spinlocks": 4294967295, + "pmu": false, + "pmm": false, + "apic": true, + "spec-ctrl": true, + "min-xlevel2": 0, + "tsc-adjust": true, + "tsc_adjust": true, + "kvm-steal-time": true, + "kvm_steal_time": true, + "kvmclock": true, + "l3-cache": true, + "lwp": false, + "hv-passthrough": false, + "amd-ssbd": false, + "ibpb": false, + "xop": false, + "avx": true, + "core-capability": false, + "movdiri": false, + "ace2": false, + "avx512bw": true, + "acpi": false, + "hv-vapic": false, + "fsgsbase": true, + "ht": false, + "nx": true, + "pclmulqdq": true, + "mmxext": false, + "vaes": false, + "popcnt": true, + "xsaves": true, + "movdir64b": false, + "tcg-cpuid": true, + "lm": true, + "umip": true, + "pse": true, + "avx2": true, + "sep": true, + "pclmuldq": true, + "virt-ssbd": false, + "x-hv-max-vps": -1, + "nodeid-msr": false, + "md-clear": true, + "split-lock-detect": false, + "kvm": true, + "misalignsse": false, + "min-xlevel": 2147483656, + "kvm-pv-unhalt": true, + "bmi2": true, + "bmi1": true, + "realized": false, + "tsc_scale": false, + "tsc-scale": false, + "topoext": false, + "hv-vpindex": false, + "xlevel2": 0, + "clflushopt": true, + "kvm-no-smi-migration": false, + "monitor": false, + "avx512er": false, + "pmm-en": false, + "pcid": true, + "arch-capabilities": true, + "3dnow": false, + "erms": true, + "x-force-features": false, + "lahf-lm": true, + "lahf_lm": true, + "vpclmulqdq": false, + "fxsr-opt": false, + "hv-synic": false, + "xstore": false, + "fxsr_opt": false, + "kvm-hint-dedicated": false, + "rtm": true, + "lmce": true, + "hv-time": false, + "perfctr-nb": false, + "perfctr_nb": false, + "ffxsr": false, + "hv-tlbflush": false, + "rdrand": true, + "rdseed": true, + "avx512-4vnniw": false, + "vmx": true, + "vme": true, + "dtes64": false, + "mtrr": true, + "rdtscp": true, + "pse36": true, + "kvm-pv-tlb-flush": true, + "tbm": false, + "wdt": false, + "pause_filter": false, + "sha-ni": false, + "model-id": "Intel(R) Xeon(R) Gold 6130 CPU @ 2.10GHz", + "abm": true, + "avx512pf": false, + "xstore-en": false + } + } + }, + "id": "model-expansion" +} + +{ + "return": [ + { + "name": "max", + "typename": "max-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": false + }, + { + "name": "host", + "typename": "host-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": false + }, + { + "name": "base", + "typename": "base-x86_64-cpu", + "unavailable-features": [], + "static": true, + "migration-safe": true + }, + { + "name": "qemu64-v1", + "typename": "qemu64-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "qemu64", + "typename": "qemu64-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "qemu32-v1", + "typename": "qemu32-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "qemu32", + "typename": "qemu32-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "phenom-v1", + "typename": "phenom-v1-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "3dnowext", + "3dnow", + "sse4a", + "npt" + ], + "static": false, + "migration-safe": true + }, + { + "name": "phenom", + "typename": "phenom-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "3dnowext", + "3dnow", + "sse4a", + "npt" + ], + "static": false, + "migration-safe": true + }, + { + "name": "pentium3-v1", + "typename": "pentium3-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium3", + "typename": "pentium3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium2-v1", + "typename": "pentium2-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium2", + "typename": "pentium2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium-v1", + "typename": "pentium-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium", + "typename": "pentium-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "n270-v1", + "typename": "n270-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "n270", + "typename": "n270-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "kvm64-v1", + "typename": "kvm64-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "kvm64", + "typename": "kvm64-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "kvm32-v1", + "typename": "kvm32-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "kvm32", + "typename": "kvm32-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "cpu64-rhel6-v1", + "typename": "cpu64-rhel6-v1-x86_64-cpu", + "unavailable-features": [ + "sse4a" + ], + "static": false, + "migration-safe": true + }, + { + "name": "cpu64-rhel6", + "typename": "cpu64-rhel6-x86_64-cpu", + "unavailable-features": [ + "sse4a" + ], + "static": false, + "migration-safe": true + }, + { + "name": "coreduo-v1", + "typename": "coreduo-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "coreduo", + "typename": "coreduo-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "core2duo-v1", + "typename": "core2duo-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "core2duo", + "typename": "core2duo-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "athlon-v1", + "typename": "athlon-v1-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "3dnowext", + "3dnow" + ], + "static": false, + "migration-safe": true + }, + { + "name": "athlon", + "typename": "athlon-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "3dnowext", + "3dnow" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere-v2", + "typename": "Westmere-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere-v1", + "typename": "Westmere-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere-IBRS", + "typename": "Westmere-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere", + "typename": "Westmere-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Snowridge-v1", + "typename": "Snowridge-v1-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "gfni", + "cldemote", + "movdiri", + "movdir64b", + "core-capability", + "split-lock-detect" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Snowridge", + "typename": "Snowridge-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "gfni", + "cldemote", + "movdiri", + "movdir64b", + "core-capability", + "split-lock-detect" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server-v2", + "typename": "Skylake-Server-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server-v1", + "typename": "Skylake-Server-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server-IBRS", + "typename": "Skylake-Server-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server", + "typename": "Skylake-Server-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client-v2", + "typename": "Skylake-Client-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client-v1", + "typename": "Skylake-Client-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client-IBRS", + "typename": "Skylake-Client-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client", + "typename": "Skylake-Client-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge-v2", + "typename": "SandyBridge-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge-v1", + "typename": "SandyBridge-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge-IBRS", + "typename": "SandyBridge-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge", + "typename": "SandyBridge-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Penryn-v1", + "typename": "Penryn-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Penryn", + "typename": "Penryn-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G5-v1", + "typename": "Opteron_G5-v1-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4", + "tbm", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G5", + "typename": "Opteron_G5-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4", + "tbm" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G4-v1", + "typename": "Opteron_G4-v1-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G4", + "typename": "Opteron_G4-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G3-v1", + "typename": "Opteron_G3-v1-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G3", + "typename": "Opteron_G3-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G2-v1", + "typename": "Opteron_G2-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G2", + "typename": "Opteron_G2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G1-v1", + "typename": "Opteron_G1-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G1", + "typename": "Opteron_G1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem-v2", + "typename": "Nehalem-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem-v1", + "typename": "Nehalem-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem-IBRS", + "typename": "Nehalem-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem", + "typename": "Nehalem-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "KnightsMill-v1", + "typename": "KnightsMill-v1-x86_64-cpu", + "unavailable-features": [ + "avx512pf", + "avx512er", + "avx512-vpopcntdq", + "avx512-4vnniw", + "avx512-4fmaps" + ], + "static": false, + "migration-safe": true + }, + { + "name": "KnightsMill", + "typename": "KnightsMill-x86_64-cpu", + "unavailable-features": [ + "avx512pf", + "avx512er", + "avx512-vpopcntdq", + "avx512-4vnniw", + "avx512-4fmaps" + ], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge-v2", + "typename": "IvyBridge-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge-v1", + "typename": "IvyBridge-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge-IBRS", + "typename": "IvyBridge-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge", + "typename": "IvyBridge-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Server-v1", + "typename": "Icelake-Server-v1-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512vnni", + "avx512bitalg", + "avx512-vpopcntdq", + "la57", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Server", + "typename": "Icelake-Server-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512vnni", + "avx512bitalg", + "avx512-vpopcntdq", + "la57", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Client-v1", + "typename": "Icelake-Client-v1-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512vnni", + "avx512bitalg", + "avx512-vpopcntdq", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Client", + "typename": "Icelake-Client-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512vnni", + "avx512bitalg", + "avx512-vpopcntdq", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-v4", + "typename": "Haswell-v4-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-v3", + "typename": "Haswell-v3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-v2", + "typename": "Haswell-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-v1", + "typename": "Haswell-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-noTSX-IBRS", + "typename": "Haswell-noTSX-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-noTSX", + "typename": "Haswell-noTSX-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-IBRS", + "typename": "Haswell-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell", + "typename": "Haswell-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "EPYC-v2", + "typename": "EPYC-v2-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "ibpb", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "EPYC-v1", + "typename": "EPYC-v1-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "EPYC-IBPB", + "typename": "EPYC-IBPB-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "ibpb" + ], + "static": false, + "migration-safe": true + }, + { + "name": "EPYC", + "typename": "EPYC-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Dhyana-v1", + "typename": "Dhyana-v1-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "ibpb", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Dhyana", + "typename": "Dhyana-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "ibpb", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Conroe-v1", + "typename": "Conroe-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Conroe", + "typename": "Conroe-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Cascadelake-Server-v2", + "typename": "Cascadelake-Server-v2-x86_64-cpu", + "unavailable-features": [ + "avx512vnni", + "rdctl-no", + "ibrs-all", + "mds-no" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Cascadelake-Server-v1", + "typename": "Cascadelake-Server-v1-x86_64-cpu", + "unavailable-features": [ + "avx512vnni" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Cascadelake-Server", + "typename": "Cascadelake-Server-x86_64-cpu", + "unavailable-features": [ + "avx512vnni" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-v4", + "typename": "Broadwell-v4-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-v3", + "typename": "Broadwell-v3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-v2", + "typename": "Broadwell-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-v1", + "typename": "Broadwell-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-noTSX-IBRS", + "typename": "Broadwell-noTSX-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-noTSX", + "typename": "Broadwell-noTSX-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-IBRS", + "typename": "Broadwell-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell", + "typename": "Broadwell-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "486-v1", + "typename": "486-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "486", + "typename": "486-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + } + ], + "id": "definitions" +} diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.sig b/tests/cput= estdata/x86_64-cpuid-Xeon-Gold-6130.sig new file mode 100644 index 0000000000..1a3f3449f0 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.sig @@ -0,0 +1,4 @@ +050654 +family: 6 (0x06) +model: 85 (0x55) +stepping: 4 (0x04) diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.xml b/tests/cput= estdata/x86_64-cpuid-Xeon-Gold-6130.xml new file mode 100644 index 0000000000..cb9233ee22 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.26.0 From nobody Mon May 6 21:00:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585316759; cv=none; d=zohomail.com; s=zohoarc; b=U19rcbb97YuCAJpPFy1ga16ZbmorOHAoHklrq2yMx65j3De3kqzMhffQ1ax+yjL6DYJ4R9MhwSF8gtwH+Nu25DZruaF89U8pQi8+KRohjC2KW6zvzqZ8tWo1eN7uriC5+VdWOifUBSa9FxrhH40UzcwU081DbRKbR4aLhA6T0c4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316759; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=W2NDrVDC3o1IWKWEGdNsvXa5Qr+0KU0mQy2gz6+VGqM=; b=QFH+ac+iX16jZeNlMXO4akRFLmqsYrKxeJn6YQUQGuCEofTQ01dZryS7mMOoLxbZ/7iN4mQX/u/KzV2Lw4gXVNq5ffekezjWaCg8awiq97HoomP4GhPO7gd/szNIZbxYKtck+unkvDbSZ+5G3XOe+Cc+RNpAlBi4o2PTDKCi+Qg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585316759670581.9972897825747; Fri, 27 Mar 2020 06:45:59 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-74-1Tr6qzifOQe840g3_Su0uA-1; Fri, 27 Mar 2020 09:45:55 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6721E801E7B; Fri, 27 Mar 2020 13:45:50 +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 3BE4C5C219; Fri, 27 Mar 2020 13:45:50 +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 E56FA1800BB2; Fri, 27 Mar 2020 13:45:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiPaJ006455 for ; Fri, 27 Mar 2020 09:44:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2C1915C219; Fri, 27 Mar 2020 13:44:25 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C95705C1D8 for ; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 4091618FA8D; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316758; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=W2NDrVDC3o1IWKWEGdNsvXa5Qr+0KU0mQy2gz6+VGqM=; b=XOeGMoUK8y75s7onXRv7eAzdB/VjZJ3qzKulj6m5H4eVWuzVbIC7/+pqg1SkQqqYo5OE5w IBDwfWSYGGgZ2ZIoFum4cdL7DrynBBAOTyT5mBDeK7wkSfC1fobfnwIXg7AoHiHu6Ifub6 r2NGwiZoe6VgOAUwdk0+gBartoBpwvk= X-MC-Unique: 1Tr6qzifOQe840g3_Su0uA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 39/39] cpu_map: Distinguish Cascadelake-Server from Skylake-Server Date: Fri, 27 Mar 2020 14:44:08 +0100 Message-Id: <07c7d82bd9345eeb2c65f8961ef5d22247237adc.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The signatures of these two CPU model differ only in stepping as both report family 6 and model 85. Skylake-Server uses stepping 4 or less and Cascadelake-Server uses stepping 5..7. https://bugzilla.redhat.com/show_bug.cgi?id=3D1761678 Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu_map/x86_Cascadelake-Server-noTSX.xml | 2 +- src/cpu_map/x86_Cascadelake-Server.xml | 2 +- src/cpu_map/x86_Skylake-Server-IBRS.xml | 2 +- src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml | 2 +- src/cpu_map/x86_Skylake-Server.xml | 2 +- tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml | 5 +++-- tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml | 5 +++-- 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/cpu_map/x86_Cascadelake-Server-noTSX.xml b/src/cpu_map/x86= _Cascadelake-Server-noTSX.xml index 459174a30d..bfd4629836 100644 --- a/src/cpu_map/x86_Cascadelake-Server-noTSX.xml +++ b/src/cpu_map/x86_Cascadelake-Server-noTSX.xml @@ -1,7 +1,7 @@ - + diff --git a/src/cpu_map/x86_Cascadelake-Server.xml b/src/cpu_map/x86_Casca= delake-Server.xml index d7ec42f57e..335e9cb584 100644 --- a/src/cpu_map/x86_Cascadelake-Server.xml +++ b/src/cpu_map/x86_Cascadelake-Server.xml @@ -1,7 +1,7 @@ - + diff --git a/src/cpu_map/x86_Skylake-Server-IBRS.xml b/src/cpu_map/x86_Skyl= ake-Server-IBRS.xml index bd6b6457ad..9fb3488809 100644 --- a/src/cpu_map/x86_Skylake-Server-IBRS.xml +++ b/src/cpu_map/x86_Skylake-Server-IBRS.xml @@ -1,7 +1,7 @@ - + diff --git a/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml b/src/cpu_map/x8= 6_Skylake-Server-noTSX-IBRS.xml index c2b7de40e8..c162c0acc3 100644 --- a/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml +++ b/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml @@ -1,7 +1,7 @@ - + diff --git a/src/cpu_map/x86_Skylake-Server.xml b/src/cpu_map/x86_Skylake-S= erver.xml index f96875a85f..e022d94c84 100644 --- a/src/cpu_map/x86_Skylake-Server.xml +++ b/src/cpu_map/x86_Skylake-Server.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml b/test= s/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml index cfb0eb982d..c21cb1e600 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml @@ -1,5 +1,5 @@ - Cascadelake-Server + Skylake-Server-IBRS Intel @@ -20,14 +20,15 @@ + + - diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml b/tests= /cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml index 968d904557..b482043ccf 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml @@ -1,16 +1,17 @@ - Cascadelake-Server + Skylake-Server-IBRS Intel + + - --=20 2.26.0