From nobody Sun May 5 05:31:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1625761426; cv=none; d=zohomail.com; s=zohoarc; b=jnaRbpobh+kG/nIKFZlE54iYGqRGBvfWALMAlB8sh7LOnDP+jvWdx61uopIWhDY611M8fQXm7J5R5WX+vZ/BUitpJu7cdOH4O4N8uDwF1eYcS4tNwUza66HnNlaSHJc8+nBOj6vAABziNWKqBDIEexVp4+/bzV+8Bolj0sr0dMg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1625761426; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=EAtUFBtus0W86drsiGK6RgrlwhwJE5rmdntSD+oNuE0=; b=HFRzr7TpjHruhWe2Fz3CElJLXGmySh0IMzucBIkQEuhXjiZX/aSles/lLZ5rdBiCC19jGDR8HsMz78kroawm1PxVIYQ6mR6/dVQg20joN2HP2sHiJPMkVMWYVxv6sPzdnn7SwvyEV+5JtVqdKd88zJm7Q4SC16E8qgXZcXwn4w0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1625761426249502.7177043464503; Thu, 8 Jul 2021 09:23:46 -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-255-o6ArPS4RPMqATjHsZQ2hBw-1; Thu, 08 Jul 2021 12:23:43 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id D01AB100D680; Thu, 8 Jul 2021 16:23: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 479F319D9F; Thu, 8 Jul 2021 16:23:37 +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 4D26C1809C99; Thu, 8 Jul 2021 16:23:35 +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 168GLxfP023895 for ; Thu, 8 Jul 2021 12:21:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 814A013950; Thu, 8 Jul 2021 16:21:59 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.190]) by smtp.corp.redhat.com (Postfix) with ESMTP id 069465D9FC for ; Thu, 8 Jul 2021 16:21:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625761425; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=EAtUFBtus0W86drsiGK6RgrlwhwJE5rmdntSD+oNuE0=; b=CViNB96jsY8WVVJDP+/sbbZh/C5oEwQn1vB4KXLS5JfjrrT62XeySACSxVKuOylBrHceOE BDukOt0Snbq8AwJSNmOl0g/aG1j7bhZaxbbvCF50hraqcpH8XvXXTKbV6PZlUdwLDAqN48 htlZZfEjw9Xxvquv1Juikukf60BpCZo= X-MC-Unique: o6ArPS4RPMqATjHsZQ2hBw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] vircgroup: Improve virCgroupControllerAvailable wrt to CGroupsV2 Date: Thu, 8 Jul 2021 18:21:46 +0200 Message-Id: <06d42d3784374f51dbee9cfa37d86afb2d6a8c16.1625761299.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.84 on 10.5.11.23 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) X-ZM-MESSAGEID: 1625761427873100001 Content-Type: text/plain; charset="utf-8" It all started as a simple bug: trying to move domain memory between NUMA nodes (e.g. via virsh numatune) did not work. I've traced the problem to qemuProcessHook() because that's where we decide whether to rely on CGroups or use numactl APIs to satisfy . The problem was that virCgroupControllerAvailable() was telling us that cpuset controller is unavailable. This is CGroupsV2, and pretty weird because CGroupsV2 definitely do support cpuset controller and I had them mounted in a standard way. What I found out (with Pavel's help) was that virCgroupNewSelf() was looking into the following path to detect supported controllers: /sys/fs/cgroup/system.slice/cgroup.controllers However, if there's no other VM running then the system.slice only has 'memory' and 'pids' controllers. Therefore, we saw 'cpuset' as not available. The fix is to look at the top most path, which has the full set of controllers: /sys/fs/cgroup/cgroup.controllers Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1976690 Signed-off-by: Michal Privoznik Reviewed-by: Pavel Hrdina --- src/util/vircgroup.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 65a81e8d6f..1b3b28342e 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -2996,7 +2996,10 @@ virCgroupControllerAvailable(int controller) { g_autoptr(virCgroup) cgroup =3D NULL; =20 - if (virCgroupNewSelf(&cgroup) < 0) + /* Don't use virCgroupNewSelf() - we might be running in a slice that + * doesn't have @controller but the domain (for which we will later use + * virCgroupHasController()) might have it. */ + if (virCgroupNew("/", -1, &cgroup) < 0) return false; =20 return virCgroupHasController(cgroup, controller); --=20 2.31.1