From nobody Fri May 3 01:19:54 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1596812374; cv=none; d=zohomail.com; s=zohoarc; b=XgUZ3i+IsyJhA6siKJnDSXeFYv6vOt+JXtpqfvb7kiZJ+bcxSpwG+fBNs/wfb+LwWQoCswZ74t0blVcisirHZd18vGtyAh5udWGtISSqBi7nlCoEYiI3eYRL+yIoypI7UDRHqri8rMYdFIPVVZUoT5oS4B400hs59z3ansYrGz4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596812374; h=Content-Type:Content-Transfer-Encoding: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=i8iP18pmMiUUIKOAoSjsvIog1NJQlFYArygrE6KZDPA=; b=VTwHkVqzl4uRj8aptTDboTqbtXvS9y2vDh2UcjfsIwRm3VMWMKcBp0uh4XETLb5xnvd3veI79KGwidijo9hw1O9YI+5IG45jzrzLDZyC6TdPFCTFeGSB7vYKNICSGU5JhlwmlDihKM3C0E39O+2FH7mzVdDVWmxYAbF0MgFO4X8= 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=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 1596812374049420.3442922904926; Fri, 7 Aug 2020 07:59:34 -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-245-BXhylyCCMwW7Mr-SAZkBhg-1; Fri, 07 Aug 2020 10:59:30 -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 10CFC107BF11; Fri, 7 Aug 2020 14:59:25 +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 E12B165C9E; Fri, 7 Aug 2020 14:59:24 +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 C6D191809554; Fri, 7 Aug 2020 14:59:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 077ExK86022550 for ; Fri, 7 Aug 2020 10:59:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2858365C99; Fri, 7 Aug 2020 14:59:20 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.192.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A1EA65C9E for ; Fri, 7 Aug 2020 14:59:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596812372; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=i8iP18pmMiUUIKOAoSjsvIog1NJQlFYArygrE6KZDPA=; b=U8EBsKtTLumCtGiDEEmsHMFdl1Bg63/BMfxiIzwodQ7GeE4V2ckkr6rCo52/jNSCfvHdN4 kr5NwNwnasLAYF85yJTBRofTsckiE2MRZ18XrlfKxcBfmdGbWfAMk9bAqHo2tcTxmbc0Uh RA6FcRkR2uOZAOG8UOzWpiX8NTKCw8A= X-MC-Unique: BXhylyCCMwW7Mr-SAZkBhg-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 1/3] conf: fix detection of available host CPUs for vcpupin Date: Fri, 7 Aug 2020 16:59:12 +0200 Message-Id: <5445263db50db12a3e315e97e87e917f75b2f7a7.1596812211.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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 <2020c6af8a8e4bb04acb629d089142be984484c8> fixed an issue with QEMU driver by reporting offline CPUs as well. However, doing so it introduced a regression into libxl and test drivers by completely ignoring the passed `hostcpus` variable. Move the virHostCPUGetAvailableCPUsBitmap() out of the helper into QEMU driver so it will not affect other drivers which gets the number of host CPUs differently. This was uncovered by running libvirt-dbus test suite which counts on the fact that test driver has hard-coded host definition and must not depend on the host at all. Signed-off-by: Pavel Hrdina Reviewed-by: Daniel P. Berrang=C3=A9 --- src/conf/domain_conf.c | 18 +++++------------- src/conf/domain_conf.h | 4 ++-- src/libxl/libxl_driver.c | 7 ++++++- src/qemu/qemu_driver.c | 6 +++++- src/test/test_driver.c | 8 ++++++-- 5 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ef67efa1da..8e7981bf25 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2090,33 +2090,25 @@ virDomainDefHasVcpuPin(const virDomainDef *def) * @maplen: length of one cpumap passed from caller (@cpumaps) * @ncpumaps: count of cpumaps of @maplen length in @cpumaps * @cpumaps: array of pinning information bitmaps to be filled - * @hostcpus: number of cpus in the host + * @hostcpus: default CPU pinning bitmap based on host CPUs * @autoCpuset: Cpu pinning bitmap used in case of automatic cpu pinning * * Fills the @cpumaps array as documented by the virDomainGetVcpuPinInfo A= PI. * In case when automatic cpu pinning is supported, the bitmap should be p= assed - * as @autoCpuset. If @hostcpus is < 0 no error is reported (to pass throu= gh - * error message). + * as @autoCpuset. * - * Returns number of filled entries or -1 on error. + * Returns number of filled entries. */ int virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def, int maplen, int ncpumaps, unsigned char *cpumaps, - int hostcpus, + virBitmapPtr hostcpus, virBitmapPtr autoCpuset) { int maxvcpus =3D virDomainDefGetVcpusMax(def); size_t i; - g_autoptr(virBitmap) allcpumap =3D NULL; - - if (hostcpus < 0) - return -1; - - if (!(allcpumap =3D virHostCPUGetAvailableCPUsBitmap())) - return -1; =20 for (i =3D 0; i < maxvcpus && i < ncpumaps; i++) { virDomainVcpuDefPtr vcpu =3D virDomainDefGetVcpu(def, i); @@ -2130,7 +2122,7 @@ virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def, else if (def->cpumask) bitmap =3D def->cpumask; else - bitmap =3D allcpumap; + bitmap =3D hostcpus; =20 virBitmapToDataBuf(bitmap, VIR_GET_CPUMAP(cpumaps, maplen, i), map= len); } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 011bf66cb4..68be32614c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3741,9 +3741,9 @@ int virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr = def, int maplen, int ncpumaps, unsigned char *cpumaps, - int hostcpus, + virBitmapPtr hostcpus, virBitmapPtr autoCpuset) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4) G_GNUC_WARN_UNUSED_RESULT; + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) G_GNUC_= WARN_UNUSED_RESULT; =20 bool virDomainDefHasMemballoon(const virDomainDef *def) ATTRIBUTE_NONNULL(= 1); =20 diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 4db3c0782e..dc602ea162 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -2547,6 +2547,7 @@ libxlDomainGetVcpuPinInfo(virDomainPtr dom, int ncpum= aps, libxlDriverConfigPtr cfg =3D libxlDriverConfigGet(driver); virDomainObjPtr vm =3D NULL; virDomainDefPtr targetDef =3D NULL; + g_autoptr(virBitmap) hostcpus =3D NULL; int ret =3D -1; =20 virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | @@ -2568,8 +2569,12 @@ libxlDomainGetVcpuPinInfo(virDomainPtr dom, int ncpu= maps, /* Make sure coverity knows targetDef is valid at this point. */ sa_assert(targetDef); =20 + if (!(hostcpus =3D virBitmapNew(libxl_get_max_cpus(cfg->ctx)))) + goto cleanup; + virBitmapSetAll(hostcpus); + ret =3D virDomainDefGetVcpuPinInfoHelper(targetDef, maplen, ncpumaps, = cpumaps, - libxl_get_max_cpus(cfg->ctx), N= ULL); + hostcpus, NULL); =20 cleanup: virDomainObjEndAPI(&vm); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0f98243fe4..9eaea8d613 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5288,6 +5288,7 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom, virDomainDefPtr def; bool live; int ret =3D -1; + g_autoptr(virBitmap) hostcpus =3D NULL; virBitmapPtr autoCpuset =3D NULL; =20 virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | @@ -5302,11 +5303,14 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom, if (!(def =3D virDomainObjGetOneDefState(vm, flags, &live))) goto cleanup; =20 + if (!(hostcpus =3D virHostCPUGetAvailableCPUsBitmap())) + goto cleanup; + if (live) autoCpuset =3D QEMU_DOMAIN_PRIVATE(vm)->autoCpuset; =20 ret =3D virDomainDefGetVcpuPinInfoHelper(def, maplen, ncpumaps, cpumap= s, - virHostCPUGetCount(), autoCpuse= t); + hostcpus, autoCpuset); cleanup: virDomainObjEndAPI(&vm); return ret; diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 01c4675c30..a75c992af1 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -3072,6 +3072,7 @@ testDomainGetVcpuPinInfo(virDomainPtr dom, testDriverPtr driver =3D dom->conn->privateData; virDomainObjPtr privdom; virDomainDefPtr def; + g_autoptr(virBitmap) hostcpus =3D NULL; int ret =3D -1; =20 if (!(privdom =3D testDomObjFromDomain(dom))) @@ -3080,9 +3081,12 @@ testDomainGetVcpuPinInfo(virDomainPtr dom, if (!(def =3D virDomainObjGetOneDef(privdom, flags))) goto cleanup; =20 + if (!(hostcpus =3D virBitmapNew(VIR_NODEINFO_MAXCPUS(driver->nodeInfo)= ))) + goto cleanup; + virBitmapSetAll(hostcpus); + ret =3D virDomainDefGetVcpuPinInfoHelper(def, maplen, ncpumaps, cpumap= s, - VIR_NODEINFO_MAXCPUS(driver->no= deInfo), - NULL); + hostcpus, NULL); =20 cleanup: virDomainObjEndAPI(&privdom); --=20 2.26.2 From nobody Fri May 3 01:19:54 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1596812405; cv=none; d=zohomail.com; s=zohoarc; b=MLRV8ToXsOjaqhFgWPyHhy9nnka6r4dOQ7J48PIQVCB2+bUoE2cvg+WWyTsILv4kKMk5cXso6Bmq2JNC76Y/xBbVOjx/RX23WnoAmZGvcvCnefGnKZ9K35fBzyx6OlYieqQf4mHIWfdeDkWEHW9UVbaV6fw/BQtgkCdMTmVnxkU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596812405; h=Content-Type:Content-Transfer-Encoding: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=nRo0oNR7a+Qcrp4emUqQRrtez2XkmZPN4Qezq9Htb/o=; b=UEatOSJdod9beSZsx8LG073uM3rBgJlrNkRbLhETVxzizUrUFr3a8enHZq4E9b+ipdaZ/A3bqZEky8KTWPFLWJ+5/4DF5uYtJf62bfjtBxrBXuvBGKlsa1mfr0KnC6u9iRXzSd0XFk1Oev2jHq0GzogPJtcvq/P1lGSlCeRGRZs= 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=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 1596812405202276.056768563388; Fri, 7 Aug 2020 08:00:05 -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-138-MuFP3AkjNueeRo0m7uTczw-1; Fri, 07 Aug 2020 10:59:40 -0400 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 A52B8801A03; Fri, 7 Aug 2020 14:59:34 +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 83BF1712DB; Fri, 7 Aug 2020 14:59:34 +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 5AA4B1809563; Fri, 7 Aug 2020 14:59:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 077ExLMR022560 for ; Fri, 7 Aug 2020 10:59:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0C67965C9B; Fri, 7 Aug 2020 14:59:21 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.192.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BA4A65C99 for ; Fri, 7 Aug 2020 14:59:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596812403; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=nRo0oNR7a+Qcrp4emUqQRrtez2XkmZPN4Qezq9Htb/o=; b=B1WDGt2oRpD624v0ULNV1/Pe4129taxD87BQudlq4EzVg0hsgzSaJomhK9SCRNvn2jn5Hb W1vTj7zVbWoAqq050/Cs1A+VVb9Uy6z6VqTsH4bMRP0lf4qFADIDRRL/e6PbIu9FVrUHkj iflYHiYKIX3kFwl0j015hN507l+5w7E= X-MC-Unique: MuFP3AkjNueeRo0m7uTczw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 2/3] test: fix emulator pin info in test driver Date: Fri, 7 Aug 2020 16:59:13 +0200 Message-Id: <0006b4330ce8620b15ff9da66814007479e6e78f.1596812211.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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 <6328da04285d9f65cb323d399f731c20caf63f5a> introduced testDomainGetEmulatorPinInfo() into test driver but used virHostCPUGetCount() function to get the number of host CPUs. This would be correct for other drivers but in test driver we must not depend on the host, we have to use hard-coded host representation that we have in test driver. Follows the logic of testDomainGetVcpuPinInfo(). Signed-off-by: Pavel Hrdina Reviewed-by: Daniel P. Berrang=C3=A9 --- src/test/test_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index a75c992af1..d582c207f4 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2764,6 +2764,7 @@ testDomainGetEmulatorPinInfo(virDomainPtr dom, int maplen, unsigned int flags) { + testDriverPtr driver =3D dom->conn->privateData; virDomainObjPtr vm =3D NULL; virDomainDefPtr def =3D NULL; virBitmapPtr cpumask =3D NULL; @@ -2780,8 +2781,7 @@ testDomainGetEmulatorPinInfo(virDomainPtr dom, if (!(def =3D virDomainObjGetOneDef(vm, flags))) goto cleanup; =20 - if ((hostcpus =3D virHostCPUGetCount()) < 0) - goto cleanup; + hostcpus =3D VIR_NODEINFO_MAXCPUS(driver->nodeInfo); =20 if (def->cputune.emulatorpin) { cpumask =3D def->cputune.emulatorpin; --=20 2.26.2 From nobody Fri May 3 01:19:54 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1596812383; cv=none; d=zohomail.com; s=zohoarc; b=RAJSB+WSHD14pH42dHOJg+EGoxtcbQ8+Te2CEuLR3hm0sHw64EK1ny8Pn9sdezZZpYwz/0/avdVS/5qi1TwTiEyxEfxAJncPwFWKOXYZq2R0dexk83oBeq9e1Y8/cgzJQiCPPiCcXbzLYxFcAMagozPo/fdj/x6hplXHfw9NuMY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596812383; h=Content-Type:Content-Transfer-Encoding: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=IFnwj10t1Hmf+mquzHOimRBrXK1VNz8fX5xvLxH9HJ8=; b=l1nN57vgwfHZBNHzzGBecUErW8Rvi32nN7weqzDuh3jDWGgn836GXJ7Qwrbyxlrrjp4Sr5s9p1JwYBT4YXkq/jiIdYcDEdxSCcdgZOkf4Qt+Lxpxea8AJi5gz1w7gCUjMdQZEnOVnHeMKZtaEHZZ72dzfr9TE+aQeWqj2/Lw9OQ= 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=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 1596812383447844.4663701828449; Fri, 7 Aug 2020 07:59:43 -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-89-JwVidNVNP9Ofhx1agfO8lA-1; Fri, 07 Aug 2020 10:59:39 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 73D8E19200C8; Fri, 7 Aug 2020 14:59:34 +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 4FA9360CD0; Fri, 7 Aug 2020 14:59:34 +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 19E5FA552E; Fri, 7 Aug 2020 14:59:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 077ExLmH022569 for ; Fri, 7 Aug 2020 10:59:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id E869565C9B; Fri, 7 Aug 2020 14:59:21 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.192.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6187E65C99 for ; Fri, 7 Aug 2020 14:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596812382; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=IFnwj10t1Hmf+mquzHOimRBrXK1VNz8fX5xvLxH9HJ8=; b=Lap7Ko1NmQLgvxqiO5H6kG4pyJTQxIYoBy4UdS+FEczxaCAg7IdFzMGRTvgQ5JbHdMgecS lN13ON1/eA84GD+UtR296RO6R9Z6HXQDg+FixuSzbc1As82p8GyBnZIe64QiNs0j+XtGro xE33is4IgSRuDEtO5jP3QiFr4GtAsos= X-MC-Unique: JwVidNVNP9Ofhx1agfO8lA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 3/3] qemu: consider available CPUs in iothread info output Date: Fri, 7 Aug 2020 16:59:14 +0200 Message-Id: <60e68fff065566aee24dd85da01298e97af926a8.1596812211.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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" Following the rationale from commit <2020c6af8a8e4bb04acb629d089142be984484c8> we should do the same thing for iothread info as well. Signed-off-by: Pavel Hrdina Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_driver.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9eaea8d613..07e9518a9b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5693,16 +5693,12 @@ qemuDomainGetIOThreadsConfig(virDomainDefPtr target= Def, virDomainIOThreadInfoPtr *info_ret =3D NULL; virBitmapPtr bitmap =3D NULL; virBitmapPtr cpumask =3D NULL; - int hostcpus; size_t i; int ret =3D -1; =20 if (targetDef->niothreadids =3D=3D 0) return 0; =20 - if ((hostcpus =3D virHostCPUGetCount()) < 0) - goto cleanup; - if (VIR_ALLOC_N(info_ret, targetDef->niothreadids) < 0) goto cleanup; =20 @@ -5718,9 +5714,8 @@ qemuDomainGetIOThreadsConfig(virDomainDefPtr targetDe= f, if (targetDef->cpumask) { cpumask =3D targetDef->cpumask; } else { - if (!(bitmap =3D virBitmapNew(hostcpus))) + if (!(bitmap =3D virHostCPUGetAvailableCPUsBitmap())) goto cleanup; - virBitmapSetAll(bitmap); cpumask =3D bitmap; } } --=20 2.26.2