From nobody Sat Nov 23 13:30:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1715863733602736.0642054618781; Thu, 16 May 2024 05:48:53 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 643391A4C; Thu, 16 May 2024 08:48:52 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 0D6FD181A; Thu, 16 May 2024 08:48:16 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id DC36F17D7; Thu, 16 May 2024 08:48:12 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id CD91B17D7 for ; Thu, 16 May 2024 08:48:11 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-97-nq9kNhQEOD2YwArOB0f6IA-1; Thu, 16 May 2024 08:48:10 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C596B185A783 for ; Thu, 16 May 2024 12:48:09 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.3.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FCAB40C6EB7 for ; Thu, 16 May 2024 12:48:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715863691; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=7wyOk6FfmS4L0ea52gi4x9ofkKpqsAflw2u5Aa+vAyk=; b=AjmtmVnAAtptGmqnkts9X7hdTiDZfu9KmJFbuzLeqEwfdQ7LNZniw5OVmyYfxNaEXhuVUl 1RTqTLgkYV2GFGz4FF9NqM3cFfBii2x7VZV/vgCzvBFSbdyaxofteaHZsPQai4+NuOPpwu uX39Teixhk1i3FFJCWgabDdCFzEH3jg= X-MC-Unique: nq9kNhQEOD2YwArOB0f6IA-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 2/2] virprocess: Debug affinity map in virProcessSetAffinity() Date: Thu, 16 May 2024 14:48:06 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: KA7IXB2VJ6REDLNFDG2TZVFB2FG2QDQR X-Message-ID-Hash: KA7IXB2VJ6REDLNFDG2TZVFB2FG2QDQR X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1715863734695100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The aim of virProcessSetAffinity() is to set affinity of given process to given CPUs. While we currently print the PID into logs, the CPU map is not printed. It may help when debugging weird scenarios. Signed-off-by: Michal Privoznik --- src/util/virprocess.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/virprocess.c b/src/util/virprocess.c index 5cdf3e3eb9..f1e5e4decd 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -452,8 +452,9 @@ int virProcessSetAffinity(pid_t pid, { size_t i; cpuset_t mask; + g_autofree char *mapStr =3D virBitmapFormat(map); =20 - VIR_DEBUG("Set process affinity on %lld", (long long)pid); + VIR_DEBUG("Set process affinity on %1$lld to %2$s", (long long)pid, ma= pStr); =20 CPU_ZERO(&mask); for (i =3D 0; i < virBitmapSize(map); i++) { @@ -509,8 +510,9 @@ int virProcessSetAffinity(pid_t pid, virBitmap *map, bo= ol quiet) size_t masklen; cpu_set_t *mask; int rv =3D -1; + g_autofree char *mapStr =3D virBitmapFormat(map); =20 - VIR_DEBUG("Set process affinity on %lld", (long long)pid); + VIR_DEBUG("Set process affinity on %1$lld to %2$s", (long long)pid, ma= pStr); =20 /* Not only may the statically allocated cpu_set_t be too small, * but there is no way to ask the kernel what size is large enough. --=20 2.43.2