From nobody Thu May 2 15:59:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1642498327; cv=none; d=zohomail.com; s=zohoarc; b=BOH00cbKWiZ7uuqupOHeR33v1Vx4q07F4LcwMlDdimAGU2ZX51pQZxaT2ui1vIc41xK2AYWy5ZNsc0olJEth0EqP9uIAjPkj3wlyjRjkjbeyRLxf9+KBMSzl5FniE0y+yQxSskfXt0QXO6O0QTUQCpHQP65L2FZ5Q6XT+cLwejU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642498327; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=S1e6GM4+Kbp5BkEOKA3L3bxdrIQToTsDnv2RmztrXww=; b=Jv9KgT9OrEQh+HsTltGYMb21E8UewvIkMhjaDK3Pk24nOagQ1h5nrSAdUugXzVV717JWbO/bl/8FX9inYCB4a09S77/XnDN8ZTVC5OAexsrqFxmpqzTllD0/2HnZsR/gZ/JvXhvndJgOIhbYrSbWyA0UBMkFWP3Kmn+OsWWiXOs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1642498327902481.04229124704284; Tue, 18 Jan 2022 01:32:07 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-520-uyVfzsrAMpy6OfmJRAS-Eg-1; Tue, 18 Jan 2022 04:32:05 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3D3B38143EA; Tue, 18 Jan 2022 09:32:00 +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 DC8B355F6F; Tue, 18 Jan 2022 09:31:59 +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 B4E6C4CA93; Tue, 18 Jan 2022 09:31:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20I9VuOS022977 for ; Tue, 18 Jan 2022 04:31:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3F51D1F2FB; Tue, 18 Jan 2022 09:31:56 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F86D1F2F6 for ; Tue, 18 Jan 2022 09:31:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642498326; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=S1e6GM4+Kbp5BkEOKA3L3bxdrIQToTsDnv2RmztrXww=; b=bQOlTXCnxJQUa9uScgvFxybUwJWFn3AK8EjOhgJpXbm3rS7RDhorMpw2mCANmtK+1sxP9Y uH6KWyPJObEQwTgybKP/9EeY010EkEwaPbyWmzoM+uJavJi4CQ8LOHM7QWmYqG0CuCqzR9 sYB5VVGPtFGOD9wtaxL0HBqatRvmfEk= X-MC-Unique: uyVfzsrAMpy6OfmJRAS-Eg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/2] qemuDomainPinIOThread: Copy the cpu bitmap instead of re-parsing it Date: Tue, 18 Jan 2022 10:31:45 +0100 Message-Id: <137a4d7b44bb3694bcd30128b76728c1d50dcc04.1642498278.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.13 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: 1642498328854100001 Content-Type: text/plain; charset="utf-8" The bitmap recorded in the live/persistent definition was re-parsed two more times. We can copy it which is cheaper and less verbose. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Pavel Hrdina --- src/qemu/qemu_driver.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e150b86cef..077547e1d3 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5011,7 +5011,6 @@ qemuDomainPinIOThread(virDomainPtr dom, if (def) { virDomainIOThreadIDDef *iothrid; - virBitmap *cpumask; if (!(iothrid =3D virDomainIOThreadIDFind(def, iothread_id))) { virReportError(VIR_ERR_INVALID_ARG, @@ -5019,11 +5018,8 @@ qemuDomainPinIOThread(virDomainPtr dom, goto endjob; } - if (!(cpumask =3D virBitmapNewData(cpumap, maplen))) - goto endjob; - virBitmapFree(iothrid->cpumask); - iothrid->cpumask =3D cpumask; + iothrid->cpumask =3D virBitmapNewCopy(pcpumap); iothrid->autofill =3D false; /* Configure the corresponding cpuset cgroup before set affinity. = */ @@ -5060,7 +5056,6 @@ qemuDomainPinIOThread(virDomainPtr dom, if (persistentDef) { virDomainIOThreadIDDef *iothrid; - virBitmap *cpumask; if (!(iothrid =3D virDomainIOThreadIDFind(persistentDef, iothread_= id))) { virReportError(VIR_ERR_INVALID_ARG, @@ -5068,11 +5063,8 @@ qemuDomainPinIOThread(virDomainPtr dom, goto endjob; } - if (!(cpumask =3D virBitmapNewData(cpumap, maplen))) - goto endjob; - virBitmapFree(iothrid->cpumask); - iothrid->cpumask =3D cpumask; + iothrid->cpumask =3D virBitmapNewCopy(pcpumap); iothrid->autofill =3D false; ret =3D virDomainDefSave(persistentDef, driver->xmlopt, cfg->confi= gDir); --=20 2.34.1 From nobody Thu May 2 15:59:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1642498338; cv=none; d=zohomail.com; s=zohoarc; b=YdXT+J6b5bcDaVkR2lrVgmBvmLkCxvnaJfbkyOYoDz8ZfLtVRk2vP2JQlwL8xt77irti2xrkKnQqyRTN0LQ5PvTkcYdVfbWqImOXYbGuGF4AIGXnLKIzkb/WC2d9Vsirg9opiNk4zmDzQN6H0dIv4gjA8CMGjWboIJdcxjgbQcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642498338; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BYwyc8nmg/8u/rInE54WLINRLrOZ5qIc3tQMU2egTH4=; b=USOJPfQvMq6AcHsM5z/JQzR/lAceUBe1X2zEQXzKwKGvOxOpGiI7GwZRObVf7IzrtyttrddOxnxU+WTWYEPkzC2f6sFWPUQ+Eqb/GyiHpqhjNrmWPJxccVeYwtFj4sSXNm/h5K37unhrI6Bl1M2vrZJIvvQiKcrZzAL8zK/yTgI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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 [170.10.129.124]) by mx.zohomail.com with SMTPS id 1642498338214777.7583674592365; Tue, 18 Jan 2022 01:32:18 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-671-nyGLwIIfMBCcZ625mhXtjg-1; Tue, 18 Jan 2022 04:32:13 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 969D68143E5; Tue, 18 Jan 2022 09:32:08 +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 74498794D2; Tue, 18 Jan 2022 09:32:08 +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 446B91809CB8; Tue, 18 Jan 2022 09:32:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20I9Vv4o022989 for ; Tue, 18 Jan 2022 04:31:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4B82A1F2F6; Tue, 18 Jan 2022 09:31:57 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB37C1F305 for ; Tue, 18 Jan 2022 09:31:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642498337; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=BYwyc8nmg/8u/rInE54WLINRLrOZ5qIc3tQMU2egTH4=; b=WOtUh1b5rYPQVn92FCRONArbHF+EGkljNm7M1PZo5AXFHiveAVOF2D4vZ/2AXpeD9G9GqL l5Spg9S4zxD1jW1yGwnKvvjUSiN+T4zrSpAl4jc8JFFL+TBsuu8vvgV4Xh3Y+xS2rBRoXP UYLPQe/G7jeiGI0NR3MzjD8xypI6CNQ= X-MC-Unique: nyGLwIIfMBCcZ625mhXtjg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/2] qemuDomainPinIOThread: Update live definition after process pinning Date: Tue, 18 Jan 2022 10:31:46 +0100 Message-Id: <742f424a773fd597f284ebac3a1001b057ac5bf6.1642498279.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.16 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: 1642498340529100001 Content-Type: text/plain; charset="utf-8" Otherwise we'll keep using the new pinning value even if it can't be applied to the thread. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2040555 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Pavel Hrdina --- src/qemu/qemu_driver.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 077547e1d3..3c0c81a6b9 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5018,10 +5018,6 @@ qemuDomainPinIOThread(virDomainPtr dom, goto endjob; } - virBitmapFree(iothrid->cpumask); - iothrid->cpumask =3D virBitmapNewCopy(pcpumap); - iothrid->autofill =3D false; - /* Configure the corresponding cpuset cgroup before set affinity. = */ if (virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET)) { @@ -5039,6 +5035,10 @@ qemuDomainPinIOThread(virDomainPtr dom, if (virProcessSetAffinity(iothrid->thread_id, pcpumap, false) < 0) goto endjob; + virBitmapFree(iothrid->cpumask); + iothrid->cpumask =3D virBitmapNewCopy(pcpumap); + iothrid->autofill =3D false; + qemuDomainSaveStatus(vm); if (g_snprintf(paramField, VIR_TYPED_PARAM_FIELD_LENGTH, --=20 2.34.1