From patchwork Wed Sep 16 03:04:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhenyu Zheng X-Patchwork-Id: 312075 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp90398ilg; Tue, 15 Sep 2020 20:06:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZWYKmLpNDfCLzH0HTZB7EBRJ6SV2I5VYmrMsY0c1m+XfuywyvpgzdB/uvXp+uIupUei7I X-Received: by 2002:a17:906:6b0b:: with SMTP id q11mr24031945ejr.412.1600225566419; Tue, 15 Sep 2020 20:06:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600225566; cv=none; d=google.com; s=arc-20160816; b=TgKim2/lz8lDNiYxFE8RwaGC3EBPbHHGjROhGIa1o4kvkz3FYmgPBeCXocweRhe1S3 DdxdFWX5DlcubzvSGD6KW1EyWwVkdmxGJz5NX4+tmEpMgIv2m40cgfFR5YE1+s3aPi45 wZQI0Eug2HZebhdt+6rxqeN/P6pJjsPVdeo7dKabGdCz8J0TQZP2uGasWFKvurv3aAPk 2IhjpGiLFQuP52D9nlE3kXncnsBaoIdQPcA0pFez8ObuLznTQAVLqTEzmLtsog66amN+ U3S1Wd7mjkGSYQ/RbTvAdmMT9bR0pBVx/msqAPsKoF8WYPzoSxZtyVJB2DLTTJmqeePp e+lA== 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=FA2oybLxLfv/ouHOndkUjxGz2b2IdyjKFTOtQpA8aLA=; b=BhT73lSe36GVRUuF0fesKGIMJaa1SOvCFkd32v/DDutm0oMe1hjU9FLg+6G+KnyDRt E9h6Nff/LOMopsubrujcvMjti4vXUovcopRBwqpPcPjd1YHgtDT9ZAegtqAM5y1wQdFd YksCanZcq1MmYjASt9qlxuuoeymMd8zVDcV0Axn6tt4ObnnjpJOQhNfDvXeiXr4gr5ae VQOdFtHkAddqL79AvxZfu5zvJNnrsI1HDkG2iCL2hUaHw7RPFflk+lK+/pC/ovlktT2a 7y2q8PbiTrIwDt5/rZKBLpPatO9CgQKBUDZzFUzGWXXiJ+K6j0JRf/gqTGMisH5zfYkP W5SQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-1.mimecast.com. [207.211.31.81]) by mx.google.com with ESMTPS id t19si11123724ejb.646.2020.09.15.20.06.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Sep 2020 20:06:06 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 207.211.31.81 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-259-ahaZSs7wPKmd3ObgULBNmA-1; Tue, 15 Sep 2020 23:06:02 -0400 X-MC-Unique: ahaZSs7wPKmd3ObgULBNmA-1 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) 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 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 X-MC-Unique: Dd-foMigMZyFLMDtFEOu9A-1 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 X-IncomingTopHeaderMarker: OriginalChecksum:3B8A641AAF0EC511156AF8BDA518E85664690C5866E807767FCAAB1FAC7BD329; UpperCasedChecksum:752917867DCEE19D2560F68018C1BD346CFD17E76D36AB622B34E24BA2A72B67; SizeAsReceived:3283; 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 03:05:34 +0000 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 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-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 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(-) -- 2.20.1 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, } 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 = NULL; + 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 (message) { + message = g_strdup_printf(_("host CPU model does not match required " + "CPU model %s"), + cpu->model); + } + + ret = VIR_CPU_COMPARE_INCOMPATIBLE; + } + + if (failIncompatible && ret == VIR_CPU_COMPARE_INCOMPATIBLE) { + ret = VIR_CPU_COMPARE_ERROR; + if (message) { + virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message); + } else { + virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL); + } + } + + return ret; } static int