From nobody Mon Feb 9 05:40:54 2026 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=1563800857; cv=none; d=zoho.com; s=zohoarc; b=Qr3xOiyveNp/a9QkPwzM0ElVQKsnSjSngy7DxrwQ8mVkKVdrYK0Q2/6is+FpC6u0ppserYls+X1cW2lh8BbLzo5tZrGPhoqUEd3v6cTztfqiDH24lA2yor5cAxpYEIR9Lp33ZYFIQejbZMjDQ1k80NLqNEdiZ66YgNh39H47H4A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563800857; 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=A9Dz8Qk/AYCO09SXMjKJwW+86YNH3eLsnnYEsjwlfh4=; b=YMSeUSpHrQEJZoqwZOqeIBCtQL6pJ9raGkFB8/trSHkPo0+AH57A8bjeTdNtZSJXyWOxPBKRoWfOmwvGfYS1eaqXFeUUi+I7gPYradI3GWnn4Wq6OaDPfC2i9ixmGMom8Dp8JUGQOBC+tlGyzJ4oKRMzSRXsG8BKiTjPQm8ka+A= 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 1563800857902596.322437641626; Mon, 22 Jul 2019 06:07:37 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 1B48930C01B6; Mon, 22 Jul 2019 13:07:36 +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 E8FDB5D967; Mon, 22 Jul 2019 13:07:35 +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 A4881180020A; Mon, 22 Jul 2019 13:07:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6MD7QoC001404 for ; Mon, 22 Jul 2019 09:07:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id EA9F660C64; Mon, 22 Jul 2019 13:07:26 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7567C619C6 for ; Mon, 22 Jul 2019 13:07:24 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Mon, 22 Jul 2019 15:07:05 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/3] vircgroupv2: store enabled controllers 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 22 Jul 2019 13:07:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" In cgroups v2 when a new group is created by default no controller is enabled so the detection code will not detect any controllers. When enabling the controllers we should also store them for the group. Signed-off-by: Pavel Hrdina --- src/util/vircgroupv2.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 9c44b3473e..af3192c99c 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -365,7 +365,8 @@ virCgroupV2PathOfController(virCgroupPtr group, * 0 on success */ static int -virCgroupV2EnableController(virCgroupPtr parent, +virCgroupV2EnableController(virCgroupPtr group, + virCgroupPtr parent, int controller, bool report) { @@ -391,6 +392,8 @@ virCgroupV2EnableController(virCgroupPtr parent, return -2; } =20 + group->unified.controllers |=3D 1 << controller; + return 0; } =20 @@ -432,14 +435,14 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UN= USED, } =20 if (virCgroupV2HasController(parent, VIR_CGROUP_CONTROLLER_CPU= ) && - virCgroupV2EnableController(parent, + virCgroupV2EnableController(group, parent, VIR_CGROUP_CONTROLLER_CPU, true) < 0) { return -1; } =20 if (virCgroupV2HasController(parent, VIR_CGROUP_CONTROLLER_CPU= SET) && - virCgroupV2EnableController(parent, + virCgroupV2EnableController(group, parent, VIR_CGROUP_CONTROLLER_CPUSET, true) < 0) { return -1; @@ -456,7 +459,7 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUS= ED, if (i =3D=3D VIR_CGROUP_CONTROLLER_CPUACCT) continue; =20 - rc =3D virCgroupV2EnableController(parent, i, false); + rc =3D virCgroupV2EnableController(group, parent, i, false= ); if (rc < 0) { if (rc =3D=3D -2) { virResetLastError(); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list