From nobody Mon Apr 29 08:29:57 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=1635168415; cv=none; d=zohomail.com; s=zohoarc; b=F3HBm2bfRqK4NHfy9cyLy0UCrqE06Xo58QBRmluoCKqtQOzp5fXKeT+Lvvg6rdQE5MajSwVK5tGMEBpPZTOy6nkHjbmlyPzyyRVI1wrs6KnA4L5jQi0TrWO6XuwEdHxjZD1piF0xcytnLs/XGvWHLbjrI+D6jhFQHTwpSB7jFOM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635168415; 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=5Jwp2qDy4tMHlePhAfOP9iqJx5ASnxSWIdjt9VX/H6w=; b=O9cTy51pmUC0/nhxVfSz/3uiyCdGHSOuhyrCiJKChVy/53hVBiW4N9rXGd+KM8XSMGeIncIAlldT1D9Dc3wBQaFj9p8G51K3A03TCGu2yzT2/IYq2edM2HW9j1sJGerpcktwF0NG2sQBZpOmQ8F+UuwQx3HddoOeZnOTSYxUEsA= 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 1635168415219148.7388480651631; Mon, 25 Oct 2021 06:26:55 -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-449-Us3yVm6hOTy1Jgni9lBMgg-1; Mon, 25 Oct 2021 09:26:52 -0400 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 9FACC1923763; Mon, 25 Oct 2021 13:26:46 +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 7DF10709AF; Mon, 25 Oct 2021 13:26:46 +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 3E2CF4EA41; Mon, 25 Oct 2021 13:26:46 +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 19PDPlAL002959 for ; Mon, 25 Oct 2021 09:25:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 47A4160CCC; Mon, 25 Oct 2021 13:25:47 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DF7A60BF1 for ; Mon, 25 Oct 2021 13:25:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635168414; 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=5Jwp2qDy4tMHlePhAfOP9iqJx5ASnxSWIdjt9VX/H6w=; b=eWpwWVDZu63AOoB07DizQ/nRjl8dTNWBrNqJcShZOit8Pq6CPFiypLRxLhWmvk89vvVDBk 9cpiud+zkNeQJLp2jiRULkWHMblRWzLThP5UFf93qe0p+rml/7AK7KeoYKUmDkQKmFkwC3 uhdbRDAvnEeSeyTPDNisjOqp4gdkYnE= X-MC-Unique: Us3yVm6hOTy1Jgni9lBMgg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] qemu_monitor: Make domainMemoryDeviceSizeChange cb return void Date: Mon, 25 Oct 2021 15:25:43 +0200 Message-Id: <48351134eee4993e0e4031eb2217ff0f1236e07b.1635168317.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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: 1635168416937100001 Content-Type: text/plain; charset="utf-8" Nobody's interested in the return value of any of struct _qemuMonitorCallbacks callbacks. They are all void, but domainMemoryDeviceSizeChange. Change it to void. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/qemu/qemu_monitor.h | 10 +++++----- src/qemu/qemu_process.c | 5 +---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 8214c2fd9f..b54c1cf87a 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -413,11 +413,11 @@ typedef void (*qemuMonitorDomainMemoryFailureCallback= )(qemuMonitor *mon, qemuMonitorEventMem= oryFailure *mfp, void *opaque); =20 -typedef int (*qemuMonitorDomainMemoryDeviceSizeChange)(qemuMonitor *mon, - virDomainObj *vm, - const char *alias, - unsigned long long = size, - void *opaque); +typedef void (*qemuMonitorDomainMemoryDeviceSizeChange)(qemuMonitor *mon, + virDomainObj *vm, + const char *alias, + unsigned long long= size, + void *opaque); =20 typedef struct _qemuMonitorCallbacks qemuMonitorCallbacks; struct _qemuMonitorCallbacks { diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 6027b30405..2a1fcad1ee 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1845,7 +1845,7 @@ qemuProcessHandleMemoryFailure(qemuMonitor *mon G_GNU= C_UNUSED, } =20 =20 -static int +static void qemuProcessHandleMemoryDeviceSizeChange(qemuMonitor *mon G_GNUC_UNUSED, virDomainObj *vm, const char *devAlias, @@ -1855,7 +1855,6 @@ qemuProcessHandleMemoryDeviceSizeChange(qemuMonitor *= mon G_GNUC_UNUSED, virQEMUDriver *driver =3D opaque; struct qemuProcessEvent *processEvent =3D NULL; qemuMonitorMemoryDeviceSizeChange *info =3D NULL; - int ret =3D -1; =20 virObjectLock(vm); =20 @@ -1878,11 +1877,9 @@ qemuProcessHandleMemoryDeviceSizeChange(qemuMonitor = *mon G_GNUC_UNUSED, } =20 processEvent =3D NULL; - ret =3D 0; cleanup: qemuProcessEventFree(processEvent); virObjectUnlock(vm); - return ret; } =20 =20 --=20 2.32.0 From nobody Mon Apr 29 08:29:57 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=1635168393; cv=none; d=zohomail.com; s=zohoarc; b=Ab6WJp/7JTFYzWP0yubEM5RDNNjT4Zqat6nnDe9aCPVDyur8P5XZESxUYYvHMpXrIdticDdgNkxBwsBhAwNoeIx+E+PTfq2/V7fWsrsjbR4bYTyWXobrNFISwXRmU2f9HlJtIHbOIz1enrxPZ3FhLY7KJ5XEYpDuNIPM79gzyHo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635168393; 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=C5F3HgnKoWCQj2HYrnw+v/IVu3WcgaHCNPiOESodMy0=; b=dMAjZruERLGr6Rw1SHB3QQdA4LndBa4Hf+usNoRt+BmWQzuhIQlXUkbZNkLBOx/PBFBIegDYO1y4Mk6kgVRgz69kWfJp6BfCiJiLHJg8q5BRmW2JwkgbB7y2Ulwg6+Tgtaa7UcymVpHStMgbNTruinQnvfwPknRMS7NQmUJZRJE= 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 1635168393180646.8939741495251; Mon, 25 Oct 2021 06:26:33 -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-468-tp8ZAcy7PzmBgHVJgKExZQ-1; Mon, 25 Oct 2021 09:26:30 -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 26ADE100D020; Mon, 25 Oct 2021 13:26:24 +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 0AF6660FB8; Mon, 25 Oct 2021 13:26:23 +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 B776D181A1D0; Mon, 25 Oct 2021 13:26:20 +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 19PDPmMu002969 for ; Mon, 25 Oct 2021 09:25:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2CCEF60CD1; Mon, 25 Oct 2021 13:25:48 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83DDF60BF1 for ; Mon, 25 Oct 2021 13:25:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635168392; 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=C5F3HgnKoWCQj2HYrnw+v/IVu3WcgaHCNPiOESodMy0=; b=CFmFLKXZ5qSlMs++2+j+X43Lj5JIrtjrKSPPHc3qtMdqoc/BGFKvso1FU79UU+KF1GIWcZ mS2et6+QrX286WFUV4xNSzlIe7IHONGpr8AGQ+3M2IT/ZkSD4GULOSppnoRNvHDqeeJ7KV IrLzZXYXXMfTP7K9Bn7n5i8IFKoOJ+8= X-MC-Unique: tp8ZAcy7PzmBgHVJgKExZQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] qemuProcessHandleMemoryDeviceSizeChange: Use qemuProcessEventSubmit() Date: Mon, 25 Oct 2021 15:25:44 +0200 Message-Id: <7ecbbabd334c454376a208750247bf1a9f089ea1.1635168317.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635168394781100001 Content-Type: text/plain; charset="utf-8" This is a typical example of what can go wrong when sending out an old patch. Back in January, when I was writing qemuProcessHandleMemoryDeviceSizeChange() events were sent to the worker pool thread using virThreadPoolSendJob(). Then, in July a helper was introduced (qemuProcessEventSubmit()) but since my code was not committed and I did not pay attention my code wasn't updated. Later, when I merged my code it uses the old approach. BTW: this also fixes a possible double free which I completely missed when writing the code ~10 months ago. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/qemu/qemu_process.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 2a1fcad1ee..d5f8a47ac2 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1870,15 +1870,8 @@ qemuProcessHandleMemoryDeviceSizeChange(qemuMonitor = *mon G_GNUC_UNUSED, processEvent->vm =3D virObjectRef(vm); processEvent->data =3D g_steal_pointer(&info); =20 - if (virThreadPoolSendJob(driver->workerPool, 0, processEvent) < 0) { - qemuProcessEventFree(processEvent); - virObjectUnref(vm); - goto cleanup; - } + qemuProcessEventSubmit(driver, &processEvent); =20 - processEvent =3D NULL; - cleanup: - qemuProcessEventFree(processEvent); virObjectUnlock(vm); } =20 --=20 2.32.0