From nobody Sat Nov 23 11:38:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1715544884880989.0109391536582; Sun, 12 May 2024 13:14:44 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C11AF1B25; Sun, 12 May 2024 16:14:43 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 6C6F71AA3; Sun, 12 May 2024 16:12:53 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id DDC071A57; Sun, 12 May 2024 16:12:48 -0400 (EDT) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 190841A68 for ; Sun, 12 May 2024 16:12:46 -0400 (EDT) Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-41fd5dc0508so23140335e9.0 for ; Sun, 12 May 2024 13:12:46 -0700 (PDT) Received: from localhost.localdomain ([162.213.65.233]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42014f563adsm22354735e9.38.2024.05.12.13.12.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 13:12:44 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715544765; x=1716149565; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ypDz4+AYTmCCi4wCr/0XwHo7pKBjTs1Rm0ekHEbT9FU=; b=j9cSdq07+gHBAjPKCBRsZ/cZcEIXPZJCgtmD5rwk2nNPFZSRllI6PXUyMMtLKR3xPW TvedRg432IVYRDGFFcLyHlcrDGEa8f9kgu5daFmjdpNS6bALQo1CAMYV1yTgCYyQ7WsP DcKh3BBKMFH6L9M9c+CO59ZgdzMobwigDp9Z2YrrgcnIqLO+FtQzBaJAKzBuK2P/i9Hd yMPvJhA8jkpaFNeoYGHAF7qTsJyZNb7gHMN0ZXh+Q2DM4Fqu9xLunX/I2sw74SZ+97J/ wTovfmcKuPrjFa+ltlFd5lElIc5+Xq8cahmAV1xq0ADf+HJXS+8qBFdgx3C5B+exzxEU +zRg== X-Gm-Message-State: AOJu0YwEmGSAX0RCaX1+pGgUUE2ijpqZvxh2OF5ROKZ4jPgF+aOS7kVV LS3mVDN3Lv1gCCE1pgjB0pz7/E1F/p6kiI2JUFnf8rt5C7YmNz24L1Uzi0hlqiG/rS8f9K9Wc5R p X-Google-Smtp-Source: AGHT+IFUkxbL5Qqm9eKDAVI5taFs1EXZusZBN439d9rTMJHvF8F3kSjQAqTg9jLjBS80fw224rDHZQ== X-Received: by 2002:a05:600c:4fcd:b0:41c:2931:e670 with SMTP id 5b1f17b1804b1-41fea9320acmr57241305e9.2.1715544764913; Sun, 12 May 2024 13:12:44 -0700 (PDT) From: Andrew Melnychenko To: devel@lists.libvirt.org Subject: [RFC PATCH v3 1/6] qemu_monitor: Added QEMU's "request-ebpf" support. Date: Sun, 12 May 2024 22:45:43 +0300 Message-ID: <20240512194550.5023-2-andrew@daynix.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240512194550.5023-1-andrew@daynix.com> References: <20240512194550.5023-1-andrew@daynix.com> MIME-Version: 1.0 Message-ID-Hash: XUA3IFOQMANMKVEMHE4VRVN35DVGEMVQ X-Message-ID-Hash: XUA3IFOQMANMKVEMHE4VRVN35DVGEMVQ X-MailFrom: andrew@daynix.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: yuri.benditovich@daynix.com, yan@daynix.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1715544885540100001 Added code for monitor and monitor_json. The "request-ebpf" return's eBPF binary object encoded in base64. QEMU provides eBPF that can be loaded and passed to it from Libvirt. QEMU requires exact eBPF program/maps, so it can be retrieved using QAPI. To load eBPF program - administrative capabilities are required, so Libvirt may load it and pass it to the QEMU instance. For now, there is only "RSS"(Receive Side Scaling) for virtio-net eBPF prog= ram and maps. Signed-off-by: Andrew Melnychenko --- src/qemu/qemu_monitor.c | 13 +++++++++++++ src/qemu/qemu_monitor.h | 3 +++ src/qemu/qemu_monitor_json.c | 26 ++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 3 +++ 4 files changed, 45 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 34e2ccab97..1dc2fa3fac 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4511,3 +4511,16 @@ qemuMonitorDisplayReload(qemuMonitor *mon, =20 return qemuMonitorJSONDisplayReload(mon, type, tlsCerts); } + +const char * +qemuMonitorGetEbpf(qemuMonitor *mon, const char *ebpfName) +{ + QEMU_CHECK_MONITOR_NULL(mon); + + if (ebpfName =3D=3D NULL) { + virReportInvalidNonNullArg(ebpfName); + return NULL; + } + + return qemuMonitorJSONGetEbpf(mon, ebpfName); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 6e81945201..fe8853a2c4 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1586,3 +1586,6 @@ int qemuMonitorDisplayReload(qemuMonitor *mon, const char *type, bool tlsCerts); + +const char * +qemuMonitorGetEbpf(qemuMonitor *mon, const char *ebpfName); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index eb84a3d938..585a645e66 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -8896,3 +8896,29 @@ int qemuMonitorJSONDisplayReload(qemuMonitor *mon, =20 return 0; } + +const char * +qemuMonitorJSONGetEbpf(qemuMonitor *mon, const char *ebpfName) +{ + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; + virJSONValue *ret =3D NULL; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("request-ebpf", "s:id", ebpfN= ame, NULL))) + return NULL; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + return NULL; + + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + return NULL; + + ret =3D virJSONValueObjectGet(reply, "return"); + if (!ret) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("request-ebpf reply was missing 'return' data")); + return NULL; + } + + return g_strdup(virJSONValueObjectGetString(ret, "object")); +} diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 9684660d86..4a6fc9324e 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -829,3 +829,6 @@ qemuMonitorJSONQueryStats(qemuMonitor *mon, int qemuMonitorJSONDisplayReload(qemuMonitor *mon, const char *type, bool tlsCerts); + +const char * +qemuMonitorJSONGetEbpf(qemuMonitor *mon, const char *ebpfName); --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat Nov 23 11:38:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1715545004617566.5184848221792; Sun, 12 May 2024 13:16:44 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 7AE4B1CA4; Sun, 12 May 2024 16:16:43 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 3877D1BB1; Sun, 12 May 2024 16:13:01 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2F00E1A65; Sun, 12 May 2024 16:12:49 -0400 (EDT) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 687AC1A6D for ; Sun, 12 May 2024 16:12:47 -0400 (EDT) Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-41ffad2426eso21609985e9.3 for ; Sun, 12 May 2024 13:12:47 -0700 (PDT) Received: from localhost.localdomain ([162.213.65.233]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42014f563adsm22354735e9.38.2024.05.12.13.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 13:12:45 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715544766; x=1716149566; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jPMvpuC+LLzItXn75SL0dCynD5VqIEF4VHPy79usZNY=; b=wFCGjJ3SgOutjjZesgJ0yAVloIKgcV69SHCpDw5K/Br/zxNc6+7hPnD7uatCgozqcj d8pB6NCgarrQoRtPWGx58PL0F3poYP4zpnV6iIn59sW/FtUlwnHykJ0LD88TmfsIla+f NAJS1JNXaZRJ3nKYAGRJ1RjqEhJzInxPr4V9/Rht85uvgzH9F/3wvzTLPYV30K2tl8jM dH/HdtzIfGfoxuQ3DMF9C8upaBvP/R9VFuGgCU5+ZnC8Vl0E8Ov13JA9d7g+flItxQBo VVfymPWh1O9/ZJarH19+TNwAmjFjMEFOjVdlMghIPeQ5fQtY3mmqWIv5Hq7rb9y+F7E/ 4/MA== X-Gm-Message-State: AOJu0YyXkGIUV/hOJ8t8uNf9ACGhG+8CG38x0O1YajCN7BgJ21TpO7Mr Vpy1tN4AyBEi5JAi3va+CtVkgiHAlRMpThV2apH/042KBD0TjYE1DSYj/BPpGhG9DskK61dVP7C o X-Google-Smtp-Source: AGHT+IH9HP7SDSO79FaWpy/rJoeFDLh7Ly34WGimjJmtiHdklTxf+RYZYAcT4CyMB9VHkSSX2Yvi1Q== X-Received: by 2002:a05:600c:1989:b0:420:78f:3f9b with SMTP id 5b1f17b1804b1-420078f4105mr59168425e9.37.1715544765569; Sun, 12 May 2024 13:12:45 -0700 (PDT) From: Andrew Melnychenko To: devel@lists.libvirt.org Subject: [RFC PATCH v3 2/6] qemu_capabilities: Added logic for retrieving eBPF objects from QEMU. Date: Sun, 12 May 2024 22:45:44 +0300 Message-ID: <20240512194550.5023-3-andrew@daynix.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240512194550.5023-1-andrew@daynix.com> References: <20240512194550.5023-1-andrew@daynix.com> MIME-Version: 1.0 Message-ID-Hash: 7M2QSR453HRZOGD7HVAJS6H5AFLGPMO2 X-Message-ID-Hash: 7M2QSR453HRZOGD7HVAJS6H5AFLGPMO2 X-MailFrom: andrew@daynix.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: yuri.benditovich@daynix.com, yan@daynix.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1715545006047100001 eBPF objects stored in the hash table during runtime. eBPF objects cached encoded in base64 in the .xml cache file. Signed-off-by: Andrew Melnychenko --- src/qemu/qemu_capabilities.c | 122 +++++++++++++++++++++++++++++++++++ src/qemu/qemu_capabilities.h | 3 + 2 files changed, 125 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 45525db803..09bb6ca36e 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -799,6 +799,9 @@ struct _virQEMUCaps { virQEMUCapsAccel kvm; virQEMUCapsAccel hvf; virQEMUCapsAccel tcg; + + /* Hash of ebpf objects encoded in base64 */ + GHashTable *ebpfObjects; }; =20 struct virQEMUCapsSearchData { @@ -846,6 +849,13 @@ const char *virQEMUCapsArchToString(virArch arch) } =20 =20 +const char * +virQEMUCapsGetEbpf(virQEMUCaps *qemuCaps, const char *id) +{ + return virHashLookup(qemuCaps->ebpfObjects, id); +} + + /* Checks whether a domain with @guest arch can run natively on @host. */ bool @@ -1823,6 +1833,8 @@ virQEMUCapsNew(void) qemuCaps->invalidation =3D true; qemuCaps->flags =3D virBitmapNew(QEMU_CAPS_LAST); =20 + qemuCaps->ebpfObjects =3D virHashNew(g_free); + return qemuCaps; } =20 @@ -1965,6 +1977,9 @@ virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps) { g_autoptr(virQEMUCaps) ret =3D virQEMUCapsNewBinary(qemuCaps->binary); size_t i; + GHashTableIter iter; + const char *key; + const char *value; =20 ret->invalidation =3D qemuCaps->invalidation; ret->kvmSupportsNesting =3D qemuCaps->kvmSupportsNesting; @@ -2003,6 +2018,12 @@ virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCap= s) ret->hypervCapabilities =3D g_memdup(qemuCaps->hypervCapabilities, sizeof(virDomainCapsFeatureHyperv)); =20 + ret->ebpfObjects =3D virHashNew(g_free); + g_hash_table_iter_init(&iter, qemuCaps->ebpfObjects); + while (g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &= value)) { + g_hash_table_insert(ret->ebpfObjects, g_strdup(key), g_strdup(valu= e)); + } + return g_steal_pointer(&ret); } =20 @@ -2045,6 +2066,8 @@ void virQEMUCapsDispose(void *obj) =20 g_free(qemuCaps->hypervCapabilities); =20 + g_hash_table_destroy(qemuCaps->ebpfObjects); + virQEMUCapsAccelClear(&qemuCaps->kvm); virQEMUCapsAccelClear(&qemuCaps->hvf); virQEMUCapsAccelClear(&qemuCaps->tcg); @@ -4560,6 +4583,40 @@ virQEMUCapsValidateArch(virQEMUCaps *qemuCaps, xmlXP= athContextPtr ctxt) } =20 =20 +static int +virQEMUCapsParseEbpfObjects(virQEMUCaps *qemuCaps, xmlXPathContextPtr ctxt) +{ + g_autofree xmlNodePtr *nodes =3D NULL; + size_t i; + int n; + + if ((n =3D virXPathNodeSet("./ebpf/object", ctxt, &nodes)) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to parse qemu cached eBPF object")); + return -1; + } + + for (i =3D 0; i < n; i++) { + g_autofree char *id =3D NULL; + g_autofree char *ebpf =3D NULL; + + if (!(id =3D virXMLPropStringRequired(nodes[i], "id"))) + return -1; + + if (!(ebpf =3D virXMLPropStringRequired(nodes[i], "data"))) + return -1; + + if (virHashAddEntry(qemuCaps->ebpfObjects, id, ebpf) < 0) + return -1; + + /* steal the ebpf if it was added to the hash without issues */ + g_steal_pointer(&ebpf); + } + + return 0; +} + + /* * Parsing a doc that looks like * @@ -4707,6 +4764,9 @@ virQEMUCapsLoadCache(virArch hostArch, if (skipInvalidation) qemuCaps->invalidation =3D false; =20 + if (virQEMUCapsParseEbpfObjects(qemuCaps, ctxt) < 0) + return -1; + return 0; } =20 @@ -4944,6 +5004,16 @@ virQEMUCapsFormatHypervCapabilities(virQEMUCaps *qem= uCaps, } =20 =20 +static int +virQEMUCapsFormatEbpfObjectsIterator(void *payload, const char *name, void= *opaque) +{ + virBuffer *buf =3D opaque; + + virBufferAsprintf(buf, "\n", name, (con= st char *)payload); + + return 0; +} + char * virQEMUCapsFormatCache(virQEMUCaps *qemuCaps) { @@ -5034,6 +5104,14 @@ virQEMUCapsFormatCache(virQEMUCaps *qemuCaps) if (qemuCaps->kvmSupportsSecureGuest) virBufferAddLit(&buf, "\n"); =20 + if (virHashSize(qemuCaps->ebpfObjects) > 0) { + virBufferAddLit(&buf, "\n"); + virBufferAdjustIndent(&buf, 2); + virHashForEachSorted(qemuCaps->ebpfObjects, virQEMUCapsFormatEbpfO= bjectsIterator, &buf); + virBufferAdjustIndent(&buf, -2); + virBufferAddLit(&buf, "\n"); + } + virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); =20 @@ -5456,6 +5534,47 @@ virQEMUCapsInitProcessCaps(virQEMUCaps *qemuCaps) } =20 =20 +static int +virQEMUCapsProbeQMPEbpfObject(virQEMUCaps *qemuCaps, const char *id, qemuM= onitor *mon) +{ + const char *ebpfObject =3D NULL; + + ebpfObject =3D qemuMonitorGetEbpf(mon, id); + if (ebpfObject =3D=3D NULL) + return -1; + + return virHashAddEntry(qemuCaps->ebpfObjects, id, (void *)ebpfObject); +} + + +static int +virQEMUCapsProbeQMPSchemaEbpf(virQEMUCaps *qemuCaps, GHashTable *schema, q= emuMonitor *mon) +{ + virJSONValue *ebpfIdsArray; + virJSONValue *ebpfIdsSchema; + size_t i; + + if (virQEMUQAPISchemaPathGet("request-ebpf/arg-type/id", schema, &ebpf= IdsSchema) !=3D 1) + return 0; + + if (!(ebpfIdsArray =3D virJSONValueObjectGetArray(ebpfIdsSchema, "valu= es"))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("malformed QMP schema of 'request-ebpf'")); + return -1; + } + + /* Try to request every eBPF */ + for (i =3D 0; i < virJSONValueArraySize(ebpfIdsArray); i++) { + virJSONValue *id =3D virJSONValueArrayGet(ebpfIdsArray, i); + + if (virQEMUCapsProbeQMPEbpfObject(qemuCaps, virJSONValueGetString(= id), mon) < 0) + return -1; + } + + return 0; +} + + static int virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCaps *qemuCaps, qemuMonitor *mon) @@ -5489,6 +5608,9 @@ virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCaps *qe= muCaps, virQEMUQAPISchemaPathExists("block-stream/arg-type/backing-mask-pr= otocol", schema)) virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKJOB_BACKING_MASK_PROTOCOL); =20 + if (virQEMUCapsProbeQMPSchemaEbpf(qemuCaps, schema, mon) < 0) + return -1; + return 0; } =20 diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 00b4066e9a..371ea19bd0 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -906,3 +906,6 @@ int virQEMUCapsProbeQMPMachineTypes(virQEMUCaps *qemuCaps, virDomainVirtType virtType, qemuMonitor *mon); + +const char * +virQEMUCapsGetEbpf(virQEMUCaps *qemuCaps, const char *id); --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat Nov 23 11:38:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 171554494637594.1959275137491; Sun, 12 May 2024 13:15:46 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 4381A181C; Sun, 12 May 2024 16:15:45 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id C7D0A1B8C; Sun, 12 May 2024 16:12:57 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1C36B1A57; Sun, 12 May 2024 16:12:49 -0400 (EDT) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 002AF1A79 for ; Sun, 12 May 2024 16:12:47 -0400 (EDT) Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-350513d2c6aso1782916f8f.2 for ; Sun, 12 May 2024 13:12:47 -0700 (PDT) Received: from localhost.localdomain ([162.213.65.233]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42014f563adsm22354735e9.38.2024.05.12.13.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 13:12:45 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715544766; x=1716149566; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6ldlONHaq/aoqQD1qXKQARSsiWk1NRsba60/4dhX7A4=; b=eqfw4RmNWrHw10bkyDpnTrwQDGIhacRguWeMfM+wffZo+ml9qdL3sVAtSqmvHjVdVD rAL0lWlJRFPaRo7dD0SjoiVjsJmepxEaKy4HxZpg6TmMx1OWXTseVbE4gWiWIPI4kZLX D+IKc2D0BaM9+U+NGLDQqAL2OBCRaNHsBUdXOWRed7Ygl3+VgIPrvtLvjiqa5WHjxGzK sI9Dz2E7RPgVpd3B2y5W3BFwNUTRm7kPZEMucXQ7GAt8gz21+YDO/IuaEJviqqu6rhvz RtcfS4MY2Q/DLVrfQ70v9G0ErwD4wR9KqPcb42qeQFqGZLnqjwq8pfrfOYEJFzGNqjwL bEAQ== X-Gm-Message-State: AOJu0YzjIlMODonk7pxnLVJt+mfdqPzh3hAWdApd4+9it/b0E+7CfGAl PAOuOSlu9Vaa9bbc3l+Rf4ASOlLhw10UO2hqIl8ybLwLqNnoary7V5/+WhV4qUtgiE1/UPFSMMf 3 X-Google-Smtp-Source: AGHT+IEWFLYBlk1pQz5V0anuuXNZ2Rk0d/yxfew4Jx27xXni6ZY5J0gKAw3qaWetL+AQ3ZXEk80Muw== X-Received: by 2002:a05:6000:114c:b0:34d:8239:8dd0 with SMTP id ffacd0b85a97d-3504a10f827mr5807544f8f.0.1715544766133; Sun, 12 May 2024 13:12:46 -0700 (PDT) From: Andrew Melnychenko To: devel@lists.libvirt.org Subject: [RFC PATCH v3 3/6] qemu_interface: Added routine for loading the eBPF objects. Date: Sun, 12 May 2024 22:45:45 +0300 Message-ID: <20240512194550.5023-4-andrew@daynix.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240512194550.5023-1-andrew@daynix.com> References: <20240512194550.5023-1-andrew@daynix.com> MIME-Version: 1.0 Message-ID-Hash: ZM7AVKZIPMZMAOCLWRHHH4DUPNEKONTD X-Message-ID-Hash: ZM7AVKZIPMZMAOCLWRHHH4DUPNEKONTD X-MailFrom: andrew@daynix.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: yuri.benditovich@daynix.com, yan@daynix.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1715544947980100001 Also, added dependencies for libbpf with bpf option. Signed-off-by: Andrew Melnychenko --- meson.build | 7 ++++ meson_options.txt | 1 + src/qemu/meson.build | 1 + src/qemu/qemu_interface.c | 83 +++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_interface.h | 4 ++ 5 files changed, 96 insertions(+) diff --git a/meson.build b/meson.build index e8b0094b91..e12a703a4d 100644 --- a/meson.build +++ b/meson.build @@ -998,6 +998,12 @@ else libkvm_dep =3D dependency('', required: false) endif =20 +libbpf_version =3D '1.1.0' +libbpf_dep =3D dependency('libbpf', version: '>=3D' + libbpf_version, requ= ired: get_option('libbpf')) +if libbpf_dep.found() + conf.set('WITH_BPF', 1) +endif + libiscsi_version =3D '1.18.0' libiscsi_dep =3D dependency('libiscsi', version: '>=3D' + libiscsi_version= , required: get_option('libiscsi')) =20 @@ -2283,6 +2289,7 @@ libs_summary =3D { 'dlopen': dlopen_dep.found(), 'fuse': fuse_dep.found(), 'glusterfs': glusterfs_dep.found(), + 'libbpf': libbpf_dep.found(), 'libiscsi': libiscsi_dep.found(), 'libkvm': libkvm_dep.found(), 'libnbd': libnbd_dep.found(), diff --git a/meson_options.txt b/meson_options.txt index 9d729b3e1f..9b7bd9d1f8 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -48,6 +48,7 @@ option('udev', type: 'feature', value: 'auto', descriptio= n: 'udev support') option('wireshark_dissector', type: 'feature', value: 'auto', description:= 'wireshark support') option('wireshark_plugindir', type: 'string', value: '', description: 'wir= eshark plugins directory for use when installing wireshark plugin') option('yajl', type: 'feature', value: 'auto', description: 'yajl support') +option('libbpf', type: 'feature', value: 'auto', description: 'qemu libbpf= support') =20 =20 # build driver options diff --git a/src/qemu/meson.build b/src/qemu/meson.build index 907893d431..de7ae87d5b 100644 --- a/src/qemu/meson.build +++ b/src/qemu/meson.build @@ -105,6 +105,7 @@ if conf.has('WITH_QEMU') selinux_dep, src_dep, xdr_dep, + libbpf_dep, ], include_directories: [ conf_inc_dir, diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index c2007c7043..ec8cf18d86 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -38,6 +38,10 @@ #include #include =20 +#ifdef WITH_BPF +#include +#endif + #define VIR_FROM_THIS VIR_FROM_QEMU =20 VIR_LOG_INIT("qemu.qemu_interface"); @@ -432,3 +436,82 @@ qemuInterfaceOpenVhostNet(virDomainObj *vm, virDomainAuditNetDevice(vm->def, net, vhostnet_path, vhostfdSize); return 0; } + +#ifdef WITH_BPF + +int +qemuInterfaceLoadEbpf(const char *ebpfObject, void **retLibbpfObj, int *fd= s, size_t nfds) +{ + int err =3D 0; + size_t i =3D 0; + struct bpf_program *prog; + struct bpf_map *map; + struct bpf_object *obj; + size_t ebpfSize =3D 0; + g_autofree void *ebpfRawData =3D NULL; + + ebpfRawData =3D g_base64_decode(ebpfObject, &ebpfSize); + if (ebpfRawData =3D=3D NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("can't decode the e= BPF from base64")); + return -1; + } + + obj =3D bpf_object__open_mem(ebpfRawData, ebpfSize, NULL); + err =3D libbpf_get_error(obj); + if (err) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("can't open eBPF ob= ject")); + return -1; + } + + + err =3D bpf_object__load(obj); + if (err) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("can't load eBPF ob= ject")); + return -1; + } + + bpf_object__for_each_program(prog, obj) { + fds[i] =3D bpf_program__fd(prog); + ++i; + if (i > nfds) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("to much file d= escriptors in eBPF")); + return -1; + } + } + + bpf_object__for_each_map(map, obj) { + fds[i] =3D bpf_map__fd(map); + ++i; + if (i > nfds) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("to much file d= escriptors in eBPF")); + return -1; + } + } + + *retLibbpfObj =3D obj; + + return i - 1; +} + + +void +qemuInterfaceCloseEbpf(void *libbpfObj) +{ + if (libbpfObj) + bpf_object__close(libbpfObj); +} +#else + +int +qemuInterfaceLoadEbpf(const char *ebpfObject G_GNUC_UNUSED, void **retLibb= pfObj G_GNUC_UNUSED, + int *fds G_GNUC_UNUSED, size_t nfds G_GNUC_UNUSED) +{ + return -1; +} + +void +qemuInterfaceCloseEbpf(void *libbpfObj G_GNUC_UNUSED) +{ +} + +#endif diff --git a/src/qemu/qemu_interface.h b/src/qemu/qemu_interface.h index aee5f9efb0..b6f39550cd 100644 --- a/src/qemu/qemu_interface.h +++ b/src/qemu/qemu_interface.h @@ -44,3 +44,7 @@ int qemuInterfaceOpenVhostNet(virDomainObj *def, =20 int qemuInterfacePrepareSlirp(virQEMUDriver *driver, virDomainNetDef *net); + +int qemuInterfaceLoadEbpf(const char *ebpfObject, void **retLibbpfObj, int= *fds, size_t nfds); + +void qemuInterfaceCloseEbpf(void *libbpfObj); --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat Nov 23 11:38:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1715545061095851.4353529110606; Sun, 12 May 2024 13:17:41 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 0A96A1B4E; Sun, 12 May 2024 16:17:40 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id AFE731AC3; Sun, 12 May 2024 16:13:06 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C38241A50; Sun, 12 May 2024 16:12:49 -0400 (EDT) Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 7B4EB1A50 for ; Sun, 12 May 2024 16:12:48 -0400 (EDT) Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-41ff5e3dc3bso15434075e9.1 for ; Sun, 12 May 2024 13:12:48 -0700 (PDT) Received: from localhost.localdomain ([162.213.65.233]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42014f563adsm22354735e9.38.2024.05.12.13.12.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 13:12:46 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715544767; x=1716149567; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HVuEFToeT/ylAzFxGoDbx3d+uCW9U2IVrzuDM+/4/8g=; b=OdzCNbAM9bztgqVEydxegb042qalV9EAMvhhf5ho91ebq3N7CiMd5s7JwaJnlfljjd m1RJIe0Ep0gNt60ZDDK/NvZuQIcsvLEWXO+i3koMlFnFGIq7dWb96OAF8K+FVwlEHjno ET4UkI/2o3rjCeGnm9lnpkyN5x1n9IUyHWgqbOYhoZrb/AAkaQR0+05WlhH9p+5dFWmN TDSJxu91xt7wEnNQ5uq3R0aVn9m+k1yW3zy/L+TuPuWtaXSgHLqp5edA0UvUONCvjKUS 1tQPv7i2Ch6Do7DzPSdcEGd+qJOOzmYMBZI+QOwCM/GRFzRn9BPjP0FLf9yzFh9bWTOa HCdQ== X-Gm-Message-State: AOJu0YySXuE1wl1vEoUDLqRusfvIjSje3LYQ/aHsHa8DRjVIdtWDiYhg aui0xtFsrcgXN3mZFocdnqVhdVA4+tuTWr2nYNvK1LSCEmZehu+xQOYtN551AIf6hVj2jNcG/Cj 6 X-Google-Smtp-Source: AGHT+IEDMrWWGrzm2Q+kQ+6oOHXt13YXYYnbmhX7+aG5a2PkStrVG2hs4k+8qXdkuzaWVX3/qKsiyQ== X-Received: by 2002:a05:600c:45cc:b0:41f:f592:2fa3 with SMTP id 5b1f17b1804b1-41ff5922fb3mr47461755e9.11.1715544767351; Sun, 12 May 2024 13:12:47 -0700 (PDT) From: Andrew Melnychenko To: devel@lists.libvirt.org Subject: [RFC PATCH v3 4/6] qemu_command: Added "ebpf_rss_fds" support for virtio-net. Date: Sun, 12 May 2024 22:45:46 +0300 Message-ID: <20240512194550.5023-5-andrew@daynix.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240512194550.5023-1-andrew@daynix.com> References: <20240512194550.5023-1-andrew@daynix.com> MIME-Version: 1.0 Message-ID-Hash: XBESCTI3B4NVTN4KZSZN77HVZCKNZDIC X-Message-ID-Hash: XBESCTI3B4NVTN4KZSZN77HVZCKNZDIC X-MailFrom: andrew@daynix.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: yuri.benditovich@daynix.com, yan@daynix.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1715545062184100001 Added new capability ebpf_rss_fds for QEMU. Added logic for loading the "RSS" eBPF program. eBPF file descriptors passed to the QEMU. Signed-off-by: Andrew Melnychenko --- src/qemu/qemu_capabilities.c | 4 +++ src/qemu/qemu_capabilities.h | 3 ++ src/qemu/qemu_command.c | 61 ++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.c | 4 +++ src/qemu/qemu_domain.h | 3 ++ 5 files changed, 75 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 09bb6ca36e..bb6a587725 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -708,6 +708,9 @@ VIR_ENUM_IMPL(virQEMUCaps, "usb-mtp", /* QEMU_CAPS_DEVICE_USB_MTP */ "machine.virt.ras", /* QEMU_CAPS_MACHINE_VIRT_RAS */ "virtio-sound", /* QEMU_CAPS_DEVICE_VIRTIO_SOUND */ + + /* 460 */ + "virtio-net.ebpf_rss_fds", /* QEMU_CAPS_VIRTIO_NET_EBPF_RSS_= FDS */ ); =20 =20 @@ -1452,6 +1455,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCaps= DevicePropsVirtioBlk[] =3D { static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioNet[= ] =3D { { "acpi-index", QEMU_CAPS_ACPI_INDEX, NULL }, { "rss", QEMU_CAPS_VIRTIO_NET_RSS, NULL }, + { "ebpf-rss-fds", QEMU_CAPS_VIRTIO_NET_EBPF_RSS_FDS, NULL }, }; =20 static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsPCIeRootPo= rt[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 371ea19bd0..e4bb137b21 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -688,6 +688,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_MACHINE_VIRT_RAS, /* -machine virt,ras=3D */ QEMU_CAPS_DEVICE_VIRTIO_SOUND, /* -device virtio-sound-* */ =20 + /* 460 */ + QEMU_CAPS_VIRTIO_NET_EBPF_RSS_FDS, /* virtio-net ebpf_rss_fds feature = */ + QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; =20 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9859ea67a4..77715cf6fe 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3805,6 +3805,25 @@ qemuBuildLegacyNicStr(virDomainNetDef *net) } =20 =20 +static virJSONValue * +qemuBuildEbpfRssArg(virDomainNetDef *net) +{ + qemuDomainNetworkPrivate *netpriv =3D QEMU_DOMAIN_NETWORK_PRIVATE(net); + g_autoptr(virJSONValue) props =3D NULL; + + GSList *n; + + if (netpriv->ebpfrssfds) + props =3D virJSONValueNewArray(); + + for (n =3D netpriv->ebpfrssfds; n; n =3D n->next) { + virJSONValueArrayAppendString(props, qemuFDPassDirectGetPath(n->da= ta)); + } + + return g_steal_pointer(&props); +} + + virJSONValue * qemuBuildNicDevProps(virDomainDef *def, virDomainNetDef *net, @@ -3813,6 +3832,7 @@ qemuBuildNicDevProps(virDomainDef *def, g_autoptr(virJSONValue) props =3D NULL; char macaddr[VIR_MAC_STRING_BUFLEN]; g_autofree char *netdev =3D g_strdup_printf("host%s", net->info.alias); + g_autoptr(virJSONValue) ebpffds =3D NULL; =20 if (virDomainNetIsVirtioModel(net)) { const char *tx =3D NULL; @@ -3863,6 +3883,8 @@ qemuBuildNicDevProps(virDomainDef *def, if (!(props =3D qemuBuildVirtioDevProps(VIR_DOMAIN_DEVICE_NET, net= , qemuCaps))) return NULL; =20 + ebpffds =3D qemuBuildEbpfRssArg(net); + if (virJSONValueObjectAdd(&props, "S:tx", tx, "T:ioeventfd", net->driver.virtio.ioeven= tfd, @@ -3887,6 +3909,7 @@ qemuBuildNicDevProps(virDomainDef *def, "T:hash", net->driver.virtio.rss_hash_re= port, "p:host_mtu", net->mtu, "T:failover", failover, + "A:ebpf-rss-fds", &ebpffds, NULL) < 0) return NULL; } else { @@ -4170,6 +4193,39 @@ qemuBuildWatchdogDevProps(const virDomainDef *def, } =20 =20 +static void +qemuOpenEbpfRssFds(virDomainNetDef *net, virQEMUCaps *qemuCaps) +{ + const char *ebpfRSSObject =3D NULL; + int fds[16]; + int nfds =3D 0; + size_t i =3D 0; + qemuDomainNetworkPrivate *netpriv =3D QEMU_DOMAIN_NETWORK_PRIVATE(net); + + netpriv->libbpfRSSObject =3D NULL; + netpriv->ebpfrssfds =3D NULL; + + /* Add ebpf values */ + if (net->driver.virtio.rss =3D=3D VIR_TRISTATE_SWITCH_ON + && net->driver.virtio.rss_hash_report !=3D VIR_TRISTATE_SWITCH_ON + && virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_EBPF_RSS_FDS)) { + ebpfRSSObject =3D virQEMUCapsGetEbpf(qemuCaps, "rss"); + nfds =3D qemuInterfaceLoadEbpf(ebpfRSSObject, &netpriv->libbpfRSSO= bject, fds, 16); + + if (nfds > 0) { + for (i =3D 0; i < nfds; ++i) { + g_autofree char *name =3D g_strdup_printf("ebpfrssfd-%s-%z= u", net->info.alias, i); + + netpriv->ebpfrssfds =3D + g_slist_prepend(netpriv->ebpfrssfds, qemuFDPassDirectN= ew(name, fds + i)); + } + } + + netpriv->ebpfrssfds =3D g_slist_reverse(netpriv->ebpfrssfds); + } +} + + static int qemuBuildWatchdogCommandLine(virCommand *cmd, const virDomainDef *def, @@ -8725,6 +8781,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver, g_autoptr(virJSONValue) hostnetprops =3D NULL; qemuDomainNetworkPrivate *netpriv =3D QEMU_DOMAIN_NETWORK_PRIVATE(net); GSList *n; + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); =20 if (qemuDomainValidateActualNetDef(net, qemuCaps) < 0) return -1; @@ -8860,6 +8917,10 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver, qemuFDPassDirectTransferCommand(netpriv->slirpfd, cmd); qemuFDPassTransferCommand(netpriv->vdpafd, cmd); =20 + qemuOpenEbpfRssFds(net, qemuCaps); + for (n =3D netpriv->ebpfrssfds; n; n =3D n->next) + qemuFDPassDirectTransferCommand(n->data, cmd); + if (!(hostnetprops =3D qemuBuildHostNetProps(vm, net))) goto cleanup; =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index bda62f2e5c..894a6af348 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -38,6 +38,7 @@ #include "qemu_checkpoint.h" #include "qemu_validate.h" #include "qemu_namespace.h" +#include "qemu_interface.h" #include "viralloc.h" #include "virlog.h" #include "virerror.h" @@ -1079,6 +1080,7 @@ qemuDomainNetworkPrivateClearFDs(qemuDomainNetworkPri= vate *priv) g_clear_pointer(&priv->vdpafd, qemuFDPassFree); g_slist_free_full(g_steal_pointer(&priv->vhostfds), (GDestroyNotify) q= emuFDPassDirectFree); g_slist_free_full(g_steal_pointer(&priv->tapfds), (GDestroyNotify) qem= uFDPassDirectFree); + g_slist_free_full(g_steal_pointer(&priv->ebpfrssfds), (GDestroyNotify)= qemuFDPassDirectFree); } =20 =20 @@ -1090,6 +1092,8 @@ qemuDomainNetworkPrivateDispose(void *obj G_GNUC_UNUS= ED) qemuSlirpFree(priv->slirp); =20 qemuDomainNetworkPrivateClearFDs(priv); + + qemuInterfaceCloseEbpf(priv->libbpfRSSObject); } =20 =20 diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index a3089ea449..d15789f9ac 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -434,6 +434,9 @@ struct _qemuDomainNetworkPrivate { GSList *tapfds; /* qemuFDPassDirect */ GSList *vhostfds; /* qemuFDPassDirect */ qemuFDPass *vdpafd; + + void *libbpfRSSObject; + GSList *ebpfrssfds; /* qemuFDPassDirect eBPF RSS fds from helper */ }; =20 =20 --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat Nov 23 11:38:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1715545119432538.0101007995569; Sun, 12 May 2024 13:18:39 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5E2F61A93; Sun, 12 May 2024 16:18:38 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 442CD1C0A; Sun, 12 May 2024 16:13:12 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 0E7D11A50; Sun, 12 May 2024 16:12:51 -0400 (EDT) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 8283C1A57 for ; Sun, 12 May 2024 16:12:49 -0400 (EDT) Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4200ee78e56so9543515e9.3 for ; Sun, 12 May 2024 13:12:49 -0700 (PDT) Received: from localhost.localdomain ([162.213.65.233]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42014f563adsm22354735e9.38.2024.05.12.13.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 13:12:47 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715544768; x=1716149568; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R2KnnX4g/OlsSxeqsIhCc4AMelcK5O5t/4mY9Jv1keM=; b=rmgmTZbdRxSgmpP/N827OlyFsoUQwHryVCG5NxkYUj70RjX32VLkkbeQmv+Wl4nvqF JqMaiYQcrGcKo4n/BBVq4dZ2rSorIJq2frr+o2pc/eCS9x9C2+HcZP4Dw/GFZXTi6oqf Asqwg+yZhk/lHmeyv/epMPSwJQXQ+ugPAnbjFWCmTVEm4U52pqXV8fKlc5tSGhahwJl/ 0dqqRursRiSF7aQisSagFEUM9gsHJSn4n5NANy01bmd+eE12Dr/Z9DsKxYOXNjJRz93Q 8yiheB6W+RMDN4R3sntyjBEsmzEE+hNjpkOtvyDX5v+eNDArT4svdvT0gvutO7Tg3VpH eNeg== X-Gm-Message-State: AOJu0YwlnPPASmpJSZMYSxUNiTWcmunzRDHJiGzrR4tK3b+bXvWQ1J4G SUj30oKQ4SornMyV5DHYlcn1s3rpzc/BHSR2eSgkFPStUdj7sxFtYaJWUFadErZOfMzzpLmjIy3 d X-Google-Smtp-Source: AGHT+IGUiDz8cYm35R24rtsceBsX/Cu6TOJQ3x1LJ7OYkVqY3T5QdmpQQlfjoJ1AyJ9kfVEa9wHeJg== X-Received: by 2002:a05:600c:450e:b0:41b:d8ef:8dcd with SMTP id 5b1f17b1804b1-41feac59ea0mr60348485e9.28.1715544768020; Sun, 12 May 2024 13:12:48 -0700 (PDT) From: Andrew Melnychenko To: devel@lists.libvirt.org Subject: [RFC PATCH v3 5/6] qemu_conf: Added configuration to optionally disable eBPF loading. Date: Sun, 12 May 2024 22:45:47 +0300 Message-ID: <20240512194550.5023-6-andrew@daynix.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240512194550.5023-1-andrew@daynix.com> References: <20240512194550.5023-1-andrew@daynix.com> MIME-Version: 1.0 Message-ID-Hash: HCYPIQ5WMSPGKTKKAKZI6PZJXN6LN2L5 X-Message-ID-Hash: HCYPIQ5WMSPGKTKKAKZI6PZJXN6LN2L5 X-MailFrom: andrew@daynix.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: yuri.benditovich@daynix.com, yan@daynix.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1715545120355100001 Currently, there is no way to control that config through qemu.conf file. This optional is required for future eBPF tests. Signed-off-by: Andrew Melnychenko --- src/qemu/qemu_command.c | 8 +++++--- src/qemu/qemu_conf.c | 2 ++ src/qemu/qemu_conf.h | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 77715cf6fe..0d41d34c3b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8917,9 +8917,11 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver, qemuFDPassDirectTransferCommand(netpriv->slirpfd, cmd); qemuFDPassTransferCommand(netpriv->vdpafd, cmd); =20 - qemuOpenEbpfRssFds(net, qemuCaps); - for (n =3D netpriv->ebpfrssfds; n; n =3D n->next) - qemuFDPassDirectTransferCommand(n->data, cmd); + if (cfg->allowEBPF) { + qemuOpenEbpfRssFds(net, qemuCaps); + for (n =3D netpriv->ebpfrssfds; n; n =3D n->next) + qemuFDPassDirectTransferCommand(n->data, cmd); + } =20 if (!(hostnetprops =3D qemuBuildHostNetProps(vm, net))) goto cleanup; diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 4050a82341..79168c3e54 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -287,6 +287,8 @@ virQEMUDriverConfig *virQEMUDriverConfigNew(bool privil= eged, cfg->deprecationBehavior =3D g_strdup("none"); cfg->storageUseNbdkit =3D USE_NBDKIT_DEFAULT; =20 + cfg->allowEBPF =3D true; + return g_steal_pointer(&cfg); } =20 diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 36049b4bfa..778897bd40 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -233,6 +233,8 @@ struct _virQEMUDriverConfig { bool storageUseNbdkit; =20 virQEMUSchedCore schedCore; + + bool allowEBPF; }; =20 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virQEMUDriverConfig, virObjectUnref); --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Sat Nov 23 11:38:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1715545218903141.1190653684165; Sun, 12 May 2024 13:20:18 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B1DF41A79; Sun, 12 May 2024 16:20:17 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 91C171AAA; Sun, 12 May 2024 16:13:16 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 884861ADA; Sun, 12 May 2024 16:12:54 -0400 (EDT) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id A5A371A65 for ; Sun, 12 May 2024 16:12:50 -0400 (EDT) Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-420180b5838so186705e9.2 for ; Sun, 12 May 2024 13:12:50 -0700 (PDT) Received: from localhost.localdomain ([162.213.65.233]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42014f563adsm22354735e9.38.2024.05.12.13.12.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 13:12:48 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715544769; x=1716149569; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t0mzVi3/90eiOszUJ0IJasrjpPbuxlOwcZPNy7eeX9E=; b=mf1uAdch8YaFxhmGRyZa8ljTMS2Y5XBrpiY+MSzcDYuUNGeEF+7mb4eKjEx51OFFob v0lfRhbkR8o3JtaUrrRiSl4NpaYp/NzLfj19bmo81DxEQsumgrK984ROK2YU621+zrTJ j60sFDYlyN63CwMxrH3FGzJsByXuydbFGDGJDUrW81s8la8q7Fcw9bWMJ3rcanZJW7C7 HqBvJ4lauwVng7RkU9cyi2xQvWTHExr4Oj7Q2LrMQMLvL45uvPdbKSEq1UfLxO3cxbsw Hu26LIku00v/T1BZcICcZQv1vY+msvA5s2LEKA6lnBruw5LB8+RPnWYHMqX4qR7TTkFa 7oHg== X-Gm-Message-State: AOJu0Yxt4Ko1ZyCI9Y6K/4yJE2Pski8+basTXSOExOcYHCocsPe8gmS0 CLMS+lps1lQveft1mfwxnYRsR/7CyXAQKLFaTxtnDOc/mHIcxvXR4vSCcv583tEmGMb3NwVZ3wR t X-Google-Smtp-Source: AGHT+IFqMIYlYh9o1d4yjEOF/6bAl9eFYdUpVPQQKomxZ1iCQYKEiXJOq5DWKacuwvuBtyPeMRxNaQ== X-Received: by 2002:a05:600c:46d5:b0:41c:290e:7e6e with SMTP id 5b1f17b1804b1-41fead64407mr80426275e9.35.1715544768976; Sun, 12 May 2024 13:12:48 -0700 (PDT) From: Andrew Melnychenko To: devel@lists.libvirt.org Subject: [RFC PATCH v3 6/6] tests: Added tests for eBPF blob loading. Date: Sun, 12 May 2024 22:45:48 +0300 Message-ID: <20240512194550.5023-7-andrew@daynix.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240512194550.5023-1-andrew@daynix.com> References: <20240512194550.5023-1-andrew@daynix.com> MIME-Version: 1.0 Message-ID-Hash: TRVUYRMUZKKIT5RF6PAHFPWYAKDMUNWZ X-Message-ID-Hash: TRVUYRMUZKKIT5RF6PAHFPWYAKDMUNWZ X-MailFrom: andrew@daynix.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: yuri.benditovich@daynix.com, yan@daynix.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1715545220757100001 Added net-virtio-rss-bpf to qemuxmlconf's test. Synthetically modified caps-9.0.0 with a reply. Added mock functions for loading eBPF. Signed-off-by: Andrew Melnychenko --- .../caps_9.0.0_x86_64.replies | 199 ++++++++++-------- .../caps_9.0.0_x86_64.xml | 4 + tests/qemuxml2argvmock.c | 21 ++ .../net-virtio-rss-bpf.x86_64-latest.args | 37 ++++ .../net-virtio-rss-bpf.x86_64-latest.xml | 46 ++++ tests/qemuxmlconfdata/net-virtio-rss-bpf.xml | 46 ++++ tests/qemuxmlconftest.c | 4 + 7 files changed, 265 insertions(+), 92 deletions(-) create mode 100644 tests/qemuxmlconfdata/net-virtio-rss-bpf.x86_64-latest.= args create mode 100644 tests/qemuxmlconfdata/net-virtio-rss-bpf.x86_64-latest.= xml create mode 100644 tests/qemuxmlconfdata/net-virtio-rss-bpf.xml diff --git a/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.replies b/tests/q= emucapabilitiesdata/caps_9.0.0_x86_64.replies index 5d36853ce3..b94625904b 100644 --- a/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.replies +++ b/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.replies @@ -23654,21 +23654,36 @@ } =20 { - "execute": "query-kvm", + "execute": "request-ebpf", + "arguments": { + "id": "rss" + }, + "id": "libvirt-5" +} + +{ + "return": { + "object": "Test data" + }, "id": "libvirt-5" } =20 +{ + "execute": "query-kvm", + "id": "libvirt-6" +} + { "return": { "enabled": true, "present": true }, - "id": "libvirt-5" + "id": "libvirt-6" } =20 { "execute": "qom-list-types", - "id": "libvirt-6" + "id": "libvirt-7" } =20 { @@ -26378,7 +26393,7 @@ "parent": "x86_64-cpu" } ], - "id": "libvirt-6" + "id": "libvirt-7" } =20 { @@ -26386,7 +26401,7 @@ "arguments": { "typename": "virtio-blk-pci" }, - "id": "libvirt-7" + "id": "libvirt-8" } =20 { @@ -26801,7 +26816,7 @@ "type": "bool" } ], - "id": "libvirt-7" + "id": "libvirt-8" } =20 { @@ -26809,7 +26824,7 @@ "arguments": { "typename": "virtio-net-pci" }, - "id": "libvirt-8" + "id": "libvirt-9" } =20 { @@ -27268,7 +27283,7 @@ "type": "bool" } ], - "id": "libvirt-8" + "id": "libvirt-9" } =20 { @@ -27276,7 +27291,7 @@ "arguments": { "typename": "virtio-scsi-pci" }, - "id": "libvirt-9" + "id": "libvirt-10" } =20 { @@ -27542,7 +27557,7 @@ "type": "child" } ], - "id": "libvirt-9" + "id": "libvirt-10" } =20 { @@ -27550,11 +27565,11 @@ "arguments": { "typename": "virtio-net-ccw" }, - "id": "libvirt-10" + "id": "libvirt-11" } =20 { - "id": "libvirt-10", + "id": "libvirt-11", "error": { "class": "DeviceNotFound", "desc": "Device 'virtio-net-ccw' not found" @@ -27566,11 +27581,11 @@ "arguments": { "typename": "virtio-scsi-ccw" }, - "id": "libvirt-11" + "id": "libvirt-12" } =20 { - "id": "libvirt-11", + "id": "libvirt-12", "error": { "class": "DeviceNotFound", "desc": "Device 'virtio-scsi-ccw' not found" @@ -27582,7 +27597,7 @@ "arguments": { "typename": "vfio-pci" }, - "id": "libvirt-12" + "id": "libvirt-13" } =20 { @@ -27800,7 +27815,7 @@ "type": "int32" } ], - "id": "libvirt-12" + "id": "libvirt-13" } =20 { @@ -27808,7 +27823,7 @@ "arguments": { "typename": "scsi-hd" }, - "id": "libvirt-13" + "id": "libvirt-14" } =20 { @@ -28009,7 +28024,7 @@ "type": "int32" } ], - "id": "libvirt-13" + "id": "libvirt-14" } =20 { @@ -28017,7 +28032,7 @@ "arguments": { "typename": "ide-hd" }, - "id": "libvirt-14" + "id": "libvirt-15" } =20 { @@ -28168,7 +28183,7 @@ "type": "int32" } ], - "id": "libvirt-14" + "id": "libvirt-15" } =20 { @@ -28176,7 +28191,7 @@ "arguments": { "typename": "PIIX4_PM" }, - "id": "libvirt-15" + "id": "libvirt-16" } =20 { @@ -28299,7 +28314,7 @@ "type": "link" } ], - "id": "libvirt-15" + "id": "libvirt-16" } =20 { @@ -28307,7 +28322,7 @@ "arguments": { "typename": "usb-redir" }, - "id": "libvirt-16" + "id": "libvirt-17" } =20 { @@ -28363,7 +28378,7 @@ "type": "bool" } ], - "id": "libvirt-16" + "id": "libvirt-17" } =20 { @@ -28371,7 +28386,7 @@ "arguments": { "typename": "usb-storage" }, - "id": "libvirt-17" + "id": "libvirt-18" } =20 { @@ -28486,7 +28501,7 @@ "type": "bool" } ], - "id": "libvirt-17" + "id": "libvirt-18" } =20 { @@ -28494,7 +28509,7 @@ "arguments": { "typename": "kvm-pit" }, - "id": "libvirt-18" + "id": "libvirt-19" } =20 { @@ -28510,7 +28525,7 @@ "type": "LostTickPolicy" } ], - "id": "libvirt-18" + "id": "libvirt-19" } =20 { @@ -28518,7 +28533,7 @@ "arguments": { "typename": "VGA" }, - "id": "libvirt-19" + "id": "libvirt-20" } =20 { @@ -28640,7 +28655,7 @@ "type": "uint32" } ], - "id": "libvirt-19" + "id": "libvirt-20" } =20 { @@ -28648,7 +28663,7 @@ "arguments": { "typename": "vmware-svga" }, - "id": "libvirt-20" + "id": "libvirt-21" } =20 { @@ -28723,7 +28738,7 @@ "type": "uint32" } ], - "id": "libvirt-20" + "id": "libvirt-21" } =20 { @@ -28731,7 +28746,7 @@ "arguments": { "typename": "qxl" }, - "id": "libvirt-21" + "id": "libvirt-22" } =20 { @@ -28871,7 +28886,7 @@ "type": "int32" } ], - "id": "libvirt-21" + "id": "libvirt-22" } =20 { @@ -28879,7 +28894,7 @@ "arguments": { "typename": "virtio-gpu-pci" }, - "id": "libvirt-22" + "id": "libvirt-23" } =20 { @@ -29141,7 +29156,7 @@ "type": "child" } ], - "id": "libvirt-22" + "id": "libvirt-23" } =20 { @@ -29149,7 +29164,7 @@ "arguments": { "typename": "virtio-gpu-device" }, - "id": "libvirt-23" + "id": "libvirt-24" } =20 { @@ -29249,7 +29264,7 @@ "type": "size" } ], - "id": "libvirt-23" + "id": "libvirt-24" } =20 { @@ -29257,7 +29272,7 @@ "arguments": { "typename": "ICH9-LPC" }, - "id": "libvirt-24" + "id": "libvirt-25" } =20 { @@ -29515,7 +29530,7 @@ "type": "link" } ], - "id": "libvirt-24" + "id": "libvirt-25" } =20 { @@ -29523,7 +29538,7 @@ "arguments": { "typename": "virtio-balloon-pci" }, - "id": "libvirt-25" + "id": "libvirt-26" } =20 { @@ -29778,7 +29793,7 @@ "type": "child" } ], - "id": "libvirt-25" + "id": "libvirt-26" } =20 { @@ -29786,11 +29801,11 @@ "arguments": { "typename": "virtio-balloon-ccw" }, - "id": "libvirt-26" + "id": "libvirt-27" } =20 { - "id": "libvirt-26", + "id": "libvirt-27", "error": { "class": "DeviceNotFound", "desc": "Device 'virtio-balloon-ccw' not found" @@ -29802,7 +29817,7 @@ "arguments": { "typename": "virtio-balloon-device" }, - "id": "libvirt-27" + "id": "libvirt-28" } =20 { @@ -29906,7 +29921,7 @@ "type": "guest statistics" } ], - "id": "libvirt-27" + "id": "libvirt-28" } =20 { @@ -29914,7 +29929,7 @@ "arguments": { "typename": "intel-iommu" }, - "id": "libvirt-28" + "id": "libvirt-29" } =20 { @@ -29987,7 +30002,7 @@ "type": "bool" } ], - "id": "libvirt-28" + "id": "libvirt-29" } =20 { @@ -29995,7 +30010,7 @@ "arguments": { "typename": "mch" }, - "id": "libvirt-29" + "id": "libvirt-30" } =20 { @@ -30070,7 +30085,7 @@ "type": "uint16" } ], - "id": "libvirt-29" + "id": "libvirt-30" } =20 { @@ -30078,7 +30093,7 @@ "arguments": { "typename": "nvdimm" }, - "id": "libvirt-30" + "id": "libvirt-31" } =20 { @@ -30120,7 +30135,7 @@ "type": "uint64" } ], - "id": "libvirt-30" + "id": "libvirt-31" } =20 { @@ -30128,7 +30143,7 @@ "arguments": { "typename": "pcie-root-port" }, - "id": "libvirt-31" + "id": "libvirt-32" } =20 { @@ -30281,7 +30296,7 @@ "type": "size" } ], - "id": "libvirt-31" + "id": "libvirt-32" } =20 { @@ -30289,7 +30304,7 @@ "arguments": { "typename": "usb-host" }, - "id": "libvirt-32" + "id": "libvirt-33" } =20 { @@ -30385,7 +30400,7 @@ "type": "bool" } ], - "id": "libvirt-32" + "id": "libvirt-33" } =20 { @@ -30393,7 +30408,7 @@ "arguments": { "typename": "vhost-user-fs-device" }, - "id": "libvirt-33" + "id": "libvirt-34" } =20 { @@ -30479,7 +30494,7 @@ "type": "int32" } ], - "id": "libvirt-33" + "id": "libvirt-34" } =20 { @@ -30487,7 +30502,7 @@ "arguments": { "typename": "virtio-mem-pci" }, - "id": "libvirt-34" + "id": "libvirt-35" } =20 { @@ -30748,7 +30763,7 @@ "type": "child" } ], - "id": "libvirt-34" + "id": "libvirt-35" } =20 { @@ -30756,7 +30771,7 @@ "arguments": { "typename": "virtio-iommu-pci" }, - "id": "libvirt-35" + "id": "libvirt-36" } =20 { @@ -31000,7 +31015,7 @@ "type": "child" } ], - "id": "libvirt-35" + "id": "libvirt-36" } =20 { @@ -31008,7 +31023,7 @@ "arguments": { "typename": "memory-backend-file" }, - "id": "libvirt-36" + "id": "libvirt-37" } =20 { @@ -31102,7 +31117,7 @@ "type": "bool" } ], - "id": "libvirt-36" + "id": "libvirt-37" } =20 { @@ -31110,7 +31125,7 @@ "arguments": { "typename": "memory-backend-memfd" }, - "id": "libvirt-37" + "id": "libvirt-38" } =20 { @@ -31189,7 +31204,7 @@ "type": "int" } ], - "id": "libvirt-37" + "id": "libvirt-38" } =20 { @@ -31197,7 +31212,7 @@ "arguments": { "typename": "max-x86_64-cpu" }, - "id": "libvirt-38" + "id": "libvirt-39" } =20 { @@ -33114,12 +33129,12 @@ "type": "bool" } ], - "id": "libvirt-38" + "id": "libvirt-39" } =20 { "execute": "query-machines", - "id": "libvirt-39" + "id": "libvirt-40" } =20 { @@ -33755,7 +33770,7 @@ "default-ram-id": "pc.ram" } ], - "id": "libvirt-39" + "id": "libvirt-40" } =20 { @@ -33763,7 +33778,7 @@ "arguments": { "typename": "none-machine" }, - "id": "libvirt-40" + "id": "libvirt-41" } =20 { @@ -33876,12 +33891,12 @@ "type": "child" } ], - "id": "libvirt-40" + "id": "libvirt-41" } =20 { "execute": "query-cpu-definitions", - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -36263,12 +36278,12 @@ "deprecated": false } ], - "id": "libvirt-41" + "id": "libvirt-42" } =20 { "execute": "query-tpm-models", - "id": "libvirt-42" + "id": "libvirt-43" } =20 { @@ -36276,12 +36291,12 @@ "tpm-crb", "tpm-tis" ], - "id": "libvirt-42" + "id": "libvirt-43" } =20 { "execute": "query-tpm-types", - "id": "libvirt-43" + "id": "libvirt-44" } =20 { @@ -36289,12 +36304,12 @@ "passthrough", "emulator" ], - "id": "libvirt-43" + "id": "libvirt-44" } =20 { "execute": "query-command-line-options", - "id": "libvirt-44" + "id": "libvirt-45" } =20 { @@ -37769,12 +37784,12 @@ "option": "drive" } ], - "id": "libvirt-44" + "id": "libvirt-45" } =20 { "execute": "query-migrate-capabilities", - "id": "libvirt-45" + "id": "libvirt-46" } =20 { @@ -37876,16 +37891,16 @@ "capability": "mapped-ram" } ], - "id": "libvirt-45" + "id": "libvirt-46" } =20 { "execute": "query-sev-capabilities", - "id": "libvirt-46" + "id": "libvirt-47" } =20 { - "id": "libvirt-46", + "id": "libvirt-47", "error": { "class": "GenericError", "desc": "SEV: Failed to open /dev/sev: No such file or directory" @@ -37894,11 +37909,11 @@ =20 { "execute": "query-sgx-capabilities", - "id": "libvirt-47" + "id": "libvirt-48" } =20 { - "id": "libvirt-47", + "id": "libvirt-48", "error": { "class": "GenericError", "desc": "SGX is not enabled in KVM" @@ -37913,7 +37928,7 @@ "name": "host" } }, - "id": "libvirt-48" + "id": "libvirt-49" } =20 { @@ -38281,7 +38296,7 @@ } } }, - "id": "libvirt-48" + "id": "libvirt-49" } =20 { @@ -38295,7 +38310,7 @@ } } }, - "id": "libvirt-49" + "id": "libvirt-50" } =20 { @@ -38663,7 +38678,7 @@ } } }, - "id": "libvirt-49" + "id": "libvirt-50" } =20 { @@ -38678,7 +38693,7 @@ } } }, - "id": "libvirt-50" + "id": "libvirt-51" } =20 { @@ -39152,7 +39167,7 @@ } } }, - "id": "libvirt-50" + "id": "libvirt-51" } =20 { diff --git a/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_9.0.0_x86_64.xml index 204d243247..eafe2c30f8 100644 --- a/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml @@ -205,6 +205,7 @@ + 9000000 43100245 v9.0.0 @@ -3691,4 +3692,7 @@ + + + diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c index 9cc97199c4..0d1ebbe5b9 100644 --- a/tests/qemuxml2argvmock.c +++ b/tests/qemuxml2argvmock.c @@ -292,3 +292,24 @@ virNetDevSetMTU(const char *ifname G_GNUC_UNUSED, { return 0; } + +int +qemuInterfaceLoadEbpf(__attribute__((unused)) const char *ebpfObject, + __attribute__((unused)) void **retLibbpfObj, int *fds, size_t nfds) +{ + if (nfds >=3D 4) { + fds[0] =3D 0x100; + fds[1] =3D 0x101; + fds[2] =3D 0x102; + fds[3] =3D 0x103; + return 4; + } else { + return -1; + } +} + +void +qemuInterfaceCloseEbpf(__attribute__((unused)) void *libbpfObj) +{ + return; +} diff --git a/tests/qemuxmlconfdata/net-virtio-rss-bpf.x86_64-latest.args b/= tests/qemuxmlconfdata/net-virtio-rss-bpf.x86_64-latest.args new file mode 100644 index 0000000000..b9497e5a73 --- /dev/null +++ b/tests/qemuxmlconfdata/net-virtio-rss-bpf.x86_64-latest.args @@ -0,0 +1,37 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/va= r/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram,acpi= =3Doff \ +-accel tcg \ +-cpu qemu64 \ +-m size=3D219136k \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'= \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","no= de-name":"libvirt-1-storage","read-only":false}' \ +-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-stor= age","id":"ide0-0-0","bootindex":1}' \ +-netdev '{"type":"user","id":"hostnet0"}' \ +-device '{"driver":"virtio-net-pci","rss":true,"ebpf-rss-fds":["256","257"= ,"258","259"],"netdev":"hostnet0","id":"net0","mac":"00:11:22:33:44:55","bu= s":"pci.0","addr":"0x2"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","add= r":"0x5"}' \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxmlconfdata/net-virtio-rss-bpf.x86_64-latest.xml b/t= ests/qemuxmlconfdata/net-virtio-rss-bpf.x86_64-latest.xml new file mode 100644 index 0000000000..198540380c --- /dev/null +++ b/tests/qemuxmlconfdata/net-virtio-rss-bpf.x86_64-latest.xml @@ -0,0 +1,46 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + qemu64 + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + +
+ + + +
+ + + + + +
+ + + +