From nobody Sun May 5 11:01:28 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=1561029965; cv=none; d=zoho.com; s=zohoarc; b=VUeAEOnLQle2SzeameJ903dvHywXrXvY0emp9F2QhAv2MGrIr1U9zD1xqq0OVHSeYKzK7b7smq7LFp7Kl5QdD+jWEzQeX8eKVdk1N3thfQlKktaCXCGFatn953I6xdcMpzWRF7oDzHuZv1qmBqTXcUGOKoq2x4ApCjmkUHtnJSk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561029965; 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=6Cm8+VK/rC8lavg7yVZ2E/DbEyK+/R6f361dGGEPJ+s=; b=Mg3MOP957494LFXpWu/vcv663I7u6R8IvlEzNjQTSXEY5upzCjVxka5eOhlhJSKixaKe9p+hI8tgbyPQBVOuEoHjNzvN+Mg4d3Q5ksPctWiZu2PYiqMZ+wYsN1I8cezfDfNokCQQ+F6UeBa6gNLQZFZYAwjHvmVE/CqJ172jQYw= 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 156102996509234.9920012704514; Thu, 20 Jun 2019 04:26:05 -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 5E69D7E42C; Thu, 20 Jun 2019 11:26:03 +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 3850618A66; Thu, 20 Jun 2019 11:26:03 +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 E8B4B206D2; Thu, 20 Jun 2019 11:26:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5KBPnhj031692 for ; Thu, 20 Jun 2019 07:25:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id B41EC5D9E5; Thu, 20 Jun 2019 11:25:49 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4006D5D9D2 for ; Thu, 20 Jun 2019 11:25:49 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Thu, 20 Jun 2019 13:25:41 +0200 Message-Id: <28da27ff6abcebbeac677e18173fb23d6497a4cc.1561029914.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/5] 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-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.27]); Thu, 20 Jun 2019 11:26:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" 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 f58e336404..bb7452d2a0 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 8ce10d3608..3c195f69ce 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 0cfbc96264..671a078b23 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 Sun May 5 11:01:28 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=1561029970; cv=none; d=zoho.com; s=zohoarc; b=NW24pmQ3QkafKBd8GU+nh9NUeYAQF5PUGse50OvOBvR2Zxg1GOX4etUYN5JCDRnYP3QoXiNd82gkYPw5JVYBCtEUud7Z9IhVAjrGimt2SVcQQSchvQLq2lgin/ZkyaNp8fo11QyjxzwV6z9mygCcE10soxQPoSKfiZPgQDOPJuU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561029970; 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=L73RnlYWROxgY/LBzL75ltlLWTlEwPIPyq9Z3t4il0I=; b=fad7nQfcKCmABwR7c11izUJQh99CNEU5ptmB7kAeHhDzNGF0uH/mqCFVjo2ruKLyfW2GAUDUH1q5lzFEDDWc+OoGGrpmiGeisx7yqBMtj9Ln3tSSZv6VbWC//NSA3U9ypI5svyNpcPnUj6CaGOy75aRdzZ0xwaD54H3M66vnkk0= 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 1561029970474941.3930653482221; Thu, 20 Jun 2019 04:26:10 -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 DE6CA30860CE; Thu, 20 Jun 2019 11:26:08 +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 B9F695D969; Thu, 20 Jun 2019 11:26:08 +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 79235206D7; Thu, 20 Jun 2019 11:26:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5KBPos3031700 for ; Thu, 20 Jun 2019 07:25:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7F2E75D9E5; Thu, 20 Jun 2019 11:25:50 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B93B5D9D2 for ; Thu, 20 Jun 2019 11:25:49 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Thu, 20 Jun 2019 13:25:42 +0200 Message-Id: <806e42477534b86a40f28f29f784451b7918eaa2.1561029914.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/5] 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.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.44]); Thu, 20 Jun 2019 11:26:09 +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. 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 Reviewed-by: J=C3=A1n Tomko --- src/util/vircgroup.c | 32 ++++++++++++++++---------------- src/util/vircgroupv2.c | 5 +++-- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index bb7452d2a0..3a69698a8b 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/vircgroupv2.c b/src/util/vircgroupv2.c index 671a078b23..186c4fc76b 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 Sun May 5 11:01:28 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=1561029958; cv=none; d=zoho.com; s=zohoarc; b=jE41J35N1TF0ii5owKvcVhdUva/bRoxYwdr3X3yp8ckMBsP97ZcWIZtYF0idb9bg/303cElOF2AD+R3Iz1vgKKqTPL1dffL3zWbck1OL7r5zZUafE3nPcKzL8dEBJ4fpp0eHpaTKlJt0Nan8a0y1SR+lAd/eicZ0VaYZSCZO/64= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561029958; 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=x7/Sfc81cmb55Wv7Z2HRDTdFUgSPHPNNYSVX2O2oUrg=; b=COeKB1Ha0ozn2tgp/ih28XyjDGgpZdgheH0+jGwI7cNJchq730lKBZdeu24c8EReNoKywHkzE0DWhLKawWsU0Wp3G4XEgLqAbAdysYwGUVUpRnn1JCxwYQrmzqI2XVZXs3IP8zl+FDDXrdf7sWuozQ6UMFk9Naa4SHOmqdMAPBI= 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 1561029958133192.68408642378017; Thu, 20 Jun 2019 04:25:58 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 23F4CB2DCD; Thu, 20 Jun 2019 11:25:56 +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 E9FD41001E61; Thu, 20 Jun 2019 11:25:55 +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 B95931806B12; Thu, 20 Jun 2019 11:25:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5KBPpOR031708 for ; Thu, 20 Jun 2019 07:25:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 495715D9E5; Thu, 20 Jun 2019 11:25:51 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA0475D9D2 for ; Thu, 20 Jun 2019 11:25:50 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Thu, 20 Jun 2019 13:25:43 +0200 Message-Id: <04c522128da110c618e14288ee85a53c8f1648c4.1561029914.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/5] 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-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.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 20 Jun 2019 11:25:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" 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 186c4fc76b..f3a119b689 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 Sun May 5 11:01:28 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=1561029958; cv=none; d=zoho.com; s=zohoarc; b=AS4Bh1kcqIvRGeXzyG3VnnpxRqSVr15khmNOOZiutTYgJaUxj9IZi9TcOoEvNjeeMCu2+kWxy7hQH26cImacE2UuO+BbT4hvwMmmvhuhHVTffimR6szb+x1HUv7EN8yMvMYMyXJsEj6fSkRkYD8eTYFsdX8hO3DYLwZCYanuxQ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561029958; 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=nCbz9Qlf0pM8UIi7FjcgvcMD7+TgICggkzC0lYDXkYw=; b=heRzaH41Q3rlRqXWgvD/Fg81jU/WyHw2SvT0oF5Rvxu5ugbbVs/7ScfkBVQpcbpbD7C6HjnCzpscxd4i7il+m9KsCL1SfpBjJK5zK7oVeDAwkQBFG2Tl+DXyABnNvBTBqEJlQ5iOxyiunUhQSvNpqTPHZPKbTWQ729SUB0ZkD7w= 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 1561029958127597.9326757619009; Thu, 20 Jun 2019 04:25:58 -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 3F1593079B9D; Thu, 20 Jun 2019 11:25:56 +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 1974F5D9D2; Thu, 20 Jun 2019 11:25:54 +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 9209C1806B0F; Thu, 20 Jun 2019 11:25:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5KBPq6J031717 for ; Thu, 20 Jun 2019 07:25:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 143735D9E5; Thu, 20 Jun 2019 11:25:52 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94B9B5D9D2 for ; Thu, 20 Jun 2019 11:25:51 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Thu, 20 Jun 2019 13:25:44 +0200 Message-Id: <34636e44c380fe9de073da0f36761fab01ce837b.1561029914.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/5] 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-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.41]); Thu, 20 Jun 2019 11:25:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" 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 f3a119b689..6eeebe2230 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 Sun May 5 11:01:28 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=1561029968; cv=none; d=zoho.com; s=zohoarc; b=cCVWfmBzIa6TfZDIbRQ5vKuJ2VntcFM8Fzpo2Id3ooAS079Mokmy2SHCXX6G8iN2njyh1TSxPazkqsxohbyMOEjwJ4MNHzeggc/FRd1Df6faaRqeeIM2n0VlhKWmvngoZ0Id5OqANt1s0xELcmwm1zm8o3eHPhLha+q0S3Ilzig= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561029968; 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=bhP5MWShKD+BaKd10C8Ub89goetpm7XbBg6NNkNB97w=; b=SszroMiuMdicsLgg6z7jDBm9AWtgUYLhj2sIUzjcqMw7GCe/pUEnmnF6PPqNdbZ+nb36fgyP9XUaOFyDcQYS0Smq03Xg3+PZ5M4HtQJq9rJtmRn9gpb3B1/aFvaJvDa0tLsD7OfnEw8Aw0HT+r99YYsqQpJLW/4quKDL/XrvhZI= 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 1561029968099119.73081779134873; Thu, 20 Jun 2019 04:26:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8548E81129; Thu, 20 Jun 2019 11:26:06 +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 ECE9A60606; Thu, 20 Jun 2019 11:26:05 +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 B0F7C206D4; Thu, 20 Jun 2019 11:26:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5KBPq86031727 for ; Thu, 20 Jun 2019 07:25:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id D45D25D9E5; Thu, 20 Jun 2019 11:25:52 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 602325D9D2 for ; Thu, 20 Jun 2019 11:25:52 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Thu, 20 Jun 2019 13:25:45 +0200 Message-Id: <14fab1d13ae50d5ebd1e758980361c1f28be8749.1561029914.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/5] 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 20 Jun 2019 11:26:07 +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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 6eeebe2230..9cc64d64d2 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -425,8 +425,13 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNU= SED, if (i =3D=3D VIR_CGROUP_CONTROLLER_CPUACCT) continue; =20 - if (virCgroupV2EnableController(parent, i) < 0) - return -1; + if (virCgroupV2EnableController(parent, i) < 0) { + virResetLastError(); + VIR_DEBUG("failed to enable '%s' controller, skipping", + virCgroupV2ControllerTypeToString(i)); + group->unified.controllers &=3D ~(1 << i); + continue; + } } } } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list