From nobody Sun May 5 22:53:51 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1550674569334551.5391919655634; Wed, 20 Feb 2019 06:56:09 -0800 (PST) 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 CB1FA12795F; Wed, 20 Feb 2019 14:56:05 +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 5083E183C9; Wed, 20 Feb 2019 14:56: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 0EEB6181A00A; Wed, 20 Feb 2019 14:56:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1KEtu5I022270 for ; Wed, 20 Feb 2019 09:55:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id D9ACE17976; Wed, 20 Feb 2019 14:55:56 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5784217ABC for ; Wed, 20 Feb 2019 14:55:56 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Wed, 20 Feb 2019 15:55:51 +0100 Message-Id: <89832363804a09b775b50ce1b7051a2cc5c41502.1550674508.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/4] util: implement virCgroupV2(Set|Get)CpusetMems 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.39]); Wed, 20 Feb 2019 14:56:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- src/util/vircgroupv2.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index e0fa8e1cc0..4cfbd52f2d 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -1561,6 +1561,28 @@ virCgroupV2GetCpuacctStat(virCgroupPtr group, } =20 =20 +static int +virCgroupV2SetCpusetMems(virCgroupPtr group, + const char *mems) +{ + return virCgroupSetValueStr(group, + VIR_CGROUP_CONTROLLER_CPUSET, + "cpuset.mems", + mems); +} + + +static int +virCgroupV2GetCpusetMems(virCgroupPtr group, + char **mems) +{ + return virCgroupGetValueStr(group, + VIR_CGROUP_CONTROLLER_CPUSET, + "cpuset.mems", + mems); +} + + virCgroupBackend virCgroupV2Backend =3D { .type =3D VIR_CGROUP_BACKEND_TYPE_V2, =20 @@ -1620,6 +1642,9 @@ virCgroupBackend virCgroupV2Backend =3D { =20 .getCpuacctUsage =3D virCgroupV2GetCpuacctUsage, .getCpuacctStat =3D virCgroupV2GetCpuacctStat, + + .setCpusetMems =3D virCgroupV2SetCpusetMems, + .getCpusetMems =3D virCgroupV2GetCpusetMems, }; =20 =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 22:53:51 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1550674572241668.5279309083033; Wed, 20 Feb 2019 06:56:12 -0800 (PST) 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 64CF21301B6; Wed, 20 Feb 2019 14:56:10 +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 A4AEF60141; Wed, 20 Feb 2019 14:56:09 +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 4923C181A00C; Wed, 20 Feb 2019 14:56:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1KEtvWm022277 for ; Wed, 20 Feb 2019 09:55:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id C0FDC60851; Wed, 20 Feb 2019 14:55:57 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3CF7717F23 for ; Wed, 20 Feb 2019 14:55:57 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Wed, 20 Feb 2019 15:55:52 +0100 Message-Id: <619194bf7c035f8c1814b5c00c41121328b870f7.1550674508.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/4] util: implement virCgroupV2(Set|Get)CpusetMemoryMigrate 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.39]); Wed, 20 Feb 2019 14:56:11 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Cgroups v2 don't have memory_migrate interface and the migration is enabled by default. Signed-off-by: Pavel Hrdina --- src/util/vircgroupv2.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 4cfbd52f2d..f3aa6ebc48 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -1583,6 +1583,23 @@ virCgroupV2GetCpusetMems(virCgroupPtr group, } =20 =20 +static int +virCgroupV2SetCpusetMemoryMigrate(virCgroupPtr group ATTRIBUTE_UNUSED, + bool migrate ATTRIBUTE_UNUSED) +{ + return 0; +} + + +static int +virCgroupV2GetCpusetMemoryMigrate(virCgroupPtr group ATTRIBUTE_UNUSED, + bool *migrate) +{ + *migrate =3D true; + return 0; +} + + virCgroupBackend virCgroupV2Backend =3D { .type =3D VIR_CGROUP_BACKEND_TYPE_V2, =20 @@ -1645,6 +1662,8 @@ virCgroupBackend virCgroupV2Backend =3D { =20 .setCpusetMems =3D virCgroupV2SetCpusetMems, .getCpusetMems =3D virCgroupV2GetCpusetMems, + .setCpusetMemoryMigrate =3D virCgroupV2SetCpusetMemoryMigrate, + .getCpusetMemoryMigrate =3D virCgroupV2GetCpusetMemoryMigrate, }; =20 =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 22:53:51 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155067456491929.079929090448445; Wed, 20 Feb 2019 06:56:04 -0800 (PST) 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 6F4433E810; Wed, 20 Feb 2019 14:56:01 +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 304492707A; Wed, 20 Feb 2019 14:56:01 +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 B4A3C3D389; Wed, 20 Feb 2019 14:56:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1KEtwZ6022286 for ; Wed, 20 Feb 2019 09:55:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9770160851; Wed, 20 Feb 2019 14:55:58 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1AB9817976 for ; Wed, 20 Feb 2019 14:55:57 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Wed, 20 Feb 2019 15:55:53 +0100 Message-Id: <279874bbdf990cab3f411a0ed6259a6d39aa1a68.1550674508.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/4] util: implement virCgroupV2(Set|Get)CpusetCpus 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.25]); Wed, 20 Feb 2019 14:56:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- src/util/vircgroupv2.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index f3aa6ebc48..25afab1cad 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -1600,6 +1600,28 @@ virCgroupV2GetCpusetMemoryMigrate(virCgroupPtr group= ATTRIBUTE_UNUSED, } =20 =20 +static int +virCgroupV2SetCpusetCpus(virCgroupPtr group, + const char *cpus) +{ + return virCgroupSetValueStr(group, + VIR_CGROUP_CONTROLLER_CPUSET, + "cpuset.cpus", + cpus); +} + + +static int +virCgroupV2GetCpusetCpus(virCgroupPtr group, + char **cpus) +{ + return virCgroupGetValueStr(group, + VIR_CGROUP_CONTROLLER_CPUSET, + "cpuset.cpus", + cpus); +} + + virCgroupBackend virCgroupV2Backend =3D { .type =3D VIR_CGROUP_BACKEND_TYPE_V2, =20 @@ -1664,6 +1686,8 @@ virCgroupBackend virCgroupV2Backend =3D { .getCpusetMems =3D virCgroupV2GetCpusetMems, .setCpusetMemoryMigrate =3D virCgroupV2SetCpusetMemoryMigrate, .getCpusetMemoryMigrate =3D virCgroupV2GetCpusetMemoryMigrate, + .setCpusetCpus =3D virCgroupV2SetCpusetCpus, + .getCpusetCpus =3D virCgroupV2GetCpusetCpus, }; =20 =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 22:53:51 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155084360891617.018588651859886; Fri, 22 Feb 2019 05:53:28 -0800 (PST) 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 44D85309848A; Fri, 22 Feb 2019 13:53:27 +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 17CE22C8DC; Fri, 22 Feb 2019 13:53:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D1E2F181A00A; Fri, 22 Feb 2019 13:53:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1KEtxfw022293 for ; Wed, 20 Feb 2019 09:55:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7513017976; Wed, 20 Feb 2019 14:55:59 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8B9A60851 for ; Wed, 20 Feb 2019 14:55:58 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Wed, 20 Feb 2019 15:55:54 +0100 Message-Id: <712aba71f1026f084da21380b64f0922b131d2e5.1550674508.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/4] util: enable cgroups v2 cpuset controller for threads 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.42]); Fri, 22 Feb 2019 13:53:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" When we create cgroup for qemu threads we need to enable cpuset controller in order to use it. Signed-off-by: Pavel Hrdina --- src/util/vircgroupv2.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 25afab1cad..4084929c5a 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -400,6 +400,12 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNU= SED, VIR_CGROUP_CONTROLLER_CPU) < 0= ) { return -1; } + + if (virCgroupV2HasController(parent, VIR_CGROUP_CONTROLLER_CPU= SET) && + virCgroupV2EnableController(parent, + VIR_CGROUP_CONTROLLER_CPUSET) = < 0) { + return -1; + } } else { size_t i; for (i =3D 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) { --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list