From nobody Sun Feb 8 16:50:39 2026 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=1583412738; cv=none; d=zohomail.com; s=zohoarc; b=R3FyssExsRO63NgxN6dRuILWzm6zpw9dmzt/FqHYSocmqebCozT7HEPYjsyD4F4sMTiE8l7wnQivvmCJ7cHyAskXo72z71HSgZEGi2ygmrcD4Z4Vjh+JohebCs4tqoCng9LDujOUZQMrMAECasHit/AgAYTOVBpL4JYnzV8yMq0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583412738; 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=KoaNi1A9Q6jOIx7b258BLRxLm6HMxR7ObCDRi+xTNk8=; b=Rel5Qukx6iS03BCXDwLnd5/cjfAtMvFEFc2LrqAsGm5r4R3AQZzjpbG60kVhvdg1is9EQ+5XDDQGPmZF0vhr8T205+K1qbBMldjeeoJhIHtjwS/9koWli7Dou0CPS6W3epAWaqlDUl8rqMwH3AB+DhOQhjyNEyDzBQ8GDM8gRDI= 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-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1583412738372578.2060163877153; Thu, 5 Mar 2020 04:52:18 -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-457-eoLvWyo0NPCfWhGPfapx4g-1; Thu, 05 Mar 2020 07:52:14 -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 3FD2A13E6; Thu, 5 Mar 2020 12:52:09 +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 138BA5C219; Thu, 5 Mar 2020 12:52:09 +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 B5BE886A04; Thu, 5 Mar 2020 12:52:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 025CptaG000878 for ; Thu, 5 Mar 2020 07:51:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 193DB1001DF0; Thu, 5 Mar 2020 12:51:55 +0000 (UTC) Received: from domokun.gsslab.fab.redhat.com (unknown [10.33.8.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BCA01001902; Thu, 5 Mar 2020 12:51:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583412736; 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=KoaNi1A9Q6jOIx7b258BLRxLm6HMxR7ObCDRi+xTNk8=; b=jA0nRvHX1VhltWT7mpdm/bRbF/5EhFHYMKownznx9X2CGzC1UXjABZP7/R4Tjsh0IK+If3 TbNVtwyjlr0JPmSVDhLRIfV8cM28vVzF+ObDwGvukHBzuq7B4FzOFTH3p1FHR/xS4b29Cv IAub1PdPELHmKz+bpPbmnXiV4K42uz4= X-MC-Unique: eoLvWyo0NPCfWhGPfapx4g-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 3/7] qemu: start/stop an event thread for QMP probing Date: Thu, 5 Mar 2020 12:51:43 +0000 Message-Id: <20200305125147.2003011-4-berrange@redhat.com> In-Reply-To: <20200305125147.2003011-1-berrange@redhat.com> References: <20200305125147.2003011-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In common with regular QEMU guests, the QMP probing will need an event loop for handling monitor I/O operations. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_process.c | 15 +++++++++++++++ src/qemu/qemu_process.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 7f55f15027..36111c8882 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8373,6 +8373,9 @@ qemuProcessQMPFree(qemuProcessQMPPtr proc) return; =20 qemuProcessQMPStop(proc); + + g_object_unref(proc->eventThread); + VIR_FREE(proc->binary); VIR_FREE(proc->libDir); VIR_FREE(proc->uniqDir); @@ -8404,6 +8407,8 @@ qemuProcessQMPNew(const char *binary, { qemuProcessQMPPtr ret =3D NULL; qemuProcessQMPPtr proc =3D NULL; + const char *threadSuffix; + g_autofree char *threadName =3D NULL; =20 VIR_DEBUG("exec=3D%s, libDir=3D%s, runUid=3D%u, runGid=3D%u, forceTCG= =3D%d", binary, libDir, runUid, runGid, forceTCG); @@ -8418,6 +8423,16 @@ qemuProcessQMPNew(const char *binary, proc->runGid =3D runGid; proc->forceTCG =3D forceTCG; =20 + threadSuffix =3D strrchr(binary, '-'); + if (threadSuffix) + threadSuffix++; + else + threadSuffix =3D binary; + threadName =3D g_strdup_printf("qmp-%s", threadSuffix); + + if (!(proc->eventThread =3D virEventThreadNew(threadName))) + goto cleanup; + ret =3D g_steal_pointer(&proc); =20 cleanup: diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index 9af9f967fd..3077d3ef9e 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -24,6 +24,7 @@ #include "qemu_conf.h" #include "qemu_domain.h" #include "virstoragefile.h" +#include "vireventthread.h" =20 int qemuProcessPrepareMonitorChr(virDomainChrSourceDefPtr monConfig, const char *domainDir); @@ -217,6 +218,7 @@ struct _qemuProcessQMP { char *monpath; char *pidfile; char *uniqDir; + virEventThread *eventThread; virCommandPtr cmd; qemuMonitorPtr mon; pid_t pid; --=20 2.24.1