From nobody Thu Apr 25 19:53:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1590177431; cv=none; d=zohomail.com; s=zohoarc; b=LZrFWipV/kK46C8woMmp6t/oKKyl9KLyThJElEeQSYOwS2SoTSPObnyKP7zlY4vDBknTSX34QvswZpqIESJfraLQVmSDx/ye3rM/PlyFkQwjj8XDGmYVTXTkvFSnz7AZReS4/z4/kJ7HBltJxy1qUtFlo1EBrT2orrrpuSzyf9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590177431; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=V0RzX6zj4HO/GRpnM66ixy0xBcGorkJBIlpLfRz0E6A=; b=jI4JDFQnNoRUmJvhZ7Z/vlrQ7qN7ZLce4F/oDMLaD1oqtxNtQwOUxYTWPLETkGDWK2c1DvlaKo2BUWO/pHZl1dhKubMs6fFgGvbSEgZ67WNNutwNWTtsqiwAodL0hKfwEM2a7MkHLHs97VcLqqoj4wAZ60Nlnc2YxNRhopblAq4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1590177431159775.288944443526; Fri, 22 May 2020 12:57:11 -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-488-QiNdo7_5Pky9kjWUzSW_BQ-1; Fri, 22 May 2020 15:57:07 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 579868018A5; Fri, 22 May 2020 19:57:02 +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 390705D9CC; Fri, 22 May 2020 19:57:02 +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 08E8A180954D; Fri, 22 May 2020 19:57:02 +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 04MJuh41030373 for ; Fri, 22 May 2020 15:56:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 020A720110DA; Fri, 22 May 2020 19:56:43 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EAC6620110C8 for ; Fri, 22 May 2020 19:56:40 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 83472801021 for ; Fri, 22 May 2020 19:56:40 +0000 (UTC) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-228-eYdMPu9AMVCkhtZzgd7WDw-1; Fri, 22 May 2020 15:56:38 -0400 Received: by mail-qt1-f195.google.com with SMTP id o19so9234467qtr.10 for ; Fri, 22 May 2020 12:56:38 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c6:e0b9:8f39:f7d8:19fe:be67]) by smtp.gmail.com with ESMTPSA id o23sm9247286qtf.53.2020.05.22.12.56.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 12:56:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590177429; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=V0RzX6zj4HO/GRpnM66ixy0xBcGorkJBIlpLfRz0E6A=; b=MuvYddUSnaLC3KU9SOwYPGXyyUnweY2aE5lSG2X2s6Nc62YftgDp09CAjigeGDiHWKGCGF 0IYrWjswKctJoL1acSklcz4x4AXeO0G/ddUq2hOjPoSOeACtLfM1HrIiJZI8HaBKBX+7RG qx5ogoBfA2phiBLEBsHJb6Bpky5kQqo= X-MC-Unique: QiNdo7_5Pky9kjWUzSW_BQ-1 X-MC-Unique: eYdMPu9AMVCkhtZzgd7WDw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V0RzX6zj4HO/GRpnM66ixy0xBcGorkJBIlpLfRz0E6A=; b=kyxJWiUGoDGNlvXSs+V/YTZhD7lW7eNbto0D2gogqX/MUmw5Ab6+VJ+dISk3bmIkQU YsXptmlaV3bo1eWBrYoaeQp41J9yaZgi/TtTTf0pv8YKNZm1xXpI2iiORMAjpMgbWnac On3Xfdq5SI8hPWXH+L4NPSJ62bkaXsq5Qp1/sHV7Jybw2fhZH6X5PxV5a60O2Kq2l/+c btWiNroJhnLyPJCPf1lmFRvDtC2xr9yioDxBh/m40TEDRVe2vVcT/KbOsC09FhnLUl+j Een/TUTeFsCfbPoUMc0OvmCy5fR/rRbZYjKpYLXO3GEY+cqxki2jkY65NNvqKCALqI1f iw3Q== X-Gm-Message-State: AOAM530ESjwf5sPinuGXUKg6KEuiSFTzG1HmH7T8zNwMNO/Te3FOMjV9 HN75H3MF9YEqE/5cg0hcPsVe092M X-Google-Smtp-Source: ABdhPJxeH8v+rlG2bsOweyL9cj+nhVsGOMWiiTUOvf1+MNRMQuLU/G02BNo6t1Se04VM3pnNj5LlwQ== X-Received: by 2002:ac8:1984:: with SMTP id u4mr10419724qtj.9.1590177397529; Fri, 22 May 2020 12:56:37 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 1/5] cpu_conf.c: modernize virCPUDefCopyWithoutModel and virCPUDefCopy Date: Fri, 22 May 2020 16:56:16 -0300 Message-Id: <20200522195620.3843442-2-danielhb413@gmail.com> In-Reply-To: <20200522195620.3843442-1-danielhb413@gmail.com> References: <20200522195620.3843442-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use automatic cleanup of variables. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Jiri Denemark --- src/conf/cpu_conf.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 07404c6fb0..c6d36e0cb5 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -227,7 +227,7 @@ virCPUDefStealModel(virCPUDefPtr dst, virCPUDefPtr virCPUDefCopyWithoutModel(const virCPUDef *cpu) { - virCPUDefPtr copy; + g_autoptr(virCPUDef) copy =3D NULL; =20 if (!cpu) return NULL; @@ -246,42 +246,34 @@ virCPUDefCopyWithoutModel(const virCPUDef *cpu) =20 if (cpu->cache) { if (VIR_ALLOC(copy->cache) < 0) - goto error; + return NULL; =20 *copy->cache =3D *cpu->cache; } =20 if (cpu->tsc) { if (VIR_ALLOC(copy->tsc) < 0) - goto error; + return NULL; =20 *copy->tsc =3D *cpu->tsc; } =20 - return copy; - - error: - virCPUDefFree(copy); - return NULL; + return g_steal_pointer(©); } =20 =20 virCPUDefPtr virCPUDefCopy(const virCPUDef *cpu) { - virCPUDefPtr copy; + g_autoptr(virCPUDef) copy =3D NULL; =20 if (!(copy =3D virCPUDefCopyWithoutModel(cpu))) return NULL; =20 if (virCPUDefCopyModel(copy, cpu, false) < 0) - goto error; - - return copy; + return NULL; =20 - error: - virCPUDefFree(copy); - return NULL; + return g_steal_pointer(©); } =20 =20 --=20 2.26.2 From nobody Thu Apr 25 19:53:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1590177421; cv=none; d=zohomail.com; s=zohoarc; b=YtzzbW2x3SYJb0n/3/ydaP81yjY5FWxbZKl/SGCOoHc4vpsGtxgX7gIQ26nqoC5TOSlwa7oLA4cpYY9PzV7yQ01ucUy97rd3clh6RtxHoFeJ9T941n/f/kh6TTA0QkfAHnRxa3tlpKe4GEmrlBEJ2y0YQVYFAX1lR3BrklZRNBs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590177421; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bnPAjZMZDZnkKAZP8u0brroRVD0yv5+KMYSN6cIT+1A=; b=QQNIThdxjCkn4y6cwmIct5VKR4ogQSfdd/RpQaRNXUjkrd9drBePbCltDZjLJL+sSwsg/JcvmkU03+9UCVGbUeq4MUJLI4N3cuoyGqoB8ediy4FV70Zec7y8PapqD2MYKSNm7Z7eqo94pDAwSul1+fyqGXrJu7mQqAZHa5f6yDk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1590177421905686.3120118152639; Fri, 22 May 2020 12:57:01 -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-152-_Ldzs_CfN4WpymrRQVbhug-1; Fri, 22 May 2020 15:56:56 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B5DB835B40; Fri, 22 May 2020 19:56:51 +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 2A79B707BA; Fri, 22 May 2020 19:56:51 +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 F220454D0B; Fri, 22 May 2020 19:56:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04MJumUD030424 for ; Fri, 22 May 2020 15:56:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 63D79110F3AE; Fri, 22 May 2020 19:56:48 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 53AB21043DDF for ; Fri, 22 May 2020 19:56:42 +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 8107D1859172 for ; Fri, 22 May 2020 19:56:42 +0000 (UTC) Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-390-clkalIqXMxabIjtVdnyJMg-1; Fri, 22 May 2020 15:56:40 -0400 Received: by mail-qv1-f53.google.com with SMTP id p4so5285623qvr.10 for ; Fri, 22 May 2020 12:56:39 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c6:e0b9:8f39:f7d8:19fe:be67]) by smtp.gmail.com with ESMTPSA id o23sm9247286qtf.53.2020.05.22.12.56.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 12:56:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590177420; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=bnPAjZMZDZnkKAZP8u0brroRVD0yv5+KMYSN6cIT+1A=; b=LJF7NK6nKMav7Zf4m0EbWxhX7sciWeAxudBPw9lEf5vcblf4lTCYrqecZdv2JobhaKrzpA KGaVNI2Ei10i1Piipy6yawIIcGtUEN3Hxs+COpC+EhOJeTTH1cK7YVfqidipILiF1/ig94 Ze311JyQopg1EsD9ucT8NSqy5RjwP5w= X-MC-Unique: _Ldzs_CfN4WpymrRQVbhug-1 X-MC-Unique: clkalIqXMxabIjtVdnyJMg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bnPAjZMZDZnkKAZP8u0brroRVD0yv5+KMYSN6cIT+1A=; b=f9nMWqWgizh7LFrIS1/QP6MZ3J9R2rf2nqeERVPufgrnuLbO3l4bThD1hIisPXxnAA M9hxUObUAn0nbtiqb3KESnspRNlS+nwvX33PJNjcr4R6gBP7RUV6ZkDn+stm4oqRyx8J 5jQ3eK+3KlwAuirzjrqRDhuuJq/ZSBsNboAZClAC+/tlzdxGM9wbWKPJ4KlZ0XW3qmPC W5v9CeyrXkputiEPMCzoPJuaSQ2+9PQe6Mw9xi+fXVEOOgX6rh4JEYvKaHGDeYNZ9EHW O1GMebwCWaIwDPYU3sfnIQWbIM8eO6FXgvKNi0uJH/af2LB2H0BtS0gcuN/jY1ikxqrR t10A== X-Gm-Message-State: AOAM531MZE7/OOjp+rPcbJYBLXNhD0r6tkebmnJmaw6Or9BguBHY379F zPPg8VTrDzsSG59LI7sV1c/9d3wM X-Google-Smtp-Source: ABdhPJy1xblBx5hBdWPYsaa4+KerK6LrTEAvDj9Y0JLZDvgRWRyMZEMtJHo4ZUfT0iMV5JqKtpYkbw== X-Received: by 2002:ad4:5a53:: with SMTP id ej19mr5180417qvb.79.1590177399210; Fri, 22 May 2020 12:56:39 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 2/5] cpu_arm.c: modernize virCPUarmUpdate Date: Fri, 22 May 2020 16:56:17 -0300 Message-Id: <20200522195620.3843442-3-danielhb413@gmail.com> In-Reply-To: <20200522195620.3843442-1-danielhb413@gmail.com> References: <20200522195620.3843442-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use automatic cleanup of variables. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Jiri Denemark --- src/cpu/cpu_arm.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index 6f6c6a1479..cd4f720c95 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -415,8 +415,7 @@ static int virCPUarmUpdate(virCPUDefPtr guest, const virCPUDef *host) { - int ret =3D -1; - virCPUDefPtr updated =3D NULL; + g_autoptr(virCPUDef) updated =3D NULL; =20 if (guest->mode !=3D VIR_CPU_MODE_HOST_MODEL) return 0; @@ -424,24 +423,21 @@ virCPUarmUpdate(virCPUDefPtr guest, if (!host) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("unknown host CPU model")); - goto cleanup; + return -1; } =20 if (!(updated =3D virCPUDefCopyWithoutModel(guest))) - goto cleanup; + return -1; =20 updated->mode =3D VIR_CPU_MODE_CUSTOM; if (virCPUDefCopyModel(updated, host, true) < 0) - goto cleanup; + return -1; =20 virCPUDefStealModel(guest, updated, false); guest->mode =3D VIR_CPU_MODE_CUSTOM; guest->match =3D VIR_CPU_MATCH_EXACT; - ret =3D 0; =20 - cleanup: - virCPUDefFree(updated); - return ret; + return 0; } =20 =20 --=20 2.26.2 From nobody Thu Apr 25 19:53:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1590177434; cv=none; d=zohomail.com; s=zohoarc; b=YOMzGGAaUJs/03wfAIx7si54MWk3+rVrUr7KQ0jl35kRwdXkZXB1DfLL75PI83WcbJmaLLVnPWzAlTxB+P6M6uBwat6Lx82p+u5JlCgT/BAZ7pIh2gDUXVe7pSFrtasFSYR5fpi4pW+gm9h7ITdpAJR29cHC0ax8IWykDevctWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590177434; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=u4F8gpnU4UVzQiQCSoFgrzkKV+G/7ATWzL2+69KBCkw=; b=kM41cs18smPHIalG/pWuDJAjMt5QCIphpd+CH73dT89Co5RXBM7+p+KZiqP0wl2qWD6t4ynDgvIgabVn9j8qmqEiAPSsszl1wsCc80w4OSrDsw7aXyymIO8Ds7roxuqIyk52nu5IFsbnUn6TSBs7kPojOlbPECaEyyuujbu/ZoM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1590177434009130.4750321222259; Fri, 22 May 2020 12:57:14 -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-405-KKVp3J6HNF2Ht6cW4fAFYg-1; Fri, 22 May 2020 15:57:10 -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 AA9BD107ACF3; Fri, 22 May 2020 19:57:05 +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 81A7F6EA50; Fri, 22 May 2020 19:57:04 +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 51BED1809557; Fri, 22 May 2020 19:57:04 +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 04MJui62030384 for ; Fri, 22 May 2020 15:56:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 45E6FF567E; Fri, 22 May 2020 19:56:44 +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 37AD2F1C6D for ; Fri, 22 May 2020 19:56:44 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 127F88EC772 for ; Fri, 22 May 2020 19:56:44 +0000 (UTC) Received: from mail-qv1-f66.google.com (mail-qv1-f66.google.com [209.85.219.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-233-ZU7cCkPGM1S3ELAqIWN6YA-1; Fri, 22 May 2020 15:56:41 -0400 Received: by mail-qv1-f66.google.com with SMTP id fb16so5308707qvb.5 for ; Fri, 22 May 2020 12:56:41 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c6:e0b9:8f39:f7d8:19fe:be67]) by smtp.gmail.com with ESMTPSA id o23sm9247286qtf.53.2020.05.22.12.56.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 12:56:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590177432; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=u4F8gpnU4UVzQiQCSoFgrzkKV+G/7ATWzL2+69KBCkw=; b=C8NbFfyqUW+/tC7T6yRHuKKRXdXMiobtBEnFXtQyc01Nm6NaikX5jXmMlBz6xr5/uAfN9S OouDOXBsyZQKYMZKpdDBD/Av3EqdPn32Kjv65XZ2BxmpoNwAAdHoPqej1TiMEBQkg9N0f0 F3C+DDh8G1g+ljc7V8fUiJh5A5pA8lU= X-MC-Unique: KKVp3J6HNF2Ht6cW4fAFYg-1 X-MC-Unique: ZU7cCkPGM1S3ELAqIWN6YA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u4F8gpnU4UVzQiQCSoFgrzkKV+G/7ATWzL2+69KBCkw=; b=fy7USi8hMcTSB5Bbfx+0QN1Os+svcRdV5MP7K488DZGH6TP+Asr8QMG50DeqCCuFH+ wVDYnCgi35iNAFrR7Dofce+LfNFIYSl/kxZ07V62xyoveAy+aJLZ8kDFNTBAUrWFZnvO t2DaXRQFbBPi0lY0mgwWPzzPsb5mxSEhuywIczM2tGz5jJxOWsVqPgEnmhHEXLQwD7J1 NFwPzuopIXE0+uYpav1Zn03GuG0FxcDlFf7wSLrJyxh26dKoJQtFEBVwp3669m9BSvCk 2DAPotIf08nLd1kIoEzqUqy1GSxwWsE4XZFrswMsIwKBO7yGpOPWe6tqDzR2w1svDjXL pMUQ== X-Gm-Message-State: AOAM531bDrFq87U64kKjF/6sMhTaDYJjIjSMgylio2+/iBivfLGzbRm4 Sjb5xcENsQ2NhXjel1YHXJQ1fQwR X-Google-Smtp-Source: ABdhPJwimblE7S4K1kz6EOnKB0vDWhrRZwQxhVR4XaevixPChJV+rCcjF7rTBvR2BRG15/1mEPcCkA== X-Received: by 2002:a05:6214:1265:: with SMTP id r5mr5245658qvv.171.1590177400589; Fri, 22 May 2020 12:56:40 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 3/5] cpu_s390.c: modernize virCPUs390Update Date: Fri, 22 May 2020 16:56:18 -0300 Message-Id: <20200522195620.3843442-4-danielhb413@gmail.com> In-Reply-To: <20200522195620.3843442-1-danielhb413@gmail.com> References: <20200522195620.3843442-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use automatic cleanup of variables. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Jiri Denemark --- src/cpu/cpu_s390.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/cpu/cpu_s390.c b/src/cpu/cpu_s390.c index dd030c5a11..c1c5686244 100644 --- a/src/cpu/cpu_s390.c +++ b/src/cpu/cpu_s390.c @@ -45,8 +45,7 @@ static int virCPUs390Update(virCPUDefPtr guest, const virCPUDef *host) { - virCPUDefPtr updated =3D NULL; - int ret =3D -1; + g_autoptr(virCPUDef) updated =3D NULL; size_t i; =20 if (guest->mode =3D=3D VIR_CPU_MODE_CUSTOM) { @@ -58,37 +57,34 @@ virCPUs390Update(virCPUDefPtr guest, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("optional CPU features are not supported")); } - goto cleanup; + return -1; } =20 if (!host) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("unknown host CPU model")); - goto cleanup; + return -1; } =20 if (!(updated =3D virCPUDefCopyWithoutModel(guest))) - goto cleanup; + return -1; =20 updated->mode =3D VIR_CPU_MODE_CUSTOM; if (virCPUDefCopyModel(updated, host, true) < 0) - goto cleanup; + return -1; =20 for (i =3D 0; i < guest->nfeatures; i++) { if (virCPUDefUpdateFeature(updated, guest->features[i].name, guest->features[i].policy) < 0) - goto cleanup; + return -1; } =20 virCPUDefStealModel(guest, updated, false); guest->mode =3D VIR_CPU_MODE_CUSTOM; guest->match =3D VIR_CPU_MATCH_EXACT; - ret =3D 0; =20 - cleanup: - virCPUDefFree(updated); - return ret; + return 0; } =20 =20 --=20 2.26.2 From nobody Thu Apr 25 19:53:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1590177421; cv=none; d=zohomail.com; s=zohoarc; b=RK11xiq7X153L3gqgqlojE3svL1oHUmFIRL6lrIMZljpI7dDunYgNL2o+7yvXqacU1ASOy0X5VrP6t7tAhzwftBCGBguhGdvWxj3oQf03V8KoqCt4z0m2qR0UaeHGqgy6h2HU1KkbXV3TP0vmeRroIqt9BCK5PtkDV8GLzf4RR0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590177421; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=G10YNPIOx6BvlrPjpgISET0XS9iGQsERzRxsh7w0uco=; b=D5BSOI8+M9P+pwBzh4e6DDT0WMiVTPtb28Dn/Xbut8Epz4lHQPuqF1sru/AiH0mU2uqzN4CKdVlxgYm31cC7CSGGSJyVVDhehRPHUUt5+9iHMk1rUDNpzAMC73waDMlyA62/AM5g3BOuCnHUfR0C7GLvSaQ1k+T4DfjNij2txaU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1590177421132513.4920336530913; Fri, 22 May 2020 12:57:01 -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-317-3ZawtKytP9eOAta2-iJyZQ-1; Fri, 22 May 2020 15:56:55 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0143F1005512; Fri, 22 May 2020 19:56: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 3DF44707BA; Fri, 22 May 2020 19:56: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 D9E311809542; Fri, 22 May 2020 19:56:47 +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 04MJujP9030396 for ; Fri, 22 May 2020 15:56:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id C9CDBF5679; Fri, 22 May 2020 19:56:45 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B96E6F567E for ; Fri, 22 May 2020 19:56:45 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 8CC6C800294 for ; Fri, 22 May 2020 19:56:45 +0000 (UTC) Received: from mail-qv1-f68.google.com (mail-qv1-f68.google.com [209.85.219.68]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-417-cWHdqxdcMGy4vXThJp2GAw-1; Fri, 22 May 2020 15:56:42 -0400 Received: by mail-qv1-f68.google.com with SMTP id d1so5300374qvl.6 for ; Fri, 22 May 2020 12:56:42 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c6:e0b9:8f39:f7d8:19fe:be67]) by smtp.gmail.com with ESMTPSA id o23sm9247286qtf.53.2020.05.22.12.56.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 12:56:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590177419; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=G10YNPIOx6BvlrPjpgISET0XS9iGQsERzRxsh7w0uco=; b=Y8aUrHwm4A6D571FsP45H8MnI8u/tkSOyl4uhvx+y/UfUKs0Zp48fl/PcGqmMLTB4hrY+u E4nn1yNr1N4ZTjiTPumQEaDTqZvZEqdSwrtdUZ9qxUNSdRffHAWm5R9A64RBZRALPqa927 k33NdhwFXN2pEgm5iFj9edqg1LQQ/Qc= X-MC-Unique: 3ZawtKytP9eOAta2-iJyZQ-1 X-MC-Unique: cWHdqxdcMGy4vXThJp2GAw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G10YNPIOx6BvlrPjpgISET0XS9iGQsERzRxsh7w0uco=; b=WmRNMTXbNjRtDcJVgTFJpUUvnURfGzWTzyW5Eq7G7PkwxnVVVvoSHcw04oiZuh01yL Koe9YFyQwJcvg8fxEW6zm7Sy3thdCeT9q3P4D8LF/3utlhqvFw8x1qNxLPz381dfYN16 kqBPH7sJuWL+1uITvRBbRtC550z6P7Etw3JOVWZQbqcMSzudkxD5CCXFLJEINe3lPkZk 94sz3kHrB9uoA3NNFGJtQa36Zm3p9jMob2h5PuYKobqpwfDwNOIP4AAkPiAyQP7i6fZD SIXZpFhS2WsH2HKgRu306x2Sm8yIBAQbEaHyUMnyMazy4bVg3NWwok4XMBQWe/ZFKKTX 5UBg== X-Gm-Message-State: AOAM530bIVICiUD7lLj/8VLE9EWZFzGsfR/aLQlxWlcka9UrIcgfnOJI BggRuzUer3MxYd3rEbnnNxovyrOR X-Google-Smtp-Source: ABdhPJzP+kk8LsVR3/sUYhve5LV94WMuuAHH2pZY3/ek6viU0FeidzwCesttVy6utQLft6/d56Uvwg== X-Received: by 2002:ad4:48c5:: with SMTP id v5mr5515852qvx.203.1590177402045; Fri, 22 May 2020 12:56:42 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 4/5] qemu_process.c: modernize qemuProcessUpdateCPU code path Date: Fri, 22 May 2020 16:56:19 -0300 Message-Id: <20200522195620.3843442-5-danielhb413@gmail.com> In-Reply-To: <20200522195620.3843442-1-danielhb413@gmail.com> References: <20200522195620.3843442-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use automatic cleanup on qemuProcessUpdateCPU and the functions called by it. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Jiri Denemark --- src/qemu/qemu_process.c | 50 ++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 45af8f810c..a1ef1d42b0 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4187,8 +4187,8 @@ qemuProcessFetchGuestCPU(virQEMUDriverPtr driver, virCPUDataPtr *disabled) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - virCPUDataPtr dataEnabled =3D NULL; - virCPUDataPtr dataDisabled =3D NULL; + g_autoptr(virCPUData) dataEnabled =3D NULL; + g_autoptr(virCPUData) dataDisabled =3D NULL; bool generic; int rc; =20 @@ -4201,7 +4201,7 @@ qemuProcessFetchGuestCPU(virQEMUDriverPtr driver, return 0; =20 if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto error; + return -1; =20 if (generic) { rc =3D qemuMonitorGetGuestCPU(priv->mon, @@ -4213,19 +4213,14 @@ qemuProcessFetchGuestCPU(virQEMUDriverPtr driver, } =20 if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto error; + return -1; =20 if (rc =3D=3D -1) - goto error; + return -1; =20 - *enabled =3D dataEnabled; - *disabled =3D dataDisabled; + *enabled =3D g_steal_pointer(&dataEnabled); + *disabled =3D g_steal_pointer(&dataDisabled); return 0; - - error: - virCPUDataFree(dataEnabled); - virCPUDataFree(dataDisabled); - return -1; } =20 =20 @@ -4261,9 +4256,8 @@ qemuProcessUpdateLiveGuestCPU(virDomainObjPtr vm, { virDomainDefPtr def =3D vm->def; qemuDomainObjPrivatePtr priv =3D vm->privateData; - virCPUDefPtr orig =3D NULL; + g_autoptr(virCPUDef) orig =3D NULL; int rc; - int ret =3D -1; =20 if (!enabled) return 0; @@ -4274,10 +4268,10 @@ qemuProcessUpdateLiveGuestCPU(virDomainObjPtr vm, return 0; =20 if (!(orig =3D virCPUDefCopy(def->cpu))) - goto cleanup; + return -1; =20 if ((rc =3D virCPUUpdateLive(def->os.arch, def->cpu, enabled, disabled= )) < 0) { - goto cleanup; + return -1; } else if (rc =3D=3D 0) { /* Store the original CPU in priv if QEMU changed it and we didn't * get the original CPU via migration, restore, or snapshot revert. @@ -4288,11 +4282,7 @@ qemuProcessUpdateLiveGuestCPU(virDomainObjPtr vm, def->cpu->check =3D VIR_CPU_CHECK_FULL; } =20 - ret =3D 0; - - cleanup: - virCPUDefFree(orig); - return ret; + return 0; } =20 =20 @@ -4351,10 +4341,9 @@ qemuProcessUpdateCPU(virQEMUDriverPtr driver, virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { - virCPUDataPtr cpu =3D NULL; - virCPUDataPtr disabled =3D NULL; + g_autoptr(virCPUData) cpu =3D NULL; + g_autoptr(virCPUData) disabled =3D NULL; g_autoptr(virDomainCapsCPUModels) models =3D NULL; - int ret =3D -1; =20 /* The host CPU model comes from host caps rather than QEMU caps so * fallback must be allowed no matter what the user specified in the X= ML. @@ -4362,21 +4351,16 @@ qemuProcessUpdateCPU(virQEMUDriverPtr driver, vm->def->cpu->fallback =3D VIR_CPU_FALLBACK_ALLOW; =20 if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < = 0) - goto cleanup; + return -1; =20 if (qemuProcessUpdateLiveGuestCPU(vm, cpu, disabled) < 0) - goto cleanup; + return -1; =20 if (qemuProcessFetchCPUDefinitions(driver, vm, asyncJob, &models) < 0 = || virCPUTranslate(vm->def->os.arch, vm->def->cpu, models) < 0) - goto cleanup; - - ret =3D 0; + return -1; =20 - cleanup: - virCPUDataFree(cpu); - virCPUDataFree(disabled); - return ret; + return 0; } =20 =20 --=20 2.26.2 From nobody Thu Apr 25 19:53:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1590177430; cv=none; d=zohomail.com; s=zohoarc; b=hNfFwE7bp5D9hmqVVyynqffyQbECyjBVpehFY2iJDUEOWCplFYCIvhMp1jV8sVYGb8XA5TXCPUxZaJebCWzswXymoglOVjeZOgwseFenSxDIp3fDbyQsPhW/tIzz0AAkQU2RipdzXSRX48BfWNzOk4sTMKaTDlptnles68hqF2I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590177430; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=R07If4gBJndcywTuHT0SY6mFLqTGrgf3eBQHy4kGNbo=; b=fs/fHXGSvwrFx+cm29F2+vnXT/w3lHOGsYdkEp3SFH+0FuZNBroAl1Pdvk6WaqO0xcDtBRystBAC7kZPVNnZBPDkTCNsECZwJ+XJzRlpO31E2opnVgDjhxttjflLGG4ED5E9jC03AIyTTYsEVEF6+DAbefeO2ej5M8mFY6DmnsU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1590177430460566.9224896795598; Fri, 22 May 2020 12:57:10 -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-485-GOZroRT0POeLgs20SL3zmQ-1; Fri, 22 May 2020 15:57:07 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 379E4107ACF7; Fri, 22 May 2020 19:57:02 +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 1B58982A36; Fri, 22 May 2020 19:57:02 +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 E3B6D54D0E; Fri, 22 May 2020 19:57:01 +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 04MJul9K030402 for ; Fri, 22 May 2020 15:56:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 23DE9200BCF6; Fri, 22 May 2020 19:56:47 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 18E8B2026FFE for ; Fri, 22 May 2020 19:56:47 +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 D0F3A8007DC for ; Fri, 22 May 2020 19:56:46 +0000 (UTC) Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-105-z35Oo9kFMxuj7dnzYu5_Qg-1; Fri, 22 May 2020 15:56:44 -0400 Received: by mail-qk1-f196.google.com with SMTP id f13so11964192qkh.2; Fri, 22 May 2020 12:56:44 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c6:e0b9:8f39:f7d8:19fe:be67]) by smtp.gmail.com with ESMTPSA id o23sm9247286qtf.53.2020.05.22.12.56.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 12:56:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590177429; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=R07If4gBJndcywTuHT0SY6mFLqTGrgf3eBQHy4kGNbo=; b=gjCmcC+V4W6PJnH2tayYNJJY0oGa5vKJnIauxVhyPSL1Hs063K8iI/LSiTr8xUd2fc4laK Lb6I7FRle2P/J7GD4JeuN+95uAIGD8idYY9ESOUIF3YHPLQnKILIPNJNAKpeAo0Baib6h6 xnWGSCgWJBFRxuxzSqsjrbWvtX8zQds= X-MC-Unique: GOZroRT0POeLgs20SL3zmQ-1 X-MC-Unique: z35Oo9kFMxuj7dnzYu5_Qg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R07If4gBJndcywTuHT0SY6mFLqTGrgf3eBQHy4kGNbo=; b=Vjpltp6jmuFbY232kXGhTGtDiUfg4o9M1Lyr8lzdv6zb3tGWsW/dpwTeVROrWz01IA 8K9Yni9v0oLkDedffnFWpdSdnNptLsR4dBji1ZCbyTnCUywzFQEKmGhI0pC7RTv+su59 YDDZvnOwdbJSK+GR3TQaHDsHRaa84iuZtOsqQfo3zACbP5aPqkOP3YdAy0gZszQnEizv QncSbU/ggQ1JTTTUywUBnkt23eEbCVOUAmUQ/AvGGY7a+EzdavsX48rw5mPhm8rcGEhz tI3+4XJKvbMgnEmWkLLKYsFBWuaXzaQD8dI01bAV8hEb0+w0xrncGV1opeCXvLYqzd5g g2lA== X-Gm-Message-State: AOAM531XrB/91RSUP2rGYwG5HmMoZD5RG27ZwNWtJByYKDVx0Me+Kn2O Y8u/34WNHnQxbE9AFeoljKWuMJMt X-Google-Smtp-Source: ABdhPJxgtmaCboENlaYmWIEA7SQACkvT6QwjV4Ts+1D7SlG51yCfYY6yK1XvOW2c/6lCUFoZma0s0A== X-Received: by 2002:a37:5d07:: with SMTP id r7mr16226363qkb.253.1590177403801; Fri, 22 May 2020 12:56:43 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 5/5] qemuProcessUpdateCPU: do not change 'fallback' to ALLOW for pSeries guests Date: Fri, 22 May 2020 16:56:20 -0300 Message-Id: <20200522195620.3843442-6-danielhb413@gmail.com> In-Reply-To: <20200522195620.3843442-1-danielhb413@gmail.com> References: <20200522195620.3843442-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Jiri Denemark , Daniel Henrique Barboza 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.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Commit v3.10.0-182-g237f045d9a ("qemu: Ignore fallback CPU attribute on reconnect") forced CPU 'fallback' to ALLOW, regardless of user choice. This fixed a situation in which guests created with older Libvirt versions, which used CPU mode 'host-model' in runtime, would fail to launch in a newer Libvirt if the fallback was set to FORBID. This would lead to a scenario where the CPU was translated to 'host-model' to 'custom', but then the FORBID setting would make the translation process fail. This fix has a side effect for PSeries guests. PSeries can operate with 'host-model' in runtime due to specific PPC64 mechanics regarding compatibility mode. In fact, the update() implementation of the cpuDriverPPC64 driver is a NO-OP if CPU mode is 'host-model', and the driver does not implement translate(). The result is that PSeries guests aren't affected by the problem, but they are being affected by the fix - users are seeing 'fallback' mode being changed without necessity during daemon restart. All other cpuArchDrivers implements update() and changes guest mode to VIR_CPU_MODE_CUSTOM, meaning that PSeries is currently the only exception to this logic. Let's make it official. https://bugzilla.redhat.com/show_bug.cgi?id=3D1660711 CC: Jiri Denemark Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_process.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index a1ef1d42b0..fec1720f33 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4347,8 +4347,14 @@ qemuProcessUpdateCPU(virQEMUDriverPtr driver, =20 /* The host CPU model comes from host caps rather than QEMU caps so * fallback must be allowed no matter what the user specified in the X= ML. + * + * Note: PSeries domains are able to run with host-model CPU by design, + * even on Libvirt newer than 2.3, never replacing host-model with + * custom in the virCPUUpdate() call prior to this function. It is not + * needed to change the user defined 'fallback' attribute in this case. */ - vm->def->cpu->fallback =3D VIR_CPU_FALLBACK_ALLOW; + if (!qemuDomainIsPSeries(vm->def)) + vm->def->cpu->fallback =3D VIR_CPU_FALLBACK_ALLOW; =20 if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < = 0) return -1; --=20 2.26.2