From nobody Mon Feb 9 02:41:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 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=1573208441; cv=none; d=zoho.com; s=zohoarc; b=AiN9FJZrUR2LNP+f0XqeJZfbsYDtuKgh/zJmmU/loyr9dCB526L5QZOXSVO/9vcExpq8uc8JKrZAFM56g8bwxBxbWJNdQGg+FY9da8eMnR+C8/oZcrLCdXFoeyiCLaFJZHqgvMtYMKvQR5tYyYnpe0TFCvJFD+h/39wyTzq+A+8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573208441; 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=/UCzVd5OX7tknz+eSnRv90EDqdAItWjIzWHcJi8kvpA=; b=SD01uAPWdnf3lAh9ofc2wa7FpEQt4AUO8C39xEmMiLOmOEZdfxOZ9PNIc+fKNrdMnzQW8OMvXF6+lZ15HjnI/56vp/YK5pC3BUQR+6/oYbH5TC3fGw+59f9QcsyjJXwtHhheWmFhQYEz3Gbmv+gk9Bqa6JhM0TWRKFUF+Ng8oe4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1573208441130932.6238457397728; Fri, 8 Nov 2019 02:20:41 -0800 (PST) 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-325-EdpirqpnN3i3z9ZDQSjoqg-1; Fri, 08 Nov 2019 05:20:37 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 71D901005500; Fri, 8 Nov 2019 10:20:32 +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 2AF6A5D6B7; Fri, 8 Nov 2019 10:20:30 +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 825A64BB65; Fri, 8 Nov 2019 10:20:29 +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 xA8AKRch025734 for ; Fri, 8 Nov 2019 05:20:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id C18BF60BE2; Fri, 8 Nov 2019 10:20:27 +0000 (UTC) Received: from antique-laptop.redhat.com (ovpn-200-52.brq.redhat.com [10.40.200.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0770760BE1 for ; Fri, 8 Nov 2019 10:20:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573208439; 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=/UCzVd5OX7tknz+eSnRv90EDqdAItWjIzWHcJi8kvpA=; b=ZJ5fwWrEs8wEcVgx8e5Hq4sqIyonKU2lHj49fa5DZVArjYka8UdOMsjKI7BMSSH+H3S5nM v7mcmUSzj0fjk6cc2zk9gZYjVUowByWT0mIkrbpZJz/HUSsykHRUJKb7xXpAhppWiJaxv8 GnAAloBKTXdlayjsem8yJl8iFDMXsZc= From: Pavel Hrdina To: libvir-list@redhat.com Date: Fri, 8 Nov 2019 11:20:23 +0100 Message-Id: <7f88e4c9a8fae3196f10964eb6a5bc4b18027505.1573208385.git.phrdina@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu_process: fix starting VMs if machine group has limited cpuset.cpus 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.79 on 10.5.11.15 X-MC-Unique: EdpirqpnN3i3z9ZDQSjoqg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Commit reworked process affinity setting but did not take cgroups into account which introduced an issue when starting VM with custom cpuset.cpus for the whole machine group. If the machine group is limited to some pCPUs libvirt should not try to set a VM to run on all pCPUs as it will result in permission denied when writing to cpuset.cpus. To fix this the affinity has to be set separately from cgroups cpuset. Resolves: Signed-off-by: Pavel Hrdina Reviewed-by: Michal Privoznik --- src/qemu/qemu_process.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ed8666e9d1..355b740caf 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2636,6 +2636,7 @@ qemuProcessSetupPid(virDomainObjPtr vm, virDomainNumatuneMemMode mem_mode; virCgroupPtr cgroup =3D NULL; virBitmapPtr use_cpumask =3D NULL; + virBitmapPtr afinity_cpumask =3D NULL; g_autoptr(virBitmap) hostcpumap =3D NULL; char *mem_mask =3D NULL; int ret =3D -1; @@ -2661,7 +2662,7 @@ qemuProcessSetupPid(virDomainObjPtr vm, * its config file */ if (qemuProcessGetAllCpuAffinity(&hostcpumap) < 0) goto cleanup; - use_cpumask =3D hostcpumap; + afinity_cpumask =3D hostcpumap; } =20 /* @@ -2702,8 +2703,11 @@ qemuProcessSetupPid(virDomainObjPtr vm, =20 } =20 + if (!afinity_cpumask) + afinity_cpumask =3D use_cpumask; + /* Setup legacy affinity. */ - if (use_cpumask && virProcessSetAffinity(pid, use_cpumask) < 0) + if (afinity_cpumask && virProcessSetAffinity(pid, afinity_cpumask) < 0) goto cleanup; =20 /* Set scheduler type and priority, but not for the main thread. */ --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list