From nobody Sun Feb 8 22:08:32 2026 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=1644422627; cv=none; d=zohomail.com; s=zohoarc; b=jOZyuV5t8d2z8zrwT98NJPJ/4JsCZ1/1eM8TucxKv2Al9EtaI80KjCpZwOeex7NdUN3QTMhF6UbqgCdaaxhc3oDA1pXRjAqhk/GYpF7yXN8ZoMHxx9EeafYTaFAmsHdj+JqSSovAk37PqQDeeOxBpdM0Sy4FQ9xhzJOT6svuj0g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644422627; 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=bmDTt2pVW5WO1zwcPizDA0RFFDqmASJ8m3CVqsJ33fo=; b=nzlhpVx+953FTyOAOkyQrcy5Yfby4OPdcOI7tFXDM3kvVR1LoxO6vcLT2f4Q6Wzd2XEA56Lf/WfbdX9KOEX1GBmOCFeiekR/8DCMY+NKbB1gSeTk6DWR++MZc+WKQBcj5buIrRDcbNDYbRAhykwrQyYWuSKFoMrUGmsmNF/NCgI= 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 1644422627036584.9935316966976; Wed, 9 Feb 2022 08:03:47 -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-178-DNAI_jNpPHGlRkaAVwF8jQ-1; Wed, 09 Feb 2022 11:03:40 -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 3E2801091DC4; Wed, 9 Feb 2022 16:03:09 +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 1635284D07; Wed, 9 Feb 2022 16:03: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 D95D7181844F; Wed, 9 Feb 2022 16:03:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 219G2kHS012313 for ; Wed, 9 Feb 2022 11:02:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 216BD7DE40; Wed, 9 Feb 2022 16:02:46 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B4CB7DE4F for ; Wed, 9 Feb 2022 16:02:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644422625; 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=bmDTt2pVW5WO1zwcPizDA0RFFDqmASJ8m3CVqsJ33fo=; b=GctaJXUabLJJGEe8HS/Z1NDsrVKzmhZdTPamfmT4EFnWz1PKOM5KVFMmulGky88Y0vZW1y w3eQhnwxyADK8Ved9YIkytxKDzYJySnaF0KVZSr34lecDdePrnqSax7rzOKER2o7HIlgqU Ra7m1uDZBAPzsrRvGtT66AwF9gsO6o0= X-MC-Unique: DNAI_jNpPHGlRkaAVwF8jQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 12/27] qemuHotplugRemoveFDSet: Prepare for proper FD unplug handling Date: Wed, 9 Feb 2022 17:02:04 +0100 Message-Id: <08b29cd4e56e7065d092305871e8f89f68f12c7f.1644422239.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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: 1644422627584100003 Content-Type: text/plain; charset="utf-8" For now we have only one code path ('vdpa' interface) which actually cleans up the fdset after it's done, but there are more device types using fdsets. In order to unify the handling of fdsets the removal code will now be able to remove fdsets based on a prefix of the 'opaque' field, which we'll always prefix with a device alias or e.g. node name once fdsets are also used for disk backing. To keep compatibility with old qemus, retain the possibility for the VDPA interface to use the path. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_hotplug.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 3264f287c3..03b7ca30de 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -140,18 +140,21 @@ qemuDomainDeleteDevice(virDomainObj *vm, /** * qemuHotplugRemoveFDSet: * @mon: monitor object - * @fdname: the 'opaque' string used as a name for the FD + * @prefix: the prefix of FD names ('opaque' filed) to delete + * @alternate: alternate name for FD, for historical usage (may be NULL) * * Looks up the 'fdset' by looking for a fd inside one of the fdsets which - * has the opaque string set to @fdname. Removes the whole fdset which con= tains - * the fd. + * has the opaque string starting with @prefix. Removes the whole fdset wh= ich + * contains the fd. Alternatively if @alternate is specified fdsets having= a fd + * with that exact 'opaque' string is removed too. * * Errors are logged, but this is a best-effort hot-unplug cleanup helper = so it's * pointless to return a value. */ static void qemuHotplugRemoveFDSet(qemuMonitor *mon, - const char *fdname) + const char *prefix, + const char *alternate) { g_autoptr(qemuMonitorFdsets) fdsets =3D NULL; size_t i; @@ -166,9 +169,11 @@ qemuHotplugRemoveFDSet(qemuMonitor *mon, for (j =3D 0; j < set->nfds; j++) { qemuMonitorFdsetFdInfo *fdinfo =3D &set->fds[j]; - if (STREQ_NULLABLE(fdinfo->opaque, fdname)) { + if (fdinfo->opaque && + (STRPREFIX(fdinfo->opaque, prefix) || + STREQ_NULLABLE(fdinfo->opaque, alternate))) { ignore_value(qemuMonitorRemoveFdset(mon, set->id)); - return; + break; } } } @@ -4799,7 +4804,7 @@ qemuDomainRemoveNetDevice(virQEMUDriver *driver, */ } } else if (actualType =3D=3D VIR_DOMAIN_NET_TYPE_VDPA) { - qemuHotplugRemoveFDSet(priv->mon, net->data.vdpa.devicepath); + qemuHotplugRemoveFDSet(priv->mon, net->info.alias, net->data.vdpa.= devicepath); } qemuDomainObjExitMonitor(driver, vm); --=20 2.34.1