From nobody Wed May 15 13:41:42 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=1648585190; cv=none; d=zohomail.com; s=zohoarc; b=HSmRBrVqFHSWmGnZ9IXKTpzGHNOXwL5TcaE46ZWgrfvmIRqFC603h7Rj3q77q3wwHLxqRvpw3lZBC0qC52pUKlsyerm0XPb4oBH9Sj3vwn82cZ6BNNCjah7bYRFWjhkTU9YPzACjs1FRSRgXjYscj1tyRKZnz8Vqg3McHa06ZgQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648585190; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=rNOTcTdAP+RmNl294h1ep1joBLtND7C94DgzcQv86CA=; b=Gr4LeCbPLt2RQkQMbmLWj1x450NXvG5ycVYn45XNb4WOzHTqTxjZI6looJkBdZ1zZ+NosRFp31uvaaFkHD+iXif1im3zmqyLdVafdV765AqeUVP8Ym4JgMt1lSiNzQVFFGhTVn1GZu1pbDBx5wb9ROOjp47DQwPQLQDuY5i3BMg= 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 1648585190425299.76231018252156; Tue, 29 Mar 2022 13:19:50 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-152-dOuQSrwHO1uDh2zmWW1IDw-1; Tue, 29 Mar 2022 16:19:45 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9E57C185A794; Tue, 29 Mar 2022 20:19:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A60B46A0C1; Tue, 29 Mar 2022 20:19:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8C6EF1940345; Tue, 29 Mar 2022 20:19:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 021F21940342 for ; Tue, 29 Mar 2022 20:19:36 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id AA376141DC5F; Tue, 29 Mar 2022 20:19:36 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.18.107]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 899A61400C2C for ; Tue, 29 Mar 2022 20:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648585189; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rNOTcTdAP+RmNl294h1ep1joBLtND7C94DgzcQv86CA=; b=L+8gUmtLIo5e9+Ou2Ex910qUoXDiS6720fqWGfC8wK+6wxSlZ+uxO42LMZfxOwixH5Q7wj L8oLoZ74G+99dW8/3Ha86iKrQ1VjKcQkaQ/LecDxJD5m1fxcSTSiY/7kuOgUsgkx/mG29B j/PICx7H1g3n9rpa7a1+GsrECFRB4Z8= X-MC-Unique: dOuQSrwHO1uDh2zmWW1IDw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH] qemu: fix hotplug for multiqueue vdpa net device Date: Tue, 29 Mar 2022 15:19:35 -0500 Message-Id: <20220329201935.2587146-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 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: 1648585191657100001 Content-Type: text/plain; charset="utf-8"; x-default="true" While commit a5e659f0 removed the restriction against multiple queues for the vdpa net device, there were some missing pieces. Configuring a device statically and then starting the domain worked as expected, but hotplugging a device didn't have the expected multiqueue support enabled. Add the missing bits. Consider the following device xml: Without this patch, hotplugging the above XML description resulted in the following: {"execute":"netdev_add","arguments":{"type":"vhost-vdpa","vhostdev":"/d= ev/fdset/0","id":"hostnet1"},"id":"libvirt-392"} {"execute":"device_add","arguments":{"driver":"virtio-net-pci","netdev"= :"hostnet1","id":"net1","mac":"00:11:22:33:44:03","bus":"pci.5","addr":"0x0= "},"id":"libvirt-393"} With the patch, hotplugging results in the following: {"execute":"netdev_add","arguments":{"type":"vhost-vdpa","vhostdev":"/d= ev/fdset/0","queues":2,"id":"hostnet1"},"id":"libvirt-392"} {"execute":"device_add","arguments":{"driver":"virtio-net-pci","mq":tru= e,"vectors":6,"netdev":"hostnet1","id":"net1","mac":"00:11:22:33:44:03","bu= s":"pci.5","addr":"0x0"},"id":"libvirt-393"} Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2024406 Signed-off-by: Jonathon Jongsma Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 4 ++++ src/qemu/qemu_hotplug.c | 3 +++ tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 453891a725..f7f55b20ef 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4346,6 +4346,10 @@ qemuBuildHostNetProps(virDomainNetDef *net, if (virJSONValueObjectAdd(&netprops, "s:type", "vhost-vdpa", NULL)= < 0 || virJSONValueObjectAppendString(netprops, "vhostdev", vdpadev) = < 0) return NULL; + + if (net->driver.virtio.queues > 1 && + virJSONValueObjectAppendNumberUlong(netprops, "queues", net->d= river.virtio.queues) < 0) + return NULL; break; =20 case VIR_DOMAIN_NET_TYPE_HOSTDEV: diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 3d1bb1be2a..d9ba0b7abe 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1386,6 +1386,9 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver, break; =20 case VIR_DOMAIN_NET_TYPE_VDPA: + queueSize =3D net->driver.virtio.queues; + if (!queueSize) + queueSize =3D 1; if (qemuDomainAdjustMaxMemLock(vm, false) < 0) goto cleanup; adjustmemlock =3D true; diff --git a/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args = b/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args index 26ef666036..4cb805451a 100644 --- a/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args +++ b/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args @@ -29,7 +29,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ -boot strict=3Don \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ -add-fd set=3D0,fd=3D1732,opaque=3Dnet0-vdpa \ --netdev vhost-vdpa,vhostdev=3D/dev/fdset/0,id=3Dhostnet0 \ +-netdev vhost-vdpa,vhostdev=3D/dev/fdset/0,queues=3D2,id=3Dhostnet0 \ -device '{"driver":"virtio-net-pci","mq":true,"vectors":6,"netdev":"hostne= t0","id":"net0","mac":"52:54:00:95:db:c0","bus":"pci.0","addr":"0x2"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ --=20 2.35.1