From patchwork Wed Sep 16 08:58:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhenyu Zheng X-Patchwork-Id: 312253 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp264704ilg; Wed, 16 Sep 2020 01:59:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdupjV/fG8k6gdMkER2l5MK08eCr8VCovugH/jS02GGe4G86ir9uZBpuB42t85UDyIYiPp X-Received: by 2002:a05:6402:17ec:: with SMTP id t12mr25503260edy.328.1600246780676; Wed, 16 Sep 2020 01:59:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600246780; cv=none; d=google.com; s=arc-20160816; b=kYz+PXcMNlyhykIn3REyVLKuGHGpwPsCfNwLzZgodM3OBUaBlFPoVAZ5VltmcFwkEa xCrjHqww+IRsGEefXB7z6YeWSksXcP85TB8URf4u39o+iHPvEdlWV44kuOEXHKAizHBI nOoElJ36doygJzLV7iilG4t4VV+pfvw37CcNin1d1mMHjycToE6261bUqp1dZ8lwhE1e VJMy3/Jqc3E/YeLozQaFpSPel4KuaNkafHr/s0EbWfhWytb/8KJxNMXp2RkvT/bsoDJb PzmPmhZAtTdSgghSndeoChhNkdfQfCsCx5fMHgKO9pz1DLbmk13IabBympX2yJukkfNi mQug== 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=HmAB1YFAUiqohBZNc+ClfECfWWJbUi9URog2BiNxZXM=; b=hMiriYTA0K1va6kLTFxXnSlvzH7U7oJFz/jWmhMhAk95byPCjVxU1CPbrDzrPGy63Q V3imBthPJ+3XdrYBQo1fx0SDG4KC7ki1mfI5pbNyQlaFP4Dp5+p2+HOQNmQtf/dMEyMu lFBH2Hb1LYi9zw2Die30dGUHOtJUvRv3TTVkpnHIetc5OJMwV8jDbL2Magzu3sEZ2TFR W/IwMVPmx+0xZ5VUa6P7SrthtMv3KuCkhKTynQvKuiFZdXgswN/QG2577sYzgyxnJ6UN nNLFsqsTa6C1eG4ZN1LwOwRRY3ugPwk8g0MxLV1r6j+mJlm8KjAShEouOWoMHca/9GGY pExA== 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 f18si11713359edm.539.2020.09.16.01.59.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Sep 2020 01:59:40 -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-75-LMRS8tdFP3GAZnvNNmhXag-1; Wed, 16 Sep 2020 04:59:37 -0400 X-MC-Unique: LMRS8tdFP3GAZnvNNmhXag-1 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) Delivered-To: libvir-list@redhat.com 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 X-MC-Unique: 40Ohn1POObK7hJya-L6oaQ-1 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 X-IncomingTopHeaderMarker: OriginalChecksum:4B6F721955741DE61BA88A32D910E0E28214CF3049CF0DCB80E2C3CCC40F0532; UpperCasedChecksum:F09E869A5AD042C78DA9022EC04E34E738A35FF6B30592B2AA5F59C0F4DE9080; SizeAsReceived:3295; Count:46 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 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 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-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 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(-) -- 2.20.1 Signed-off-by: Zhenyu Zheng <zheng.zhenyu@outlook.com>
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, } 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 = VIR_CPU_COMPARE_IDENTICAL; + + /* Only support host to host CPU compare for ARM*/ + if (cpu->type != VIR_CPU_TYPE_HOST) + return ret; + + if (!host || !host->model) { + if (failIncompatible) { + virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", + _("unknown host CPU")); + ret = VIR_CPU_COMPARE_ERROR; + } else { + VIR_WARN("unknown host CPU"); + ret = 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 = VIR_CPU_COMPARE_ERROR; + virReportError(VIR_ERR_CPU_INCOMPATIBLE, + _("Host CPU model does not match required CPU model %s"), + cpu->model); + } else { + ret = VIR_CPU_COMPARE_INCOMPATIBLE; + } + } + + return ret; } static int