From nobody Mon May 6 11:51:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1600956839; cv=none; d=zohomail.com; s=zohoarc; b=G/AWnagRy7VCBw9hrLMYdNXL3EOgbya0k7F8BxzT8pByHvYDkvNme+JdPOsckQ3OtrbodjmxXUjUNYPjjC5Dzipabqnq0G0kBu7XJWajAS1+XhwCveo/qhkyM0vyMqaPxTZBf49WthLOv6POWVb8siG00Rj9Yjn0Iv0i7dnTRks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600956839; 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=AGTFZsYfSnAqI7gtnVh+Mx9wB3axqSqKoiyUgyBLFEM=; b=HAKA5ncBcBI8otNm8b7/ONpvikblLQlO/MWsGsd68WLvgK+V/5Ie+GH9SFYz+RzLV8YgIWSTTIZcUX5LKY6RVlriMlrjN+Vn9uqjozT1BA3V6Julaey45TbNVCCmstug3FfA6gGx4gkoAqHGUNFHO2zoPuFKagmXvP5TjYwl7Q0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1600956839678323.10718983342895; Thu, 24 Sep 2020 07:13: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-329-XvL3SG2TPtuLl1fVRu82xg-1; Thu, 24 Sep 2020 10:13:56 -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 4697480B71B; Thu, 24 Sep 2020 14:13: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 15AF55576C; Thu, 24 Sep 2020 14:13: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 9D8421826D2B; Thu, 24 Sep 2020 14:13:49 +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 08OED3UI030794 for ; Thu, 24 Sep 2020 10:13:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3C5F82028DCC; Thu, 24 Sep 2020 14:13:03 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 36166200A7CD for ; Thu, 24 Sep 2020 14:13:00 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 BD5DF858298 for ; Thu, 24 Sep 2020 14:13:00 +0000 (UTC) Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-oln040092253020.outbound.protection.outlook.com [40.92.253.20]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-24-PHNiVk0FM9eisUWFM1Z53g-1; Thu, 24 Sep 2020 10:12:58 -0400 Received: from HK2APC01FT044.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebc::40) by HK2APC01HT022.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebc::376) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21; Thu, 24 Sep 2020 14:12:54 +0000 Received: from OSYP286MB0181.JPNP286.PROD.OUTLOOK.COM (2a01:111:e400:7ebc::4c) by HK2APC01FT044.mail.protection.outlook.com (2a01:111:e400:7ebc::371) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Thu, 24 Sep 2020 14:12:54 +0000 Received: from OSYP286MB0181.JPNP286.PROD.OUTLOOK.COM ([fe80::959a:13d8:e2ce:477f]) by OSYP286MB0181.JPNP286.PROD.OUTLOOK.COM ([fe80::959a:13d8:e2ce:477f%5]) with mapi id 15.20.3412.020; Thu, 24 Sep 2020 14:12:54 +0000 Received: from localhost.localdomain (119.8.114.27) by HK2PR02CA0201.apcprd02.prod.outlook.com (2603:1096:201:20::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Thu, 24 Sep 2020 14:12:53 +0000 X-MC-Unique: XvL3SG2TPtuLl1fVRu82xg-1 X-MC-Unique: PHNiVk0FM9eisUWFM1Z53g-1 X-IncomingTopHeaderMarker: OriginalChecksum:5B84257F3F190C5F758804E4206092C593644FB3F9C2E40F57D7E6286448F544; UpperCasedChecksum:F951B882D9773B2A253CD0336536A6A872CC277EA1E59421D1A50318CFD82158; SizeAsReceived:7409; Count:47 From: Zhenyu Zheng To: libvir-list@redhat.com Subject: [PATCH V4] Modify virCPUarmCompare to perform compare actions Date: Thu, 24 Sep 2020 22:12:21 +0800 Message-ID: X-ClientProxiedBy: HK2PR02CA0201.apcprd02.prod.outlook.com (2603:1096:201:20::13) To OSYP286MB0181.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:92::16) X-Microsoft-Original-Message-ID: <20200924141221.28580-1-zheng.zhenyu@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Microsoft-Original-Message-ID: <20200924141221.28580-1-zheng.zhenyu@outlook.com> X-TMN: [rQd8PWhelf97q1G9TNTZD9knV9jjdD+3] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: a1a7f4c0-d927-4c11-3c4b-08d86093edf4 X-MS-Exchange-SLBlob-MailProps: +LiGfBxqLEsdIHHT6tlUF2HDtdZ+QuYNsgPHqW2RBzwq9qlmUt/8BmpCE0g+n7mqqnSbs6XVpvIhxLTw5kkCNRYls0OdkisP4dYQQEb+Odxm4Iq3YQNW6aSXrwSWT8nC+jAPI44+ZzDsGNGsox/wxC9hfDQGDA+1GveSHT809cXL3ypBYMTKh+8z9Kptzi4P7GTpP2aENPy8aDdLazE/sCQt16f4scog3hlzOj4lPt1R3eW3DZyQhM8/0XFcfFzBWENVX/owPBtiNKjFmem5cweHbzVhHMiE3i/qH8Pk9C3SBEEX2iIe5IgMIoPeMYlYc+1hTLbKgwDPn0QOUQXI2xiW15N06LGvBwfir4tn8qR/6F0Xs0T3N/+CvmUnkoz5G0YmYAqbPL1zMHc5Tv30bJbiS86HLb1x9+yqdn3+3bkg0HKDYSGr6MXQKNn4b0DgN5O1j9lcow2vKAMwKqDO7zrZXP+TV3dquwL5RGFVefAW50AfJs8wvpeJ6UORyYOnkN+W8+GDAveOqW9xzIIAoGwGKdwEFahR5Wo7YsObV6XWoMEhdi6+Dqb0jAYgZSmzQqVqMYOcbwg5fe1587W2yWxZbQhXfC8NEqUoh7dOdMxe5W3xd+9T8J/9iBi2R2lfEWNaqWXSmXwGLgY0pYNiE3FTD850djsjGRQa1Lf2T5L+iwdI1Be5tvefj+2l3Lii2FCT0tEyYxevKJfuQCW3821xJTdVxi1KsLXCtRA4GcWOg/QvhO44migTzhyLph3jOCCD2Mk2F0PyBrFahAddY+Q1toe40B5N X-MS-TrafficTypeDiagnostic: HK2APC01HT022: X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: UHGYipr31Z0nFvsob9sg0iyb0oFv8Qm1EUMTauLqN2uy8tfN2CLoqMzKrtV9g0kYOV5dSCC7Se+IR4cZ/LGpL93/hRJM0JrsdLC92ig9yNrTrXVnEbiPan7auAdGvABZeGp0dJstji64ySiBSga/MGy4m/TQ6k1HsMBGLSaTDX7yurQzbS+RI/91jBkRaVnGqJ0tOarkyNyzt1QP6j8CAg== X-MS-Exchange-AntiSpam-MessageData: 60hBg5psqrBoVlUSM+WQV/XYDy5Stw4EaSupKHA1bKyrBwMZHMTCTLRIIx/Df/adAwbID5SEZbNmMHRJq+Yb6yg1AAFRMItHTt2GvJ4YZjC2njMlDf9C3ZmxnLdwii7u1a4aBEQ1qfYkc+FawaxbZw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a1a7f4c0-d927-4c11-3c4b-08d86093edf4 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2020 14:12:54.3940 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HK2APC01FT044.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: HK2APC01HT022 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 08OED3UI030794 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.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 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 Reviewed-by: Daniel Henrique Barboza --- src/cpu/cpu_arm.c | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index 939a3b8390..64bd0f03c2 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -463,10 +463,43 @@ 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 +) { + /* Only support host to host CPU compare for ARM*/ + if (cpu->type !=3D VIR_CPU_TYPE_HOST) + return VIR_CPU_COMPARE_IDENTICAL; + + if (!host || !host->model) { + if (failIncompatible) { + virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", + _("unknown host CPU")); + return VIR_CPU_COMPARE_ERROR; + } else { + VIR_WARN("unknown host CPU"); + return VIR_CPU_COMPARE_INCOMPATIBLE; + } + } + + /* Compare vendor and model to check if CPUs are identical */ + if (STRNEQ_NULLABLE(host->vendor, cpu->vendor) || + STRNEQ_NULLABLE(host->model, cpu->model)) { + VIR_DEBUG("Host CPU model does not match required CPU " + "vendor %s or(and) model %s", + NULLSTR(cpu->vendor), NULLSTR(cpu->model)); + + if (failIncompatible) { + virReportError(VIR_ERR_CPU_INCOMPATIBLE, + _("Host CPU model does not match required CPU " + "vendor %s or(and) model %s"), + NULLSTR(cpu->vendor), NULLSTR(cpu->model)); + return VIR_CPU_COMPARE_ERROR; + } else { + return VIR_CPU_COMPARE_INCOMPATIBLE; + } + } return VIR_CPU_COMPARE_IDENTICAL; } =20 --=20 2.20.1