From patchwork Thu Sep 24 14:12:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhenyu Zheng X-Patchwork-Id: 313462 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp279286ilg; Thu, 24 Sep 2020 07:14:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJ+fAPPCShw39rOkk/NWBzzZ1xorIpY+NIG7FISunBKlBFREGhtdllWoGsyM24nTP3z38c X-Received: by 2002:a17:906:4bd7:: with SMTP id x23mr128328ejv.92.1600956839895; Thu, 24 Sep 2020 07:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600956839; cv=none; d=google.com; s=arc-20160816; b=b+47s1T2kHTfjDg4FORktMt5nAz6QTT4aglhkUKm7w7heZhKVZxSjIVVbOXQsN931F QKN0V6CRgJIc7u8qReR0RF5yg7j5yCPNcgK6KXZhdgejmQiFzgGJ3683mlUmjlAWH8R8 UAwZDstPzy6E1Ao2on6I0MyiDv7W4igzEJVacEAAUQL7P9Dx3Z+4T6jArgIlYagzw5oy eyQKXIRunt2CB984WuYh4OIbfsMVYyg09/9LHmP8unslv0OPAAdaSKGz5sTuS0vmU1oK WU6L1X3m1gamHZNzql3w+10mciISCNjiN/jk+XAQeRgPDguLH/7CzWbmiYLxN68aF1MM aWoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:errors-to:sender:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:cc :mime-version:message-id:date:subject:to:from:delivered-to; bh=AGTFZsYfSnAqI7gtnVh+Mx9wB3axqSqKoiyUgyBLFEM=; b=rtnPGmD6YHO99zaavMzzqyxreax9zfsi8T1cYMLQNfEtPldLVhi9jh1V91rF6Y3qh2 G/0Sr0D5uyPa8jeWJmIPtQFF6o2ubUKmGqzPy53R1jKkrj+103SpW3IVRwobsldPx95l dj4mU0fibo8X+becujtivqz9IKssqGMEBLC/eSmgc26b/zj1QXQxCxejP/sxaeaYgyJo WT3UdusFnbAQ2Ug8pRyVqjZwVXq4Q31uSvUE9kXjiPpfOof8PbDId+uUZIY3q7rQwjLO 06/DjPUrNyOSaUch9CBLxsO/yIwVncXZR5/ntLV8geLe9cnRUDLgJ6T87jN+uS/xzS/V tOjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [216.205.24.124]) by mx.google.com with ESMTPS id mb8si1833062ejb.518.2020.09.24.07.13.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Sep 2020 07:13:59 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com 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 X-MC-Unique: XvL3SG2TPtuLl1fVRu82xg-1 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) Delivered-To: libvir-list@redhat.com 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 X-MC-Unique: PHNiVk0FM9eisUWFM1Z53g-1 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 X-IncomingTopHeaderMarker: OriginalChecksum:5B84257F3F190C5F758804E4206092C593644FB3F9C2E40F57D7E6286448F544; UpperCasedChecksum:F951B882D9773B2A253CD0336536A6A872CC277EA1E59421D1A50318CFD82158; SizeAsReceived:7409; Count:47 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 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 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-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 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 | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) -- 2.20.1 Reviewed-by: Daniel Henrique Barboza 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, } 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 != 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; }