From nobody Sat May 4 11:12:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573746339; cv=none; d=zoho.com; s=zohoarc; b=N680OqqImJlcICHXzL3SDiLdmNodKSRBfryrzPh7xtE96js294lprZUocCtYWLxK7F7/DhDzNPP+crZF7oFs+9elB27uBCOAs7/vmyIy+G8dksNDnJJ2BtQwvjYPoWw6rjKKxCSSWIcqHUQzSumy8C9aOFXLMP2xm+kYPLzxKRg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573746339; 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=z5CLX2bzQC/i6xm8ld5k1ANZU/jr18dU8ReMt1pJms4=; b=iJpNg2CCW2F+ZU4q3kCdfVz3HsnzXYAeASjo4eUwaFBaPTbW7COdJHlAK/U/cXgHNMLepaRRL6c5lYcsJx4/x/gaXmFk6ra61YSP85kdb6pnkjPeE0/2bhhH5a0xmXE0M9l0loy0zA85s2TasGutKejulM7MKR2SZ3dz2RlCMHg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 157374633991525.908788617283562; Thu, 14 Nov 2019 07:45:39 -0800 (PST) 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-25-7uhTSGlEOTK-0HOWrXPz-Q-1; Thu, 14 Nov 2019 10:45:34 -0500 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 1B51510116AF; Thu, 14 Nov 2019 15:45:28 +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 DE17351; Thu, 14 Nov 2019 15:45:27 +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 89EE8182B013; Thu, 14 Nov 2019 15:45:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAEFjPG6026816 for ; Thu, 14 Nov 2019 10:45:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5111051; Thu, 14 Nov 2019 15:45:24 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B9F96A50B; Thu, 14 Nov 2019 15:45:18 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id C80CB1002F0; Thu, 14 Nov 2019 16:45:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573746337; 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=z5CLX2bzQC/i6xm8ld5k1ANZU/jr18dU8ReMt1pJms4=; b=XYqpAb50bc+51yxdB6yLfZ0trWkf+xNT5ZmzmYBtSc6YhetTMoJ/A7C5bsABF8PcLxDgcQ tIY40zo/SVxLzFerCqG0z+NnguUPj43m+t7Hdu10IjsI5XbRoO8Mq322qROSseocxfRTqQ yHTRHbB9+Opq5ZUWLcL+exv5LK7f39k= From: Jiri Denemark To: libvir-list@redhat.com Date: Thu, 14 Nov 2019 16:44:55 +0100 Message-Id: <20654e5ee851c933d34de5a60651249346340345.1573746013.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Christian Borntraeger , "Collin L . Walling" , David Hildenbrand Subject: [libvirt] [PATCH 1/4] cpu_conf: Fix default value for CPU match attribute 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 X-MC-Unique: 7uhTSGlEOTK-0HOWrXPz-Q-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Commit v0.8.4-66-g95ff6b18ec (9 years ago) changed the default value for the cpu/@match attribute to 'exact' in a rather complicated way. It did so only if subelement was present and set -1 otherwise (which is not expected to ever happen). Thus the following two equivalent XML elements: and would be parsed differently. The former would end up with match =3D=3D -1 while the latter would have match =3D=3D 1 ('exact'). This is not a big deal since the match attribute is ignored for host-model CPUs, but we can simplify the code and make it a little bit saner anyway. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko Tested-by: Collin Walling --- Notes: Well, thanks to a bug (fixed in another patch in this series) the s390 CPU driver actually looks at the match attribute even for host-model CPUs. src/conf/cpu_conf.c | 9 ++------- src/conf/cpu_conf.h | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 2a1bd7c9b2..3641b5ef4c 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -46,8 +46,8 @@ VIR_ENUM_IMPL(virCPUMode, =20 VIR_ENUM_IMPL(virCPUMatch, VIR_CPU_MATCH_LAST, - "minimum", "exact", + "minimum", "strict", ); =20 @@ -388,12 +388,7 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt, char *match =3D virXMLPropString(ctxt->node, "match"); char *check; =20 - if (!match) { - if (virXPathBoolean("boolean(./model)", ctxt)) - def->match =3D VIR_CPU_MATCH_EXACT; - else - def->match =3D -1; - } else { + if (match) { def->match =3D virCPUMatchTypeFromString(match); VIR_FREE(match); =20 diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index e41d47d1ae..96fda3e6b3 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -52,8 +52,8 @@ typedef enum { VIR_ENUM_DECL(virCPUMode); =20 typedef enum { - VIR_CPU_MATCH_MINIMUM, VIR_CPU_MATCH_EXACT, + VIR_CPU_MATCH_MINIMUM, VIR_CPU_MATCH_STRICT, =20 VIR_CPU_MATCH_LAST --=20 2.24.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 11:12:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573746329; cv=none; d=zoho.com; s=zohoarc; b=oLuv3cz59VvNFZi+YURbFauCVRte2EhabOFgJwQhBgAjgzvEqUhfMUovEYG5dAQPs5c6r4xkQtcwg6aQL2m9/z8xELfSo7aLaDavu/POG627VyaxTTpmmzNO8qVj9fYAbG0egDeyPl0yxuDK/POpyhpabXbWbM89693lWjmggSQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573746329; 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=qbb17Gag94oxHYAtt9Ot2TDGgW7wgDuBWFNOUsR/gIc=; b=hl37M30ymVTYrvrRsHjoZQz9OwJ+7kPYwCk8mNzXilWv4/YvNACFpjLlXvJx00IVmO+nbJy/1p5/oOdJ9hELfH0U91V0OFQlBfkblcRL9ZsNcNOsN+EOlhdnya2ybB3zIIZV2yskGCpsj6e2KzHEUeQiTac+faIwklxFCZRog1s= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 1573746329516124.92595565130875; Thu, 14 Nov 2019 07:45:29 -0800 (PST) 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-302-GtENaZZkPlCoUY2YgYlvIw-1; Thu, 14 Nov 2019 10:45:27 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 880AF101F2CC; Thu, 14 Nov 2019 15:45:21 +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 5361A6135E; Thu, 14 Nov 2019 15:45:21 +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 91D81182B011; Thu, 14 Nov 2019 15:45:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAEFjIaW026790 for ; Thu, 14 Nov 2019 10:45:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id B38E66137F; Thu, 14 Nov 2019 15:45:18 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B5346135E; Thu, 14 Nov 2019 15:45:18 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id CC7C8100326; Thu, 14 Nov 2019 16:45:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573746328; 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=qbb17Gag94oxHYAtt9Ot2TDGgW7wgDuBWFNOUsR/gIc=; b=QGLCprDhggWenwRjDkNQrboQP3IHg01ks9afufnklRP2Ukh6YKZVA2RNTkVjFkcKmMZv3N fJJQ7j43+Sft++F6SqWnBjPqIOJiyOCeF43Otkv4afSLY4e4DhnDtVgJgofOsOSzdYhxah o8zcbv+Q9XL85O7ewv366J0r2sYaWOg= From: Jiri Denemark To: libvir-list@redhat.com Date: Thu, 14 Nov 2019 16:44:56 +0100 Message-Id: <0797ebf0b892442d3f679043b4668a4b58a60ac7.1573746013.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Christian Borntraeger , "Collin L . Walling" , David Hildenbrand Subject: [libvirt] [PATCH 2/4] cpu_conf: Don't format empty model for host-model CPUs 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.11 X-MC-Unique: GtENaZZkPlCoUY2YgYlvIw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Most likely for historical reasons our CPU def formatting code is happily adding useless for host-model CPUs. We can just drop it. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko Tested-by: Collin Walling --- src/conf/cpu_conf.c | 16 +++++----------- .../cputestdata/ppc64-host+guest-compat-none.xml | 4 +--- .../cpu-check-default-partial.xml | 4 +--- .../cpu-host-model-features.xml | 1 - 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 3641b5ef4c..4542bcb7bd 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -751,16 +751,12 @@ virCPUDefFormatBuf(virBufferPtr buf, { size_t i; bool formatModel; - bool formatFallback; =20 if (!def) return 0; =20 formatModel =3D (def->mode =3D=3D VIR_CPU_MODE_CUSTOM || def->mode =3D=3D VIR_CPU_MODE_HOST_MODEL); - formatFallback =3D (def->type =3D=3D VIR_CPU_TYPE_GUEST && - (def->mode =3D=3D VIR_CPU_MODE_HOST_MODEL || - (def->mode =3D=3D VIR_CPU_MODE_CUSTOM && def->model= ))); =20 if (!def->model && def->mode =3D=3D VIR_CPU_MODE_CUSTOM && def->nfeatu= res) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -768,9 +764,10 @@ virCPUDefFormatBuf(virBufferPtr buf, return -1; } =20 - if ((formatModel && def->model) || formatFallback) { + if (formatModel && def->model) { virBufferAddLit(buf, "type =3D=3D VIR_CPU_TYPE_GUEST) { const char *fallback; =20 fallback =3D virCPUFallbackTypeToString(def->fallback); @@ -784,11 +781,8 @@ virCPUDefFormatBuf(virBufferPtr buf, if (def->vendor_id) virBufferEscapeString(buf, " vendor_id=3D'%s'", def->vendo= r_id); } - if (formatModel && def->model) { - virBufferEscapeString(buf, ">%s\n", def->model); - } else { - virBufferAddLit(buf, "/>\n"); - } + + virBufferEscapeString(buf, ">%s\n", def->model); } =20 if (formatModel && def->vendor) diff --git a/tests/cputestdata/ppc64-host+guest-compat-none.xml b/tests/cpu= testdata/ppc64-host+guest-compat-none.xml index 188ebebb72..fd50c03a79 100644 --- a/tests/cputestdata/ppc64-host+guest-compat-none.xml +++ b/tests/cputestdata/ppc64-host+guest-compat-none.xml @@ -1,3 +1 @@ - - - + diff --git a/tests/qemuxml2xmloutdata/cpu-check-default-partial.xml b/tests= /qemuxml2xmloutdata/cpu-check-default-partial.xml index 4e5fa44832..b64a1f0ef7 100644 --- a/tests/qemuxml2xmloutdata/cpu-check-default-partial.xml +++ b/tests/qemuxml2xmloutdata/cpu-check-default-partial.xml @@ -8,9 +8,7 @@ hvm - - - + destroy restart diff --git a/tests/qemuxml2xmloutdata/cpu-host-model-features.xml b/tests/q= emuxml2xmloutdata/cpu-host-model-features.xml index a5de9ea38d..6480bd5494 100644 --- a/tests/qemuxml2xmloutdata/cpu-host-model-features.xml +++ b/tests/qemuxml2xmloutdata/cpu-host-model-features.xml @@ -14,7 +14,6 @@ - --=20 2.24.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 11:12:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573746336; cv=none; d=zoho.com; s=zohoarc; b=Cikp447zwKAi+fCaABi95KjPP/Kjp/JQAgn+6GjnRbWaIyBonuNKkydlQ7NAglEaqg6CGdguZDDNLYhjzjrkpUx7Jw88ibPlxewEk9FRJ1wwEegSL01RQgttBlwzdk+VKRZP14nociRTqo7FYqTCL4KrcGUxLF3MPx8KYLINsEw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573746336; 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=EzJxabC+i0qzqyx+uF5msuj/Ao2rsipW4jMVH8h0+6E=; b=VBRQJy1hBq86l3kOroA6KVkcV3vuS39VEn1ClI9YzJW8zXD/kFsKGqKprVJfY7SI65jQAX8B0zfeIaM8vKrMPdhCv5cr6sR30Ws7JLyodCyce7udfcwZGe7OZi/lTdXGvbLp2A52kIUrShaw2tPo2mEuGRsLmquUdHzbw5UkeDY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 157374633650564.2057552045344; Thu, 14 Nov 2019 07:45:36 -0800 (PST) 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-132-JBepOqTpNTGT-LWxbY1EAA-1; Thu, 14 Nov 2019 10:45:32 -0500 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 5288C1857547; Thu, 14 Nov 2019 15:45:27 +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 1F5F91036C6C; Thu, 14 Nov 2019 15:45:27 +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 9365A4BB78; Thu, 14 Nov 2019 15:45:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAEFjNRV026804 for ; Thu, 14 Nov 2019 10:45:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id E38C11036C6C; Thu, 14 Nov 2019 15:45:23 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 81831108BD24; Thu, 14 Nov 2019 15:45:18 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id D015110032B; Thu, 14 Nov 2019 16:45:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573746335; 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=EzJxabC+i0qzqyx+uF5msuj/Ao2rsipW4jMVH8h0+6E=; b=H4v7V83lLWl6ixhdyjzHqFirjkvWT5LtpRzhW8tLJdadgt0HzSIift1vpsrqOHbRDalwO5 enmLKy9mnWGZN19/xhPsSrOPjTyoHLRH6Or29QeqoqlMMRbJFkx3vUp/1XyP+62W2gOy47 ufu01qPrG3Z7yo1NT32iO8Q91Lsets8= From: Jiri Denemark To: libvir-list@redhat.com Date: Thu, 14 Nov 2019 16:44:57 +0100 Message-Id: <05b0d1d57bc14c85301a496b151046565a1ac4c1.1573746013.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Christian Borntraeger , "Collin L . Walling" , David Hildenbrand Subject: [libvirt] [PATCH 3/4] cpu_s390: Don't check match attribute for host-model CPUs 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 X-MC-Unique: JBepOqTpNTGT-LWxbY1EAA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The match attribute is only relevant for custom mode CPUs. Reporting failure when match =3D=3D 'minimum' regardless on CPU mode can cause unexpected failures. We should only report the error for custom CPUs. In fact, calling virCPUs390Update on a custom mode CPU should always report an error as optional features are not supported on s390 either. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko Tested-by: Collin Walling --- src/cpu/cpu_s390.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/cpu/cpu_s390.c b/src/cpu/cpu_s390.c index a4a381f4b8..dd030c5a11 100644 --- a/src/cpu/cpu_s390.c +++ b/src/cpu/cpu_s390.c @@ -49,15 +49,15 @@ virCPUs390Update(virCPUDefPtr guest, int ret =3D -1; size_t i; =20 - if (guest->match =3D=3D VIR_CPU_MATCH_MINIMUM) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("match mode %s not supported"), - virCPUMatchTypeToString(guest->match)); - goto cleanup; - } - - if (guest->mode !=3D VIR_CPU_MODE_HOST_MODEL) { - ret =3D 0; + if (guest->mode =3D=3D VIR_CPU_MODE_CUSTOM) { + if (guest->match =3D=3D VIR_CPU_MATCH_MINIMUM) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("match mode %s not supported"), + virCPUMatchTypeToString(guest->match)); + } else { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("optional CPU features are not supported")); + } goto cleanup; } =20 --=20 2.24.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 11:12:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573746343; cv=none; d=zoho.com; s=zohoarc; b=mDRjqGVBhRaWKSz34TD1UomwBn4LX1w6ME25qcMFQDAeuALv82TrmlJLl9o5XZahBOkYVCkiSR6e0ZD2PE8owbmJhjMigPtIKeCRyYCn+asy9vZUpFRYUzZO7NAYb0N5ibT3iy/H+jH4VXnyd9/GU4oPyzYv5StQsjCBPxJ4/ME= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573746343; 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=bke4oMHXy2WYXd90VUZphxRKOqbGXpw7IkPETdstg6c=; b=cPk5AFfGsYwuixjoAP2yoLXxtZf/jAju6rPvV+it6IJJnA86YsCwaiKVXMK2d64oVsuM1DbkWPoWm6v3gxbG2W05e+Bi1mhCyQcxmOolOcYV9S8SEPpOc6H+s5+2bBeY4jeTeaIyaayiuE2vTEPCx08rhQtXBuvRGf/XLbJwsqA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1573746343005998.341329492578; Thu, 14 Nov 2019 07:45:43 -0800 (PST) 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-103-t6f-6xJvMgKhnU9PEwb6TQ-1; Thu, 14 Nov 2019 10:45:39 -0500 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 539E18C73FF; Thu, 14 Nov 2019 15:45:32 +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 18D4D108426B; Thu, 14 Nov 2019 15:45:32 +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 AF886182B015; Thu, 14 Nov 2019 15:45:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAEFjPsO026817 for ; Thu, 14 Nov 2019 10:45:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 04F346A50B; Thu, 14 Nov 2019 15:45:25 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AA4F6A500; Thu, 14 Nov 2019 15:45:18 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id D3859100332; Thu, 14 Nov 2019 16:45:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573746341; 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=bke4oMHXy2WYXd90VUZphxRKOqbGXpw7IkPETdstg6c=; b=HYlg7z5DhguiO+sagxfPLt4wWfyJeoDHGjv70vj0gxc30DI8nS9uDF6JzAzBsps0JXyPIP 7TS588zT+Q7yQpSda7Zd/nKdwQypHFLUr/h+70dXM52KvWTDNEevyteKrOT6+Zf1izYk8N Uf88gk032TXyCjXdcQf2rgxJgoMAoys= From: Jiri Denemark To: libvir-list@redhat.com Date: Thu, 14 Nov 2019 16:44:58 +0100 Message-Id: <250657c17e8633ccd06f0f5cb6645d781ccb0dfd.1573746013.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Christian Borntraeger , "Collin L . Walling" , David Hildenbrand Subject: [libvirt] [PATCH 4/4] qemu: Use host-model CPU on s390 by default 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 X-MC-Unique: t6f-6xJvMgKhnU9PEwb6TQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" On s390 machines host-passthrough and host-model CPUs result in the same guest ABI (with QEMU new enough to be able to tell us what "host" CPU is expanded to, which was implemented around 2.9.0). So instead of using host-passthrough CPU when there's no CPU specified in a domain XML we can safely use host-model and benefit from CPU compatibility checks during migration, snapshot restore and similar operations. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko Tested-by: Collin Walling --- src/qemu/qemu_domain.c | 33 ++++++++++++------- ...t-cpu-kvm-ccw-virtio-4.2.s390x-latest.args | 4 ++- ...lt-cpu-kvm-ccw-virtio-4.2.s390x-latest.xml | 2 +- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 8bd05f4058..e5269e6300 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4440,6 +4440,7 @@ qemuDomainDefVcpusPostParse(virDomainDefPtr def) =20 static int qemuDomainDefSetDefaultCPU(virDomainDefPtr def, + virCapsPtr caps, virQEMUCapsPtr qemuCaps) { const char *model; @@ -4470,26 +4471,36 @@ qemuDomainDefSetDefaultCPU(virDomainDefPtr def, return -1; } =20 - VIR_DEBUG("Setting default CPU model for domain '%s' to %s", - def->name, model); - if (!def->cpu) def->cpu =3D g_new0(virCPUDef, 1); =20 - /* We need to turn off all CPU checks when the domain is started becau= se - * the default CPU (e.g., qemu64) may not be runnable on any host. QEMU - * will just disable the unavailable features and we will update the C= PU - * definition accordingly and set check to FULL when starting the doma= in. */ def->cpu->type =3D VIR_CPU_TYPE_GUEST; - def->cpu->check =3D VIR_CPU_CHECK_NONE; =20 if (STREQ(model, "host")) { - def->cpu->mode =3D VIR_CPU_MODE_HOST_PASSTHROUGH; + if (ARCH_IS_S390(def->os.arch) && + virQEMUCapsIsCPUModeSupported(qemuCaps, caps, def->virtType, + VIR_CPU_MODE_HOST_MODEL)) { + def->cpu->mode =3D VIR_CPU_MODE_HOST_MODEL; + } else { + def->cpu->mode =3D VIR_CPU_MODE_HOST_PASSTHROUGH; + } + + VIR_DEBUG("Setting default CPU mode for domain '%s' to %s", + def->name, virCPUModeTypeToString(def->cpu->mode)); } else { + /* We need to turn off all CPU checks when the domain is started + * because the default CPU (e.g., qemu64) may not be runnable on a= ny + * host. QEMU will just disable the unavailable features and we wi= ll + * update the CPU definition accordingly and set check to FULL when + * starting the domain. */ + def->cpu->check =3D VIR_CPU_CHECK_NONE; def->cpu->mode =3D VIR_CPU_MODE_CUSTOM; def->cpu->match =3D VIR_CPU_MATCH_EXACT; def->cpu->fallback =3D VIR_CPU_FALLBACK_FORBID; def->cpu->model =3D g_strdup(model); + + VIR_DEBUG("Setting default CPU model for domain '%s' to %s", + def->name, model); } =20 return 0; @@ -4674,7 +4685,7 @@ qemuDomainDefPostParseBasic(virDomainDefPtr def, =20 static int qemuDomainDefPostParse(virDomainDefPtr def, - virCapsPtr caps G_GNUC_UNUSED, + virCapsPtr caps, unsigned int parseFlags, void *opaque, void *parseOpaque) @@ -4706,7 +4717,7 @@ qemuDomainDefPostParse(virDomainDefPtr def, if (qemuCanonicalizeMachine(def, qemuCaps) < 0) return -1; =20 - if (qemuDomainDefSetDefaultCPU(def, qemuCaps) < 0) + if (qemuDomainDefSetDefaultCPU(def, caps, qemuCaps) < 0) return -1; =20 qemuDomainDefEnableDefaultFeatures(def, qemuCaps); diff --git a/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-4.2.s39= 0x-latest.args b/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-4.2= .s390x-latest.args index 4b7345630b..0386019418 100644 --- a/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-4.2.s390x-late= st.args +++ b/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-4.2.s390x-late= st.args @@ -13,7 +13,9 @@ QEMU_AUDIO_DRV=3Dnone \ -object secret,id=3DmasterKey0,format=3Draw,\ file=3D/tmp/lib/domain--1-test/master-key.aes \ -machine s390-ccw-virtio-4.2,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ --cpu host \ +-cpu z13.2-base,aen=3Don,aefsi=3Don,msa5=3Don,msa4=3Don,msa3=3Don,msa2=3Do= n,msa1=3Don,\ +sthyi=3Don,edat=3Don,ri=3Don,edat2=3Don,vx=3Don,ipter=3Don,ap=3Don,esop=3D= on,apft=3Don,apqci=3Don,\ +cte=3Don,bpb=3Don,ppa15=3Don,zpci=3Don,sea_esop2=3Don,te=3Don,cmm=3Don \ -m 256 \ -overcommit mem-lock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ diff --git a/tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-4.2.s= 390x-latest.xml b/tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-= 4.2.s390x-latest.xml index eec5051934..1cc2edd893 100644 --- a/tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-4.2.s390x-la= test.xml +++ b/tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-4.2.s390x-la= test.xml @@ -8,7 +8,7 @@ hvm - + destroy restart --=20 2.24.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list