From nobody Thu May 9 01:10:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1599478459; cv=none; d=zohomail.com; s=zohoarc; b=he2BDV5WWLZz24vzVbRplvC3zX/gpAqTr3+0hRjI0aADU9IE7ylWmwyy4yGNQmwp2F86s++ytw06Q/cMEiNIaxtyyLUd2FJg5l14zxvL6krMBxAv1Aclx4F9k0rD1iwc1blBoYLzihp3//4uL2Q2wHgU1Oo16mkDo8Rr8122gsY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599478459; 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=IxvPvHxRbxavpEH8qhKSgFV+K4ol1dyQ29p2uq6KyTg=; b=AvXn/q5RWa/sMsTKeVovI61oeaifOY0YSaY72D3VlRg38MbHTcQoCX7jrRMq1wT3uUHjxsTITxnTa7AhdR1Ak53BTLVuKFAC9i9KlBYDBu+bZIfMl3XMGV3SFP3g/8WwH3weZ/jewRrxPSzcSBfIuh4Wt9D1sujKHBIzlRfbxto= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1599478459145318.77176347545435; Mon, 7 Sep 2020 04:34:19 -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-309-boSJDEcvN3GPPoU-rNPy5A-1; Mon, 07 Sep 2020 07:34:13 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6B0B1873084; Mon, 7 Sep 2020 11:34: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 E62D660C84; Mon, 7 Sep 2020 11:34:04 +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 F06DF79FE8; Mon, 7 Sep 2020 11:34:01 +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 087BY025006199 for ; Mon, 7 Sep 2020 07:34:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 923DC805D2; Mon, 7 Sep 2020 11:34:00 +0000 (UTC) Received: from carol.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 67136805C7 for ; Mon, 7 Sep 2020 11:33:57 +0000 (UTC) Received: from carol.redhat.com (carol.k8r.cz [127.0.0.1]) by carol.localdomain (Postfix) with ESMTP id 7F0A2C200C1 for ; Mon, 7 Sep 2020 13:33:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599478456; 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=IxvPvHxRbxavpEH8qhKSgFV+K4ol1dyQ29p2uq6KyTg=; b=FZmYB5yBzZhfy7wxmXgWw5skMvYTHe4JXC4G9F/4xMir7h++q9DkXQMKuqaQcxnQDCTw5A 8/0XK64k8HFhIcnPoBuFheHZuwsflQCnM3GJ4/gQ6/rBU9jHSTzi7FpzwYR4cU4RK7eRf6 98saV6Y49760/tTm3twBi9Sfh2jB02c= X-MC-Unique: boSJDEcvN3GPPoU-rNPy5A-1 From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH] qemu: Allow setting affinity to fail and don't report error Date: Mon, 7 Sep 2020 13:33:54 +0200 Message-Id: <0237ce8c35d2b7215ffa487bfb90fe676247c619.1599478434.git.mkletzan@redhat.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This is just a clean-up of commit 3791f29b085c using the new parameter of virProcessSetAffinity() introduced in commit 9514e24984ee so that there is no error reported in the logs. Signed-off-by: Martin Kletzander Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_process.c | 65 +++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 35 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 04e5cbb65969..e29f35e10576 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2569,24 +2569,21 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm) return -1; } =20 + /* + * We only want to error out if we failed to set the affinity to + * user-requested mapping. If we are just trying to reset the affinity + * to all CPUs and this fails it can only be an issue if: + * 1) libvirtd does not have CAP_SYS_NICE + * 2) libvirtd does not run on all CPUs + * + * This scenario can easily occurr when libvirtd is run inside a + * container with restrictive permissions and CPU pinning. + * + * See also: https://bugzilla.redhat.com/1819801#c2 + */ if (cpumapToSet && - virProcessSetAffinity(vm->pid, cpumapToSet, false) < 0) { - /* - * We only want to error out if we failed to set the affinity to - * user-requested mapping. If we are just trying to reset the aff= inity - * to all CPUs and this fails it can only be an issue if: - * 1) libvirtd does not have CAP_SYS_NICE - * 2) libvirtd does not run on all CPUs - * - * This scenario can easily occurr when libvirtd is run inside a - * container with restrictive permissions and CPU pinning. - * - * See also: https://bugzilla.redhat.com/1819801#c2 - */ - if (settingAll) - virResetLastError(); - else - return -1; + virProcessSetAffinity(vm->pid, cpumapToSet, settingAll) < 0) { + return -1; } =20 return 0; @@ -2739,25 +2736,23 @@ qemuProcessSetupPid(virDomainObjPtr vm, if (!affinity_cpumask) affinity_cpumask =3D use_cpumask; =20 - /* Setup legacy affinity. */ + /* Setup legacy affinity. + * + * We only want to error out if we failed to set the affinity to + * user-requested mapping. If we are just trying to reset the affinity + * to all CPUs and this fails it can only be an issue if: + * 1) libvirtd does not have CAP_SYS_NICE + * 2) libvirtd does not run on all CPUs + * + * This scenario can easily occurr when libvirtd is run inside a + * container with restrictive permissions and CPU pinning. + * + * See also: https://bugzilla.redhat.com/1819801#c2 + */ if (affinity_cpumask && - virProcessSetAffinity(pid, affinity_cpumask, false) < 0) { - /* - * We only want to error out if we failed to set the affinity to - * user-requested mapping. If we are just trying to reset the aff= inity - * to all CPUs and this fails it can only be an issue if: - * 1) libvirtd does not have CAP_SYS_NICE - * 2) libvirtd does not run on all CPUs - * - * This scenario can easily occurr when libvirtd is run inside a - * container with restrictive permissions and CPU pinning. - * - * See also: https://bugzilla.redhat.com/1819801#c2 - */ - if (affinity_cpumask =3D=3D hostcpumap) - virResetLastError(); - else - goto cleanup; + virProcessSetAffinity(pid, affinity_cpumask, + affinity_cpumask =3D=3D hostcpumap) < 0) { + goto cleanup; } =20 /* Set scheduler type and priority, but not for the main thread. */ --=20 2.28.0