From nobody Wed May 8 22:17:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1561461414; cv=none; d=zoho.com; s=zohoarc; b=lLoR7kfocxOCSATz/X4GKtLqNtDf1WqeHqIsyhZkCPskxEdx36R35S+ji2Cm2VoOM3OYAKjvZ9D++vtGrc7Hda0cG29mx9e2h3eZNQTrIXwSehzG+LV1oWT9ibkEVKXDNHyQua4HDz3TSmyxg3XL8QGKvQeee7ebJ16CkaehRpw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561461414; 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:ARC-Authentication-Results; bh=oY9gX4htzzsewLqN9gdPRAtS9ihVxnuBlfcNLu273IE=; b=Eh5HPnmmsnCZcMGyMkJgkwv85r5VuM083M3meOirdsHfebiIndSpx9mRsTJxvtJ+99Q1FHN4/36+aIu7Gz88pqdA+3KaIx653IvSczuOCwF9M4dVwTfU6XDintys5orJzwBWUB7dAqOWN1hxQPdeKBKfGO+96UwUP0BLxehtXbU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1561461414601978.7453359011115; Tue, 25 Jun 2019 04:16:54 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id A6A8D3007149; Tue, 25 Jun 2019 11:16: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 49BDE5C234; Tue, 25 Jun 2019 11:16:44 +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 C35B61806B19; Tue, 25 Jun 2019 11:16:35 +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 x5PBGVVa029329 for ; Tue, 25 Jun 2019 07:16:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 15D305D71B; Tue, 25 Jun 2019 11:16:31 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 940BD5D717 for ; Tue, 25 Jun 2019 11:16:30 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 25 Jun 2019 13:16:20 +0200 Message-Id: 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 Subject: [libvirt] [PATCH v3 1/7] [ACKED] util: vircgroup: pass parent cgroup into virCgroupDetectControllersCB 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 25 Jun 2019 11:16:53 +0000 (UTC) In cgroups v2 we don't have to detect available controllers every single time if we are creating a new cgroup based on parent cgroup. Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/util/vircgroup.c | 2 +- src/util/vircgroupbackend.h | 3 ++- src/util/vircgroupv1.c | 3 ++- src/util/vircgroupv2.c | 17 +++++++++++------ 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index e32215935b..b7e5f03521 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -383,7 +383,7 @@ virCgroupDetect(virCgroupPtr group, =20 for (i =3D 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) { if (group->backends[i]) { - int rc =3D group->backends[i]->detectControllers(group, contro= llers); + int rc =3D group->backends[i]->detectControllers(group, contro= llers, parent); if (rc < 0) return -1; controllersAvailable |=3D rc; diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h index e58e327c68..1fe0851184 100644 --- a/src/util/vircgroupbackend.h +++ b/src/util/vircgroupbackend.h @@ -95,7 +95,8 @@ typedef char * =20 typedef int (*virCgroupDetectControllersCB)(virCgroupPtr group, - int controllers); + int controllers, + virCgroupPtr parent); =20 typedef bool (*virCgroupHasControllerCB)(virCgroupPtr cgroup, diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c index 97258917bc..fb3e0b2d47 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -420,7 +420,8 @@ virCgroupV1StealPlacement(virCgroupPtr group) =20 static int virCgroupV1DetectControllers(virCgroupPtr group, - int controllers) + int controllers, + virCgroupPtr parent ATTRIBUTE_UNUSED) { size_t i; size_t j; diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 1179c4459a..2d09d77a29 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -285,16 +285,21 @@ virCgroupV2ParseControllersFile(virCgroupPtr group) =20 static int virCgroupV2DetectControllers(virCgroupPtr group, - int controllers) + int controllers, + virCgroupPtr parent) { size_t i; =20 - if (virCgroupV2ParseControllersFile(group) < 0) - return -1; + if (parent) { + group->unified.controllers =3D parent->unified.controllers; + } else { + if (virCgroupV2ParseControllersFile(group) < 0) + return -1; =20 - /* In cgroup v2 there is no cpuacct controller, the cpu.stat file alwa= ys - * exists with usage stats. */ - group->unified.controllers |=3D 1 << VIR_CGROUP_CONTROLLER_CPUACCT; + /* In cgroup v2 there is no cpuacct controller, the cpu.stat file = always + * exists with usage stats. */ + group->unified.controllers |=3D 1 << VIR_CGROUP_CONTROLLER_CPUACCT; + } =20 for (i =3D 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) VIR_DEBUG("Controller '%s' present=3D%s", --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 22:17:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1561461447; cv=none; d=zoho.com; s=zohoarc; b=KuP6HxvMNlKfOd7nnugsO2V/y8wHOFsIwhzVpFj9ssA+C75G2I7Mb+hiSbRPvGcjA1cw1Ksy/TpfTZpZcZtKxJe0I1M6rOh/YPOnpMlkVuvXsiAaBXKQM6EQE56bUug/B2A9mwTA/vVXQagQgubEwybaKpbJg6bDny0R6/U4Zts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561461447; 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:ARC-Authentication-Results; bh=u8RdzsT8QnerQbtYQpxbU3bY1xqVGCeZw8eqHa7gars=; b=YqY4M2/Ea4aO4KAI+BHGiqHgbVN8JmPBC1nWFl35ayePHgbLyWsBoFUvSz6etTGPVYvH38l11D66yR5vu+WXBRCSkH/tBVCn5SzsvgfWJKBBGnIon2CSAvY716s4p7dZqtR51RueqXgguRLQcL4lVERrYP0fxJDaTkoKf9NkfaY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 156146144741627.057795414627094; Tue, 25 Jun 2019 04:17:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 83B6B368E6; Tue, 25 Jun 2019 11:17:25 +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 58BC419728; Tue, 25 Jun 2019 11:17: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 384AB206D4; Tue, 25 Jun 2019 11:17:23 +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 x5PBGVd3029355 for ; Tue, 25 Jun 2019 07:16:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id DCB6B5D71B; Tue, 25 Jun 2019 11:16:31 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65A545D717 for ; Tue, 25 Jun 2019 11:16:31 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 25 Jun 2019 13:16:21 +0200 Message-Id: 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 Subject: [libvirt] [PATCH v3 2/7] util: vircgroup: improve controller detection 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 25 Jun 2019 11:17:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This affects only cgroups v2 where enabled controllers are not based on available mount points but on the list provided in cgroup.controllers file. However, moving it will fill in placement as well, so it needs to be freed together with mount point if we don't need that controller. Before this patch we were assuming that all controllers available in root cgroup where available in all other sub-cgroups which was wrong. In order to fix it we need to move the cgroup controllers detection after cgroup placement was prepared in order to build correct path for cgroup.controllers file. Signed-off-by: Pavel Hrdina --- Notes: Changes in v3: - Moving the detection after placement means we need to free it together with mount point if that controller is not required. src/util/vircgroup.c | 32 ++++++++++++++++---------------- src/util/vircgroupv1.c | 1 + src/util/vircgroupv2.c | 5 +++-- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index b7e5f03521..da506fc0b0 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -381,22 +381,6 @@ virCgroupDetect(virCgroupPtr group, return -1; } =20 - for (i =3D 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) { - if (group->backends[i]) { - int rc =3D group->backends[i]->detectControllers(group, contro= llers, parent); - if (rc < 0) - return -1; - controllersAvailable |=3D rc; - } - } - - /* Check that at least 1 controller is available */ - if (controllersAvailable =3D=3D 0) { - virReportSystemError(ENXIO, "%s", - _("At least one cgroup controller is required= ")); - return -1; - } - /* In some cases we can copy part of the placement info * based on the parent cgroup... */ @@ -421,6 +405,22 @@ virCgroupDetect(virCgroupPtr group, } } =20 + for (i =3D 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) { + if (group->backends[i]) { + int rc =3D group->backends[i]->detectControllers(group, contro= llers, parent); + if (rc < 0) + return -1; + controllersAvailable |=3D rc; + } + } + + /* Check that at least 1 controller is available */ + if (controllersAvailable =3D=3D 0) { + virReportSystemError(ENXIO, "%s", + _("At least one cgroup controller is required= ")); + return -1; + } + return 0; } =20 diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c index fb3e0b2d47..4231d8d6fa 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -464,6 +464,7 @@ virCgroupV1DetectControllers(virCgroupPtr group, } } VIR_FREE(group->legacy[i].mountPoint); + VIR_FREE(group->legacy[i].placement); } } } else { diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 2d09d77a29..29b5806a01 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -250,8 +250,9 @@ virCgroupV2ParseControllersFile(virCgroupPtr group) char **contList =3D NULL; char **tmp; =20 - if (virAsprintf(&contFile, "%s/cgroup.controllers", - group->unified.mountPoint) < 0) + if (virAsprintf(&contFile, "%s%s/cgroup.controllers", + group->unified.mountPoint, + NULLSTR_EMPTY(group->unified.placement)) < 0) return -1; =20 rc =3D virFileReadAll(contFile, 1024 * 1024, &contStr); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 22:17:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1561461447; cv=none; d=zoho.com; s=zohoarc; b=QU78CtvBb/YhbdX9xgYu6/o06gAxjP+/BVZ3ej/7nxWct0dIfXsqHbEYN7yjgwXmDifPnNl0h3K7bJeou4wGmXJh1ohe8W73cinp68j3r10/d9ABj/1akYakLOd0cV9f2oLqb23Awye6skLynGVmFNhcSKbrzhO+txWN59REeZ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561461447; 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:ARC-Authentication-Results; bh=TJtHf30iDcPQFp1XbjrZ0BiDzG6SgrlhWydZkA/EuqA=; b=OqBjBJKQVR7s7XV6yX4rw4ioD7MvGGKUR1AP4Nj9kgNK8It46XjOvliIhtbUFvZBicFI2BdBFnhJg9lC10gS0glxXJw7GmUoqtum4eQpCYR3padN7czXMHocntU/wZ2/nPYcscHxuS9JOszCLpdQfRhG3qMKoEdx69Ct7kbnUSc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1561461447647323.27885715151626; Tue, 25 Jun 2019 04:17:27 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id A2EEBC18B2EC; Tue, 25 Jun 2019 11:17: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 78BD860C4C; Tue, 25 Jun 2019 11:17: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 390CB1806B1A; Tue, 25 Jun 2019 11:17:22 +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 x5PBGWpM029378 for ; Tue, 25 Jun 2019 07:16:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id A94AB5D717; Tue, 25 Jun 2019 11:16:32 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33BDA5D71B for ; Tue, 25 Jun 2019 11:16:32 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 25 Jun 2019 13:16:22 +0200 Message-Id: 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 Subject: [libvirt] [PATCH v3 3/7] [ACKED] util: vircgroupv2: use any controller to create thread directory 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 25 Jun 2019 11:17:26 +0000 (UTC) The assumption that CPU controller would be always enabled is wrong, we should use any available controller to create a new sub-cgroup. Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/util/vircgroupv2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 29b5806a01..6bcbb7e1a0 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -399,7 +399,7 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUS= ED, =20 if (create) { if (flags & VIR_CGROUP_THREAD) { - if (virCgroupSetValueStr(group, VIR_CGROUP_CONTROLLER_CPU, + if (virCgroupSetValueStr(group, controller, "cgroup.type", "threaded") < 0) { return -1; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 22:17:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1561461422; cv=none; d=zoho.com; s=zohoarc; b=RuusjI9emTty4OTng1QSxwSDQElPHc5TE4p1TTusRYFtPpAU3HKm0v6QJhIBG9ACtwUwSmxcqq4/uQAdWelgCbQezh6JLUyXCqFR5182o5JLDJmcKv6KUejqCDNoYMAMsDmOA1iG6g/QLRF85SWp8IjOcXxBEh4TIyEnkvRXj9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561461422; 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:ARC-Authentication-Results; bh=qaeAW/BXV317/ij/FBdFI/0QBkOeurgRHd2ILpY41Lo=; b=brWL2eXa0BN++PPWUPfYJ5i7S+MyoA1A7PB0oKTRijaeZmej4oQiN3nF7TI50HTaia3U6MVs5yv1ohVsPPhGysHlD++pHDXkUzAoDiJkqsH0U/HCAJoDeTFYjECJXVH2eBS0BuZFIw4inBEp9yds01nKsvo6/oAYlA0zl26DMvU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15614614221895.678018059357669; Tue, 25 Jun 2019 04:17:02 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 1CF8F3086204; Tue, 25 Jun 2019 11:16: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 C37D75D71B; Tue, 25 Jun 2019 11:16:47 +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 3DD24206D3; Tue, 25 Jun 2019 11:16:36 +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 x5PBGXhh029401 for ; Tue, 25 Jun 2019 07:16:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 752825D71B; Tue, 25 Jun 2019 11:16:33 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 009C05D717 for ; Tue, 25 Jun 2019 11:16:32 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 25 Jun 2019 13:16:23 +0200 Message-Id: <0d8b0b31cc8b975ad27480c94fa1d26133625ff5.1561460809.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 Subject: [libvirt] [PATCH v3 4/7] [ACKED] util: vircgroupv2: enable CPU controller only if it's available 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 25 Jun 2019 11:16:55 +0000 (UTC) It might happen that we are not able to enable CPU controller so we can enable it for thread sub-cgroups only if it's available in parent cgroup. Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/util/vircgroupv2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 6bcbb7e1a0..3f4548b532 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -404,7 +404,8 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUS= ED, return -1; } =20 - if (virCgroupV2EnableController(parent, + if (virCgroupV2HasController(parent, VIR_CGROUP_CONTROLLER_CPU= ) && + virCgroupV2EnableController(parent, VIR_CGROUP_CONTROLLER_CPU) < 0= ) { return -1; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 22:17:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1561461455; cv=none; d=zoho.com; s=zohoarc; b=ejDfPYtZbq8iS1knOzPo3Hya5fMkSIdt9XSis1gXOXzgNyw7dNU91F5dulpkuIQkfuofpyY9kHEHx0cEdwX7U3ZMsKwcFBvTgaB195WU29FarMUN4Ag70MHokvs+HGJQ+2YyxDh+BIBoPjtHvFKxDgAQvOk4lcxDw5zFwx9KIow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561461455; 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:ARC-Authentication-Results; bh=oHURQokQMLHXL/h/phqtZdcSYcMDAeWU7Ear8OqS+xY=; b=K8HyIikPTHTfsbbPSyiGBp8NIZiJ6NOAOsahjMfnEVQOPknp9kgoJOl+2l3GN7K2D3sMLUmbawjbuJHay5UcHjQELLfqLQ0md3fFio84GIp/H3WR+Nxzrk/cd68Zquj1Qb6JoF2dDDUPQAFljgifPRh6pnR4mqBk4twitvO75yM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1561461455240240.51497108328886; Tue, 25 Jun 2019 04:17:35 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 5C90A3084039; Tue, 25 Jun 2019 11:17:33 +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 2B944600CD; Tue, 25 Jun 2019 11:17: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 E102D206D8; Tue, 25 Jun 2019 11:17:31 +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 x5PBGYjv029420 for ; Tue, 25 Jun 2019 07:16:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4100D5D71B; Tue, 25 Jun 2019 11:16:34 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id C00545D717 for ; Tue, 25 Jun 2019 11:16:33 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 25 Jun 2019 13:16:24 +0200 Message-Id: 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 Subject: [libvirt] [PATCH v3 5/7] util: vircgroupv2: separate return values of virCgroupV2EnableController 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 25 Jun 2019 11:17:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" In order to skip controllers that we are not able to activate we need to return different return value so the caller can decide what to do. Signed-off-by: Pavel Hrdina --- Notes: Introduced in v2 src/util/vircgroupv2.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 3f4548b532..133a8e0e66 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -353,22 +353,37 @@ virCgroupV2PathOfController(virCgroupPtr group, } =20 =20 +/** + * virCgroupV2EnableController: + * + * Returns: -1 on fatal error + * -2 if we failed to write into cgroup.subtree_control + * 0 on success + */ static int virCgroupV2EnableController(virCgroupPtr parent, int controller) { VIR_AUTOFREE(char *) val =3D NULL; + VIR_AUTOFREE(char *) path =3D NULL; =20 if (virAsprintf(&val, "+%s", virCgroupV2ControllerTypeToString(controller)) < 0) { return -1; } =20 - if (virCgroupSetValueStr(parent, controller, - "cgroup.subtree_control", val) < 0) { + if (virCgroupPathOfController(parent, controller, + "cgroup.subtree_control", &path) < 0) { return -1; } =20 + if (virFileWriteStr(path, val, 0) < 0) { + virReportSystemError(errno, + _("Failed to enable controller '%s' for '%s'"= ), + val, path); + return -2; + } + return 0; } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 22:17:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1561461460; cv=none; d=zoho.com; s=zohoarc; b=mx6g6KfRzoU3H9JKOIxXyOztx93UfE5qyOy527R3SkrQdrQ2bVM7XCBOi1lbWNJxHh/uHDXPAYjot9Ni6DyHs8/EPOz75JcxvrG/nOUFTLLffkyoqk9Qe47sk5WALhCSzHV5ONt+vW8OoAeiwijJhPdlzFEn0PE5q76Meo/ih0Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561461460; 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:ARC-Authentication-Results; bh=0bzRaeXYiBYgejWgHnVUIyNNkYFt1F7G8B+XcrYFcA4=; b=OwyVj3OV/Db4/UodWqP+vian6r8RrB/MZ+jrYlf7lIp9Wkps0nhwYxsMpOdZNuJ8BI624zhjvcsank30175tWSS9JnZA5a01GTEFejrtoiW14+Knoe9P0/+r0Bday/g+EDsv8RbQURXJbLzRM8kwUuXXZT+KpKKhobry3RP+WYI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1561461460072501.3910233266423; Tue, 25 Jun 2019 04:17:40 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 8C9AC3091D65; Tue, 25 Jun 2019 11:17:33 +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 9140460C4E; Tue, 25 Jun 2019 11:17: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 405E7206D5; Tue, 25 Jun 2019 11:17:31 +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 x5PBGaAK029519 for ; Tue, 25 Jun 2019 07:16:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id B9CAA5D756; Tue, 25 Jun 2019 11:16:36 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 44F805D717 for ; Tue, 25 Jun 2019 11:16:34 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 25 Jun 2019 13:16:25 +0200 Message-Id: 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 Subject: [libvirt] [PATCH v3 6/7] util: vircgroupv2: don't error out if enabling controller fails 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 25 Jun 2019 11:17:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Currently CPU controller cannot be enabled if there is any real-time task running and is assigned to non-root cgroup which is the case on several distributions with graphical environment. Instead of erroring out treat it as the controller is not available. Signed-off-by: Pavel Hrdina --- src/util/vircgroupv2.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 133a8e0e66..348c12d5c6 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -433,6 +433,8 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUS= ED, } else { size_t i; for (i =3D 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) { + int rc; + if (!virCgroupV2HasController(parent, i)) continue; =20 @@ -440,8 +442,17 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNU= SED, if (i =3D=3D VIR_CGROUP_CONTROLLER_CPUACCT) continue; =20 - if (virCgroupV2EnableController(parent, i) < 0) + rc =3D virCgroupV2EnableController(parent, i); + if (rc < 0) { + if (rc =3D=3D -2) { + virResetLastError(); + VIR_DEBUG("failed to enable '%s' controller, skipp= ing", + virCgroupV2ControllerTypeToString(i)); + group->unified.controllers &=3D ~(1 << i); + continue; + } return -1; + } } } } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 22:17:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1561461460; cv=none; d=zoho.com; s=zohoarc; b=T3hB3VezQauDIQEO/6KaOmUvfFswjV3tRftEivInJ9tBV3jdR4YNJ9H+U8avo22Zuu4G9jt83c+9a/R9auswM2DXNvCT3GucL9uDN1flJ/SMLs8vFnrMZxCy9SHE7fES4EghQlh9zVq5tlHA/waq9HkUGqnIl6wjiZ9lmpwWhqk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561461460; 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:ARC-Authentication-Results; bh=7pSEP3mDSIJweKFOAlUeS2IYIoYycEvzLsw09CwrA2U=; b=jRXoecVKdiI9ZavPGK9ccWu5qrvMJWeJ/+mATdao21X5OckpNHs5CwfqbNTwh7/02H1Yp+9QoPKs+CXzDIxw/clMr5fFhQpnJpSxnOZzD4i0w8JtL+aqQQHLR0M9luU2SeVAKYB2kQQsi8DqngFKLc8tzp0yGoqepQzjwmw9m3A= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1561461460018615.7152437671851; Tue, 25 Jun 2019 04:17:40 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 563BF307AD00; Tue, 25 Jun 2019 11:17:37 +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 2A5536013A; Tue, 25 Jun 2019 11:17:36 +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 DC3461806B18; Tue, 25 Jun 2019 11:17:35 +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 x5PBGbGS029579 for ; Tue, 25 Jun 2019 07:16:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8541C5D717; Tue, 25 Jun 2019 11:16:37 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 107255D756 for ; Tue, 25 Jun 2019 11:16:36 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 25 Jun 2019 13:16:26 +0200 Message-Id: <5fd7ebbffb57a595c28f6eb69977d26935a9cc3d.1561460809.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 Subject: [libvirt] [PATCH v3 7/7] util: vircgroupv2: mark only requested controllers as available 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 25 Jun 2019 11:17:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" When detecting available controllers on host we can be limited by list of controllers from qemu.conf file. Signed-off-by: Pavel Hrdina --- Notes: Introduced in v3 src/util/vircgroupv2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 348c12d5c6..fd883f3c7f 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -302,15 +302,15 @@ virCgroupV2DetectControllers(virCgroupPtr group, group->unified.controllers |=3D 1 << VIR_CGROUP_CONTROLLER_CPUACCT; } =20 + if (controllers >=3D 0) + group->unified.controllers &=3D controllers; + for (i =3D 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) VIR_DEBUG("Controller '%s' present=3D%s", virCgroupV2ControllerTypeToString(i), (group->unified.controllers & 1 << i) ? "yes" : "no"); =20 - if (controllers >=3D 0) - return controllers & group->unified.controllers; - else - return group->unified.controllers; + return group->unified.controllers; } =20 =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list