From nobody Fri Apr 19 22:20:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=outlook.com ARC-Seal: i=1; a=rsa-sha256; t=1600225566; cv=none; d=zohomail.com; s=zohoarc; b=lHF/6H0XnxIrnuXgZB5GekuQ9abrbe7duJP9PZqHv4Wn84dxnStSrdXpswqvLDT+2YIT72R3FxAGh8WBAHt+IKZLpBucMXZoNWUEeyGHv+lo8f9HUmNKBVl2+gvVf0rc+cXj0TIiNXpu/oewx2VyD0XHS0rkHRhRugsHJG1/Yr4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600225566; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=FA2oybLxLfv/ouHOndkUjxGz2b2IdyjKFTOtQpA8aLA=; b=QCMxCbDa2ghijdHlByLibAf+rsoAZwR7hymhNkSmtLd2keTBsNTYN6F+wuW6iFEYq4vi7n9caPTIZ6SqkuzRsQRRQ8eLQG0w/S0r3wORMxDJM/qbORpRHf9YvCR6qnjVB8BWWLjS+NjGXLMEauPmbtflm0P1EGGRJtcnxZWKC0s= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1600225566390759.9892099607283; Tue, 15 Sep 2020 20:06: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-259-ahaZSs7wPKmd3ObgULBNmA-1; Tue, 15 Sep 2020 23:06:02 -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 812D9425D4; Wed, 16 Sep 2020 03:05:55 +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 1B9171002D4E; Wed, 16 Sep 2020 03:05:52 +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 8D1FE44A5E; Wed, 16 Sep 2020 03:05:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08G35gwD028898 for ; Tue, 15 Sep 2020 23:05:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id A0BB02024508; Wed, 16 Sep 2020 03:05:42 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99B1220244F7 for ; Wed, 16 Sep 2020 03:05:40 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 38CD2101A53F for ; Wed, 16 Sep 2020 03:05:40 +0000 (UTC) Received: from APC01-PU1-obe.outbound.protection.outlook.com (mail-oln040092254049.outbound.protection.outlook.com [40.92.254.49]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-441-Dd-foMigMZyFLMDtFEOu9A-1; Tue, 15 Sep 2020 23:05:37 -0400 Received: from HK2APC01FT051.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebc::50) by HK2APC01HT068.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebc::471) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Wed, 16 Sep 2020 03:05:34 +0000 Received: from OSYP286MB0181.JPNP286.PROD.OUTLOOK.COM (2a01:111:e400:7ebc::42) by HK2APC01FT051.mail.protection.outlook.com (2a01:111:e400:7ebc::224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16 via Frontend Transport; Wed, 16 Sep 2020 03:05:34 +0000 Received: from OSYP286MB0181.JPNP286.PROD.OUTLOOK.COM ([fe80::959a:13d8:e2ce:477f]) by OSYP286MB0181.JPNP286.PROD.OUTLOOK.COM ([fe80::959a:13d8:e2ce:477f%6]) with mapi id 15.20.3391.011; Wed, 16 Sep 2020 03:05:34 +0000 Received: from localhost.localdomain (119.8.114.27) by HK2PR06CA0022.apcprd06.prod.outlook.com (2603:1096:202:2e::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16 via Frontend Transport; Wed, 16 Sep 2020 03:05:33 +0000 X-MC-Unique: ahaZSs7wPKmd3ObgULBNmA-1 X-MC-Unique: Dd-foMigMZyFLMDtFEOu9A-1 X-IncomingTopHeaderMarker: OriginalChecksum:3B8A641AAF0EC511156AF8BDA518E85664690C5866E807767FCAAB1FAC7BD329; UpperCasedChecksum:752917867DCEE19D2560F68018C1BD346CFD17E76D36AB622B34E24BA2A72B67; SizeAsReceived:3283; Count:46 From: Zhenyu Zheng To: libvir-list@redhat.com Subject: [PATCH V2] Modify virCPUarmCompare to perform compare actions Date: Wed, 16 Sep 2020 11:04:58 +0800 Message-ID: X-ClientProxiedBy: HK2PR06CA0022.apcprd06.prod.outlook.com (2603:1096:202:2e::34) To OSYP286MB0181.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:92::16) X-Microsoft-Original-Message-ID: <20200916030458.6570-1-zheng.zhenyu@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Microsoft-Original-Message-ID: <20200916030458.6570-1-zheng.zhenyu@outlook.com> X-TMN: [Tk5OJGlohIoSaV2zJ4Xh9sukuesbU9l2] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: d6e6f16f-0488-4591-9e14-08d859ed60ce X-MS-TrafficTypeDiagnostic: HK2APC01HT068: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ld31EbrvVU0UTEOdtcF7PvdjQMAV3+69FBVWOZFKaHAokwhhj2j49WOjFOJfcFTFSUujMhcQejm4vkYLieU46CvFpZwf+B05IQkD7bRgTkWEWGTfaOFDV1Ji2COmWcCkAT9swIo/5Dv3jEwS1tdFSd7gl/CRP5AHSd9I/831UkWJrm1bfnaAVM8NYNyfEcAg X-MS-Exchange-AntiSpam-MessageData: GwVFx4Wr63IG9Oz2MUB5ZnyhRoE+G1uQGN3L74jlKpTxGqzhIp/5Qweu7aF8XdcNGYpUz++Odd3W1Hj9LZKkdSiZiSO61WH1vEbj97yKY2QygKY5zmxo1eVQE2oZ8FpVtOyXptibxRTB5PpP0F79GA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6e6f16f-0488-4591-9e14-08d859ed60ce X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 03:05:34.0524 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HK2APC01FT051.eop-APC01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2APC01HT068 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false; X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 08G35gwD028898 X-loop: libvir-list@redhat.com Cc: Zhenyu Zheng 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.003 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Modify virCPUarmCompare in cpu_arm.c to perform compare action. This patch only adds host to host CPU compare, the rest cases remains the same. This is useful for source and destination host compare during migrations to avoid migration between different CPU models that have different CPU freatures. Signed-off-by: Zhenyu Zheng --- src/cpu/cpu_arm.c | 51 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index 939a3b8390..e8581ec31f 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -463,11 +463,54 @@ virCPUarmBaseline(virCPUDefPtr *cpus, } =20 static virCPUCompareResult -virCPUarmCompare(virCPUDefPtr host G_GNUC_UNUSED, - virCPUDefPtr cpu G_GNUC_UNUSED, - bool failMessages G_GNUC_UNUSED) +virCPUarmCompare(virCPUDefPtr host, + virCPUDefPtr cpu, + bool failIncompatible +) { - return VIR_CPU_COMPARE_IDENTICAL; + g_autofree char *message =3D NULL; + virCPUCompareResult ret =3D VIR_CPU_COMPARE_IDENTICAL; + + /* Only support host to host CPU compare for ARM*/ + if (cpu->type !=3D VIR_CPU_TYPE_HOST) + return ret; + + if (!host || !host->model) { + if (failIncompatible) { + virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", + _("unknown host CPU")); + ret =3D VIR_CPU_COMPARE_ERROR; + } else { + VIR_WARN("unknown host CPU"); + ret =3D VIR_CPU_COMPARE_INCOMPATIBLE; + } + return ret; + } + + /* Compare vendor and model to check if CPUs are identical */ + if (STRNEQ(host->vendor, cpu->vendor) || + STRNEQ(host->model, cpu->model)) { + VIR_DEBUG("host CPU model does not match required CPU model %s", + cpu->model); + if (message) { + message =3D g_strdup_printf(_("host CPU model does not match r= equired " + "CPU model %s"), + cpu->model); + } + + ret =3D VIR_CPU_COMPARE_INCOMPATIBLE; + } + + if (failIncompatible && ret =3D=3D VIR_CPU_COMPARE_INCOMPATIBLE) { + ret =3D VIR_CPU_COMPARE_ERROR; + if (message) { + virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message); + } else { + virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL); + } + } + + return ret; } =20 static int --=20 2.20.1