From nobody Fri Apr 26 22:43:14 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=1600246780; cv=none; d=zohomail.com; s=zohoarc; b=U+Mziv4P48R/rcpQ1RUlNDQqXf4yYMrBZlcsGfKubU72ktwNpaED30VSsUZt72JR8bmN65zw4djRMijpkV1iWvnVxYb33UMxXcl/4oAMQGTL3FxXNbHEOsW7JXAPwvyd5GRqklTo1vrNZhoU2rrPWov3sERCOnBxGVxPM9kdOUc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600246780; 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=HmAB1YFAUiqohBZNc+ClfECfWWJbUi9URog2BiNxZXM=; b=LIH1V3CRjkVNyVjcPUw5gq2I1EDcF4aRUZcbZSVFoPlf5jHtfSkigH8uBhTPLUK/nYwHjap7bWed8+A/aL+rzFoM8d1rl+b+C2jBe2zV+KvkmRVSgeYmk8c4BcmNboIjPjLMYt77cScqII/0SlFDutaFUBGOL/VofXIT8CGd6S0= 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 1600246780321293.38812154106984; Wed, 16 Sep 2020 01:59: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-75-LMRS8tdFP3GAZnvNNmhXag-1; Wed, 16 Sep 2020 04:59:37 -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 3BB3BEA335; Wed, 16 Sep 2020 08:59:31 +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 9D92568D6A; Wed, 16 Sep 2020 08:59:30 +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 5785044A65; Wed, 16 Sep 2020 08:59:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08G8wfLT003977 for ; Wed, 16 Sep 2020 04:58:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8C6BFF41AC; Wed, 16 Sep 2020 08:58:41 +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 8797FF1C98 for ; Wed, 16 Sep 2020 08:58:39 +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 2996C101A53F for ; Wed, 16 Sep 2020 08:58:39 +0000 (UTC) Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-oln040092253069.outbound.protection.outlook.com [40.92.253.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-108-40Ohn1POObK7hJya-L6oaQ-1; Wed, 16 Sep 2020 04:58:36 -0400 Received: from HK2APC01FT040.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebc::49) by HK2APC01HT005.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebc::90) 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 08:58:33 +0000 Received: from OSYP286MB0181.JPNP286.PROD.OUTLOOK.COM (2a01:111:e400:7ebc::42) by HK2APC01FT040.mail.protection.outlook.com (2a01:111:e400:7ebc::298) 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 08:58:33 +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 08:58:33 +0000 Received: from localhost.localdomain (119.8.114.27) by HK0PR01CA0053.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.13 via Frontend Transport; Wed, 16 Sep 2020 08:58:32 +0000 X-MC-Unique: LMRS8tdFP3GAZnvNNmhXag-1 X-MC-Unique: 40Ohn1POObK7hJya-L6oaQ-1 X-IncomingTopHeaderMarker: OriginalChecksum:4B6F721955741DE61BA88A32D910E0E28214CF3049CF0DCB80E2C3CCC40F0532; UpperCasedChecksum:F09E869A5AD042C78DA9022EC04E34E738A35FF6B30592B2AA5F59C0F4DE9080; SizeAsReceived:3295; Count:46 From: Zhenyu Zheng To: libvir-list@redhat.com Subject: [PATCH V3] Modify virCPUarmCompare to perform compare actions Date: Wed, 16 Sep 2020 16:58:03 +0800 Message-ID: X-ClientProxiedBy: HK0PR01CA0053.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::17) To OSYP286MB0181.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:92::16) X-Microsoft-Original-Message-ID: <20200916085803.30207-1-zheng.zhenyu@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Microsoft-Original-Message-ID: <20200916085803.30207-1-zheng.zhenyu@outlook.com> X-TMN: [FncneXlEtywRXqUaIFyqIJwDP2eyS8yL] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 605cec69-761b-42fd-5d0f-08d85a1eb07e X-MS-TrafficTypeDiagnostic: HK2APC01HT005: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: L4G9DCfhWWotEiaAXh3bvogBSKNuWOsBM8bEz2UFvmxLTaDgToRSz+wRnLoV6D12SnrG95KHq8IgTKuWYhPzZuWw4BNZeZyRnlfN14LeZbmlKpsGNiIlj0ktPlimHjfjzTEliz/+lkfhU033gJCUfsJI9vDOWX+1SSxCIXISrSTE0MENdT+GNlva6RQTSIHa X-MS-Exchange-AntiSpam-MessageData: 1DUwUEtALFIvjeW17DGmQIQIBmpf7OF/zaAWpA38bWu8smyb+H80Lk6kwRVo+sN/qK91UjrjGsC0pckFVjwTa6indwKS7KRMIeIEH47qhQrOe1DWWvznLZpzBkdp82L5iuonq2UajeTrL9AcJ3iBMg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 605cec69-761b-42fd-5d0f-08d85a1eb07e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 08:58:33.0958 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HK2APC01FT040.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: HK2APC01HT005 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.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 08G8wfLT003977 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.16 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 | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index 939a3b8390..b420b14e86 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -463,11 +463,46 @@ 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; + 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 (failIncompatible) { + ret =3D VIR_CPU_COMPARE_ERROR; + virReportError(VIR_ERR_CPU_INCOMPATIBLE, + _("Host CPU model does not match required CPU m= odel %s"), + cpu->model); + } else { + ret =3D VIR_CPU_COMPARE_INCOMPATIBLE; + } + } + + return ret; } =20 static int --=20 2.20.1