* [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs
@ 2024-09-05 18:13 Daniel P. Berrangé
2024-09-05 18:13 ` [PATCH v2 1/7] hw/net: fix typo s/epbf/ebpf/ in virtio-net Daniel P. Berrangé
` (7 more replies)
0 siblings, 8 replies; 17+ messages in thread
From: Daniel P. Berrangé @ 2024-09-05 18:13 UTC (permalink / raw)
To: qemu-devel
Cc: Jason Wang, Yuri Benditovich, Michael S. Tsirkin,
Andrew Melnychenko, Daniel P. Berrangé
The virtio-net code for eBPF RSS is still ignoring errors when
failing to load the eBPF RSS program passed in by the mgmt app
via pre-opened FDs.
This series re-factors the eBPF common code so that it actually
reports using "Error" objects. Then it makes virtio-net treat
a failure to load pre-opened FDs as a fatal problem. When doing
speculative opening of eBPF FDs, QEMU merely prints a warning,
and allows the software fallback to continue.
Trace event coverage is significantly expanded to make this all
much more debuggable too.
Changed in v2:
- Split 'ebpf_error' probe into multiple probes
Daniel P. Berrangé (7):
hw/net: fix typo s/epbf/ebpf/ in virtio-net
ebpf: drop redundant parameter checks in static methods
ebpf: improve error trace events
ebpf: add formal error reporting to all APIs
hw/net: report errors from failing to use eBPF RSS FDs
ebpf: improve trace event coverage to all key operations
hw/net: improve tracing of eBPF RSS setup
ebpf/ebpf_rss.c | 118 ++++++++++++++++++++++++++++----------------
ebpf/ebpf_rss.h | 10 ++--
ebpf/trace-events | 8 ++-
hw/net/trace-events | 8 +--
hw/net/virtio-net.c | 63 +++++++++++++++--------
5 files changed, 137 insertions(+), 70 deletions(-)
--
2.45.2
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 1/7] hw/net: fix typo s/epbf/ebpf/ in virtio-net
2024-09-05 18:13 [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs Daniel P. Berrangé
@ 2024-09-05 18:13 ` Daniel P. Berrangé
2024-09-05 18:13 ` [PATCH v2 2/7] ebpf: drop redundant parameter checks in static methods Daniel P. Berrangé
` (6 subsequent siblings)
7 siblings, 0 replies; 17+ messages in thread
From: Daniel P. Berrangé @ 2024-09-05 18:13 UTC (permalink / raw)
To: qemu-devel
Cc: Jason Wang, Yuri Benditovich, Michael S. Tsirkin,
Andrew Melnychenko, Daniel P. Berrangé,
Philippe Mathieu-Daudé
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
hw/net/virtio-net.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index ed33a32877..055fce1d78 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1254,7 +1254,7 @@ static void rss_data_to_rss_config(struct VirtioNetRssData *data,
config->default_queue = data->default_queue;
}
-static bool virtio_net_attach_epbf_rss(VirtIONet *n)
+static bool virtio_net_attach_ebpf_rss(VirtIONet *n)
{
struct EBPFRSSConfig config = {};
@@ -1276,7 +1276,7 @@ static bool virtio_net_attach_epbf_rss(VirtIONet *n)
return true;
}
-static void virtio_net_detach_epbf_rss(VirtIONet *n)
+static void virtio_net_detach_ebpf_rss(VirtIONet *n)
{
virtio_net_attach_ebpf_to_backend(n->nic, -1);
}
@@ -1286,8 +1286,8 @@ static void virtio_net_commit_rss_config(VirtIONet *n)
if (n->rss_data.enabled) {
n->rss_data.enabled_software_rss = n->rss_data.populate_hash;
if (n->rss_data.populate_hash) {
- virtio_net_detach_epbf_rss(n);
- } else if (!virtio_net_attach_epbf_rss(n)) {
+ virtio_net_detach_ebpf_rss(n);
+ } else if (!virtio_net_attach_ebpf_rss(n)) {
if (get_vhost_net(qemu_get_queue(n->nic)->peer)) {
warn_report("Can't load eBPF RSS for vhost");
} else {
@@ -1300,7 +1300,7 @@ static void virtio_net_commit_rss_config(VirtIONet *n)
n->rss_data.indirections_len,
sizeof(n->rss_data.key));
} else {
- virtio_net_detach_epbf_rss(n);
+ virtio_net_detach_ebpf_rss(n);
trace_virtio_net_rss_disable();
}
}
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2 2/7] ebpf: drop redundant parameter checks in static methods
2024-09-05 18:13 [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs Daniel P. Berrangé
2024-09-05 18:13 ` [PATCH v2 1/7] hw/net: fix typo s/epbf/ebpf/ in virtio-net Daniel P. Berrangé
@ 2024-09-05 18:13 ` Daniel P. Berrangé
2024-09-05 18:13 ` [PATCH v2 3/7] ebpf: improve error trace events Daniel P. Berrangé
` (5 subsequent siblings)
7 siblings, 0 replies; 17+ messages in thread
From: Daniel P. Berrangé @ 2024-09-05 18:13 UTC (permalink / raw)
To: qemu-devel
Cc: Jason Wang, Yuri Benditovich, Michael S. Tsirkin,
Andrew Melnychenko, Daniel P. Berrangé
Various static methods have checks on their parameters which were
already checked immediately before the method was invoked. Drop
these redundat checks to simplify the following commit which adds
formal error reporting.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
| 32 +++++---------------------------
1 file changed, 5 insertions(+), 27 deletions(-)
--git a/ebpf/ebpf_rss.c b/ebpf/ebpf_rss.c
index 87f0714910..aa7170d997 100644
--- a/ebpf/ebpf_rss.c
+++ b/ebpf/ebpf_rss.c
@@ -49,10 +49,6 @@ bool ebpf_rss_is_loaded(struct EBPFRSSContext *ctx)
static bool ebpf_rss_mmap(struct EBPFRSSContext *ctx)
{
- if (!ebpf_rss_is_loaded(ctx)) {
- return false;
- }
-
ctx->mmap_configuration = mmap(NULL, qemu_real_host_page_size(),
PROT_READ | PROT_WRITE, MAP_SHARED,
ctx->map_configuration, 0);
@@ -90,10 +86,6 @@ toeplitz_fail:
static void ebpf_rss_munmap(struct EBPFRSSContext *ctx)
{
- if (!ebpf_rss_is_loaded(ctx)) {
- return;
- }
-
munmap(ctx->mmap_indirections_table, qemu_real_host_page_size());
munmap(ctx->mmap_toeplitz_key, qemu_real_host_page_size());
munmap(ctx->mmap_configuration, qemu_real_host_page_size());
@@ -177,15 +169,10 @@ bool ebpf_rss_load_fds(struct EBPFRSSContext *ctx, int program_fd,
return true;
}
-static bool ebpf_rss_set_config(struct EBPFRSSContext *ctx,
+static void ebpf_rss_set_config(struct EBPFRSSContext *ctx,
struct EBPFRSSConfig *config)
{
- if (!ebpf_rss_is_loaded(ctx)) {
- return false;
- }
-
memcpy(ctx->mmap_configuration, config, sizeof(*config));
- return true;
}
static bool ebpf_rss_set_indirections_table(struct EBPFRSSContext *ctx,
@@ -194,8 +181,7 @@ static bool ebpf_rss_set_indirections_table(struct EBPFRSSContext *ctx,
{
char *cursor = ctx->mmap_indirections_table;
- if (!ebpf_rss_is_loaded(ctx) || indirections_table == NULL ||
- len > VIRTIO_NET_RSS_MAX_TABLE_LEN) {
+ if (len > VIRTIO_NET_RSS_MAX_TABLE_LEN) {
return false;
}
@@ -207,20 +193,16 @@ static bool ebpf_rss_set_indirections_table(struct EBPFRSSContext *ctx,
return true;
}
-static bool ebpf_rss_set_toepliz_key(struct EBPFRSSContext *ctx,
+static void ebpf_rss_set_toepliz_key(struct EBPFRSSContext *ctx,
uint8_t *toeplitz_key)
{
/* prepare toeplitz key */
uint8_t toe[VIRTIO_NET_RSS_MAX_KEY_SIZE] = {};
- if (!ebpf_rss_is_loaded(ctx) || toeplitz_key == NULL) {
- return false;
- }
memcpy(toe, toeplitz_key, VIRTIO_NET_RSS_MAX_KEY_SIZE);
*(uint32_t *)toe = ntohl(*(uint32_t *)toe);
memcpy(ctx->mmap_toeplitz_key, toe, VIRTIO_NET_RSS_MAX_KEY_SIZE);
- return true;
}
bool ebpf_rss_set_all(struct EBPFRSSContext *ctx, struct EBPFRSSConfig *config,
@@ -231,18 +213,14 @@ bool ebpf_rss_set_all(struct EBPFRSSContext *ctx, struct EBPFRSSConfig *config,
return false;
}
- if (!ebpf_rss_set_config(ctx, config)) {
- return false;
- }
+ ebpf_rss_set_config(ctx, config);
if (!ebpf_rss_set_indirections_table(ctx, indirections_table,
config->indirections_len)) {
return false;
}
- if (!ebpf_rss_set_toepliz_key(ctx, toeplitz_key)) {
- return false;
- }
+ ebpf_rss_set_toepliz_key(ctx, toeplitz_key);
return true;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2 3/7] ebpf: improve error trace events
2024-09-05 18:13 [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs Daniel P. Berrangé
2024-09-05 18:13 ` [PATCH v2 1/7] hw/net: fix typo s/epbf/ebpf/ in virtio-net Daniel P. Berrangé
2024-09-05 18:13 ` [PATCH v2 2/7] ebpf: drop redundant parameter checks in static methods Daniel P. Berrangé
@ 2024-09-05 18:13 ` Daniel P. Berrangé
2024-09-05 18:13 ` [PATCH v2 4/7] ebpf: add formal error reporting to all APIs Daniel P. Berrangé
` (4 subsequent siblings)
7 siblings, 0 replies; 17+ messages in thread
From: Daniel P. Berrangé @ 2024-09-05 18:13 UTC (permalink / raw)
To: qemu-devel
Cc: Jason Wang, Yuri Benditovich, Michael S. Tsirkin,
Andrew Melnychenko, Daniel P. Berrangé
A design pattern of
trace_foo_error("descriptive string")
is undesirable because it does not allow for filtering trace events
based on the error scenario. Split eBPF error trace event into three
separate events to address this filtering need.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
| 10 +++++-----
ebpf/trace-events | 4 +++-
2 files changed, 8 insertions(+), 6 deletions(-)
--git a/ebpf/ebpf_rss.c b/ebpf/ebpf_rss.c
index aa7170d997..47186807ad 100644
--- a/ebpf/ebpf_rss.c
+++ b/ebpf/ebpf_rss.c
@@ -53,21 +53,21 @@ static bool ebpf_rss_mmap(struct EBPFRSSContext *ctx)
PROT_READ | PROT_WRITE, MAP_SHARED,
ctx->map_configuration, 0);
if (ctx->mmap_configuration == MAP_FAILED) {
- trace_ebpf_error("eBPF RSS", "can not mmap eBPF configuration array");
+ trace_ebpf_rss_mmap_error(ctx, "configuration");
return false;
}
ctx->mmap_toeplitz_key = mmap(NULL, qemu_real_host_page_size(),
PROT_READ | PROT_WRITE, MAP_SHARED,
ctx->map_toeplitz_key, 0);
if (ctx->mmap_toeplitz_key == MAP_FAILED) {
- trace_ebpf_error("eBPF RSS", "can not mmap eBPF toeplitz key");
+ trace_ebpf_rss_mmap_error(ctx, "toeplitz key");
goto toeplitz_fail;
}
ctx->mmap_indirections_table = mmap(NULL, qemu_real_host_page_size(),
PROT_READ | PROT_WRITE, MAP_SHARED,
ctx->map_indirections_table, 0);
if (ctx->mmap_indirections_table == MAP_FAILED) {
- trace_ebpf_error("eBPF RSS", "can not mmap eBPF indirection table");
+ trace_ebpf_rss_mmap_error(ctx, "indirections table");
goto indirection_fail;
}
@@ -105,14 +105,14 @@ bool ebpf_rss_load(struct EBPFRSSContext *ctx)
rss_bpf_ctx = rss_bpf__open();
if (rss_bpf_ctx == NULL) {
- trace_ebpf_error("eBPF RSS", "can not open eBPF RSS object");
+ trace_ebpf_rss_open_error(ctx);
goto error;
}
bpf_program__set_type(rss_bpf_ctx->progs.tun_rss_steering_prog, BPF_PROG_TYPE_SOCKET_FILTER);
if (rss_bpf__load(rss_bpf_ctx)) {
- trace_ebpf_error("eBPF RSS", "can not load RSS program");
+ trace_ebpf_rss_load_error(ctx);
goto error;
}
diff --git a/ebpf/trace-events b/ebpf/trace-events
index b3ad1a35f2..a0f157be37 100644
--- a/ebpf/trace-events
+++ b/ebpf/trace-events
@@ -1,4 +1,6 @@
# See docs/devel/tracing.rst for syntax documentation.
# ebpf-rss.c
-ebpf_error(const char *s1, const char *s2) "error in %s: %s"
+ebpf_rss_load_error(void *ctx) "ctx=%p"
+ebpf_rss_mmap_error(void *ctx, const char *object) "ctx=%p object=%s"
+ebpf_rss_open_error(void *ctx) "ctx=%p"
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2 4/7] ebpf: add formal error reporting to all APIs
2024-09-05 18:13 [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs Daniel P. Berrangé
` (2 preceding siblings ...)
2024-09-05 18:13 ` [PATCH v2 3/7] ebpf: improve error trace events Daniel P. Berrangé
@ 2024-09-05 18:13 ` Daniel P. Berrangé
2024-09-06 10:07 ` Philippe Mathieu-Daudé
2024-10-23 3:55 ` Jason Wang
2024-09-05 18:13 ` [PATCH v2 5/7] hw/net: report errors from failing to use eBPF RSS FDs Daniel P. Berrangé
` (3 subsequent siblings)
7 siblings, 2 replies; 17+ messages in thread
From: Daniel P. Berrangé @ 2024-09-05 18:13 UTC (permalink / raw)
To: qemu-devel
Cc: Jason Wang, Yuri Benditovich, Michael S. Tsirkin,
Andrew Melnychenko, Daniel P. Berrangé
The eBPF code is currently reporting error messages through trace
events. Trace events are fine for debugging, but they are not to be
considered the primary error reporting mechanism, as their output
is inaccessible to callers.
This adds an "Error **errp" parameter to all methods which have
important error scenarios to report to the caller.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
| 59 ++++++++++++++++++++++++++++++++++++---------
| 10 +++++---
hw/net/virtio-net.c | 7 +++---
3 files changed, 59 insertions(+), 17 deletions(-)
--git a/ebpf/ebpf_rss.c b/ebpf/ebpf_rss.c
index 47186807ad..f65a58b0b6 100644
--- a/ebpf/ebpf_rss.c
+++ b/ebpf/ebpf_rss.c
@@ -47,13 +47,14 @@ bool ebpf_rss_is_loaded(struct EBPFRSSContext *ctx)
return ctx != NULL && (ctx->obj != NULL || ctx->program_fd != -1);
}
-static bool ebpf_rss_mmap(struct EBPFRSSContext *ctx)
+static bool ebpf_rss_mmap(struct EBPFRSSContext *ctx, Error **errp)
{
ctx->mmap_configuration = mmap(NULL, qemu_real_host_page_size(),
PROT_READ | PROT_WRITE, MAP_SHARED,
ctx->map_configuration, 0);
if (ctx->mmap_configuration == MAP_FAILED) {
trace_ebpf_rss_mmap_error(ctx, "configuration");
+ error_setg(errp, "Unable to map eBPF configuration array");
return false;
}
ctx->mmap_toeplitz_key = mmap(NULL, qemu_real_host_page_size(),
@@ -61,6 +62,7 @@ static bool ebpf_rss_mmap(struct EBPFRSSContext *ctx)
ctx->map_toeplitz_key, 0);
if (ctx->mmap_toeplitz_key == MAP_FAILED) {
trace_ebpf_rss_mmap_error(ctx, "toeplitz key");
+ error_setg(errp, "Unable to map eBPF toeplitz array");
goto toeplitz_fail;
}
ctx->mmap_indirections_table = mmap(NULL, qemu_real_host_page_size(),
@@ -68,6 +70,7 @@ static bool ebpf_rss_mmap(struct EBPFRSSContext *ctx)
ctx->map_indirections_table, 0);
if (ctx->mmap_indirections_table == MAP_FAILED) {
trace_ebpf_rss_mmap_error(ctx, "indirections table");
+ error_setg(errp, "Unable to map eBPF indirection array");
goto indirection_fail;
}
@@ -95,7 +98,7 @@ static void ebpf_rss_munmap(struct EBPFRSSContext *ctx)
ctx->mmap_indirections_table = NULL;
}
-bool ebpf_rss_load(struct EBPFRSSContext *ctx)
+bool ebpf_rss_load(struct EBPFRSSContext *ctx, Error **errp)
{
struct rss_bpf *rss_bpf_ctx;
@@ -106,6 +109,7 @@ bool ebpf_rss_load(struct EBPFRSSContext *ctx)
rss_bpf_ctx = rss_bpf__open();
if (rss_bpf_ctx == NULL) {
trace_ebpf_rss_open_error(ctx);
+ error_setg(errp, "Unable to open eBPF RSS object");
goto error;
}
@@ -113,6 +117,7 @@ bool ebpf_rss_load(struct EBPFRSSContext *ctx)
if (rss_bpf__load(rss_bpf_ctx)) {
trace_ebpf_rss_load_error(ctx);
+ error_setg(errp, "Unable to load eBPF program");
goto error;
}
@@ -126,7 +131,7 @@ bool ebpf_rss_load(struct EBPFRSSContext *ctx)
ctx->map_toeplitz_key = bpf_map__fd(
rss_bpf_ctx->maps.tap_rss_map_toeplitz_key);
- if (!ebpf_rss_mmap(ctx)) {
+ if (!ebpf_rss_mmap(ctx, errp)) {
goto error;
}
@@ -143,13 +148,28 @@ error:
}
bool ebpf_rss_load_fds(struct EBPFRSSContext *ctx, int program_fd,
- int config_fd, int toeplitz_fd, int table_fd)
+ int config_fd, int toeplitz_fd, int table_fd,
+ Error **errp)
{
if (ebpf_rss_is_loaded(ctx)) {
+ error_setg(errp, "eBPF program is already loaded");
return false;
}
- if (program_fd < 0 || config_fd < 0 || toeplitz_fd < 0 || table_fd < 0) {
+ if (program_fd < 0) {
+ error_setg(errp, "eBPF program FD is not open");
+ return false;
+ }
+ if (config_fd < 0) {
+ error_setg(errp, "eBPF config FD is not open");
+ return false;
+ }
+ if (toeplitz_fd < 0) {
+ error_setg(errp, "eBPF toeplitz FD is not open");
+ return false;
+ }
+ if (table_fd < 0) {
+ error_setg(errp, "eBPF indirection FD is not open");
return false;
}
@@ -158,7 +178,7 @@ bool ebpf_rss_load_fds(struct EBPFRSSContext *ctx, int program_fd,
ctx->map_toeplitz_key = toeplitz_fd;
ctx->map_indirections_table = table_fd;
- if (!ebpf_rss_mmap(ctx)) {
+ if (!ebpf_rss_mmap(ctx, errp)) {
ctx->program_fd = -1;
ctx->map_configuration = -1;
ctx->map_toeplitz_key = -1;
@@ -177,11 +197,14 @@ static void ebpf_rss_set_config(struct EBPFRSSContext *ctx,
static bool ebpf_rss_set_indirections_table(struct EBPFRSSContext *ctx,
uint16_t *indirections_table,
- size_t len)
+ size_t len,
+ Error **errp)
{
char *cursor = ctx->mmap_indirections_table;
if (len > VIRTIO_NET_RSS_MAX_TABLE_LEN) {
+ error_setg(errp, "Indirections table length %zu exceeds limit %d",
+ len, VIRTIO_NET_RSS_MAX_TABLE_LEN);
return false;
}
@@ -206,17 +229,31 @@ static void ebpf_rss_set_toepliz_key(struct EBPFRSSContext *ctx,
}
bool ebpf_rss_set_all(struct EBPFRSSContext *ctx, struct EBPFRSSConfig *config,
- uint16_t *indirections_table, uint8_t *toeplitz_key)
+ uint16_t *indirections_table, uint8_t *toeplitz_key,
+ Error **errp)
{
- if (!ebpf_rss_is_loaded(ctx) || config == NULL ||
- indirections_table == NULL || toeplitz_key == NULL) {
+ if (!ebpf_rss_is_loaded(ctx)) {
+ error_setg(errp, "eBPF program is not loaded");
+ return false;
+ }
+ if (config == NULL) {
+ error_setg(errp, "eBPF config table is NULL");
+ return false;
+ }
+ if (indirections_table == NULL) {
+ error_setg(errp, "eBPF indirections table is NULL");
+ return false;
+ }
+ if (toeplitz_key == NULL) {
+ error_setg(errp, "eBPF toeplitz key is NULL");
return false;
}
ebpf_rss_set_config(ctx, config);
if (!ebpf_rss_set_indirections_table(ctx, indirections_table,
- config->indirections_len)) {
+ config->indirections_len,
+ errp)) {
return false;
}
--git a/ebpf/ebpf_rss.h b/ebpf/ebpf_rss.h
index 239242b0d2..86a5787789 100644
--- a/ebpf/ebpf_rss.h
+++ b/ebpf/ebpf_rss.h
@@ -14,6 +14,8 @@
#ifndef QEMU_EBPF_RSS_H
#define QEMU_EBPF_RSS_H
+#include "qapi/error.h"
+
#define EBPF_RSS_MAX_FDS 4
struct EBPFRSSContext {
@@ -41,13 +43,15 @@ void ebpf_rss_init(struct EBPFRSSContext *ctx);
bool ebpf_rss_is_loaded(struct EBPFRSSContext *ctx);
-bool ebpf_rss_load(struct EBPFRSSContext *ctx);
+bool ebpf_rss_load(struct EBPFRSSContext *ctx, Error **errp);
bool ebpf_rss_load_fds(struct EBPFRSSContext *ctx, int program_fd,
- int config_fd, int toeplitz_fd, int table_fd);
+ int config_fd, int toeplitz_fd, int table_fd,
+ Error **errp);
bool ebpf_rss_set_all(struct EBPFRSSContext *ctx, struct EBPFRSSConfig *config,
- uint16_t *indirections_table, uint8_t *toeplitz_key);
+ uint16_t *indirections_table, uint8_t *toeplitz_key,
+ Error **errp);
void ebpf_rss_unload(struct EBPFRSSContext *ctx);
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 055fce1d78..558fc62844 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1265,7 +1265,8 @@ static bool virtio_net_attach_ebpf_rss(VirtIONet *n)
rss_data_to_rss_config(&n->rss_data, &config);
if (!ebpf_rss_set_all(&n->ebpf_rss, &config,
- n->rss_data.indirections_table, n->rss_data.key)) {
+ n->rss_data.indirections_table, n->rss_data.key,
+ NULL)) {
return false;
}
@@ -1336,7 +1337,7 @@ static bool virtio_net_load_ebpf_fds(VirtIONet *n)
}
}
- ret = ebpf_rss_load_fds(&n->ebpf_rss, fds[0], fds[1], fds[2], fds[3]);
+ ret = ebpf_rss_load_fds(&n->ebpf_rss, fds[0], fds[1], fds[2], fds[3], NULL);
exit:
if (!ret) {
@@ -1354,7 +1355,7 @@ static bool virtio_net_load_ebpf(VirtIONet *n)
if (virtio_net_attach_ebpf_to_backend(n->nic, -1)) {
if (!(n->ebpf_rss_fds && virtio_net_load_ebpf_fds(n))) {
- ret = ebpf_rss_load(&n->ebpf_rss);
+ ret = ebpf_rss_load(&n->ebpf_rss, NULL);
}
}
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2 5/7] hw/net: report errors from failing to use eBPF RSS FDs
2024-09-05 18:13 [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs Daniel P. Berrangé
` (3 preceding siblings ...)
2024-09-05 18:13 ` [PATCH v2 4/7] ebpf: add formal error reporting to all APIs Daniel P. Berrangé
@ 2024-09-05 18:13 ` Daniel P. Berrangé
2024-09-06 10:09 ` Philippe Mathieu-Daudé
2024-09-05 18:13 ` [PATCH v2 6/7] ebpf: improve trace event coverage to all key operations Daniel P. Berrangé
` (2 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Daniel P. Berrangé @ 2024-09-05 18:13 UTC (permalink / raw)
To: qemu-devel
Cc: Jason Wang, Yuri Benditovich, Michael S. Tsirkin,
Andrew Melnychenko, Daniel P. Berrangé
If the user/mgmt app passed in a set of pre-opened FDs for eBPF RSS,
then it is expecting QEMU to use them. Any failure to do so must be
considered a fatal error and propagated back up the stack, otherwise
deployment mistakes will not be detectable in a prompt manner. When
not using pre-opened FDs, then eBPF RSS is tried on a "best effort"
basis only and thus fallback to software RSS is valid.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
hw/net/virtio-net.c | 41 +++++++++++++++++++++++++++++------------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 558fc62844..f2690390c1 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1316,28 +1316,27 @@ static void virtio_net_disable_rss(VirtIONet *n)
virtio_net_commit_rss_config(n);
}
-static bool virtio_net_load_ebpf_fds(VirtIONet *n)
+static bool virtio_net_load_ebpf_fds(VirtIONet *n, Error **errp)
{
int fds[EBPF_RSS_MAX_FDS] = { [0 ... EBPF_RSS_MAX_FDS - 1] = -1};
int ret = true;
int i = 0;
if (n->nr_ebpf_rss_fds != EBPF_RSS_MAX_FDS) {
- warn_report("Expected %d file descriptors but got %d",
- EBPF_RSS_MAX_FDS, n->nr_ebpf_rss_fds);
- return false;
- }
+ error_setg(errp, "Expected %d file descriptors but got %d",
+ EBPF_RSS_MAX_FDS, n->nr_ebpf_rss_fds);
+ return false;
+ }
for (i = 0; i < n->nr_ebpf_rss_fds; i++) {
- fds[i] = monitor_fd_param(monitor_cur(), n->ebpf_rss_fds[i],
- &error_warn);
+ fds[i] = monitor_fd_param(monitor_cur(), n->ebpf_rss_fds[i], errp);
if (fds[i] < 0) {
ret = false;
goto exit;
}
}
- ret = ebpf_rss_load_fds(&n->ebpf_rss, fds[0], fds[1], fds[2], fds[3], NULL);
+ ret = ebpf_rss_load_fds(&n->ebpf_rss, fds[0], fds[1], fds[2], fds[3], errp);
exit:
if (!ret) {
@@ -1349,13 +1348,15 @@ exit:
return ret;
}
-static bool virtio_net_load_ebpf(VirtIONet *n)
+static bool virtio_net_load_ebpf(VirtIONet *n, Error **errp)
{
bool ret = false;
if (virtio_net_attach_ebpf_to_backend(n->nic, -1)) {
- if (!(n->ebpf_rss_fds && virtio_net_load_ebpf_fds(n))) {
- ret = ebpf_rss_load(&n->ebpf_rss, NULL);
+ if (n->ebpf_rss_fds) {
+ ret = virtio_net_load_ebpf_fds(n, errp);
+ } else {
+ ret = ebpf_rss_load(&n->ebpf_rss, errp);
}
}
@@ -3761,7 +3762,23 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)
net_rx_pkt_init(&n->rx_pkt);
if (virtio_has_feature(n->host_features, VIRTIO_NET_F_RSS)) {
- virtio_net_load_ebpf(n);
+ Error *err = NULL;
+ if (!virtio_net_load_ebpf(n, &err)) {
+ /*
+ * If user explicitly gave QEMU RSS FDs to use, then
+ * failing to use them must be considered a fatal
+ * error. If no RSS FDs were provided, QEMU is trying
+ * eBPF on a "best effort" basis only, so report a
+ * warning and allow fallback to software RSS.
+ */
+ if (n->ebpf_rss_fds) {
+ error_propagate(errp, err);
+ } else {
+ warn_report("unable to load eBPF RSS: %s",
+ error_get_pretty(err));
+ error_free(err);
+ }
+ }
}
}
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2 6/7] ebpf: improve trace event coverage to all key operations
2024-09-05 18:13 [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs Daniel P. Berrangé
` (4 preceding siblings ...)
2024-09-05 18:13 ` [PATCH v2 5/7] hw/net: report errors from failing to use eBPF RSS FDs Daniel P. Berrangé
@ 2024-09-05 18:13 ` Daniel P. Berrangé
2024-09-06 10:10 ` Philippe Mathieu-Daudé
2024-09-05 18:13 ` [PATCH v2 7/7] hw/net: improve tracing of eBPF RSS setup Daniel P. Berrangé
2024-09-06 9:57 ` [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs Michael S. Tsirkin
7 siblings, 1 reply; 17+ messages in thread
From: Daniel P. Berrangé @ 2024-09-05 18:13 UTC (permalink / raw)
To: qemu-devel
Cc: Jason Wang, Yuri Benditovich, Michael S. Tsirkin,
Andrew Melnychenko, Daniel P. Berrangé
The existing error trace event is renamed to have a name prefix
matching its source file & to remove the redundant first arg that
adds no useful information.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
| 19 +++++++++++++++++++
ebpf/trace-events | 4 ++++
2 files changed, 23 insertions(+)
--git a/ebpf/ebpf_rss.c b/ebpf/ebpf_rss.c
index f65a58b0b6..2afff27e78 100644
--- a/ebpf/ebpf_rss.c
+++ b/ebpf/ebpf_rss.c
@@ -74,6 +74,10 @@ static bool ebpf_rss_mmap(struct EBPFRSSContext *ctx, Error **errp)
goto indirection_fail;
}
+ trace_ebpf_rss_mmap(ctx,
+ ctx->mmap_configuration,
+ ctx->mmap_toeplitz_key,
+ ctx->mmap_indirections_table);
return true;
indirection_fail:
@@ -131,6 +135,11 @@ bool ebpf_rss_load(struct EBPFRSSContext *ctx, Error **errp)
ctx->map_toeplitz_key = bpf_map__fd(
rss_bpf_ctx->maps.tap_rss_map_toeplitz_key);
+ trace_ebpf_rss_load(ctx,
+ ctx->program_fd,
+ ctx->map_configuration,
+ ctx->map_indirections_table,
+ ctx->map_toeplitz_key);
if (!ebpf_rss_mmap(ctx, errp)) {
goto error;
}
@@ -178,6 +187,12 @@ bool ebpf_rss_load_fds(struct EBPFRSSContext *ctx, int program_fd,
ctx->map_toeplitz_key = toeplitz_fd;
ctx->map_indirections_table = table_fd;
+ trace_ebpf_rss_load(ctx,
+ ctx->program_fd,
+ ctx->map_configuration,
+ ctx->map_indirections_table,
+ ctx->map_toeplitz_key);
+
if (!ebpf_rss_mmap(ctx, errp)) {
ctx->program_fd = -1;
ctx->map_configuration = -1;
@@ -259,6 +274,8 @@ bool ebpf_rss_set_all(struct EBPFRSSContext *ctx, struct EBPFRSSConfig *config,
ebpf_rss_set_toepliz_key(ctx, toeplitz_key);
+ trace_ebpf_rss_set_data(ctx, config, indirections_table, toeplitz_key);
+
return true;
}
@@ -268,6 +285,8 @@ void ebpf_rss_unload(struct EBPFRSSContext *ctx)
return;
}
+ trace_ebpf_rss_unload(ctx);
+
ebpf_rss_munmap(ctx);
if (ctx->obj) {
diff --git a/ebpf/trace-events b/ebpf/trace-events
index a0f157be37..bf3d9b6451 100644
--- a/ebpf/trace-events
+++ b/ebpf/trace-events
@@ -1,6 +1,10 @@
# See docs/devel/tracing.rst for syntax documentation.
# ebpf-rss.c
+ebpf_rss_load(void *ctx, int progfd, int cfgfd, int toepfd, int indirfd) "ctx=%p program-fd=%d config-fd=%d toeplitz-fd=%d indirection-fd=%d"
ebpf_rss_load_error(void *ctx) "ctx=%p"
+ebpf_rss_mmap(void *ctx, void *cfgptr, void *toepptr, void *indirptr) "ctx=%p config-ptr=%p toeplitz-ptr=%p indirection-ptr=%p"
ebpf_rss_mmap_error(void *ctx, const char *object) "ctx=%p object=%s"
ebpf_rss_open_error(void *ctx) "ctx=%p"
+ebpf_rss_set_data(void *ctx, void *cfgptr, void *toepptr, void *indirptr) "ctx=%p config-ptr=%p toeplitz-ptr=%p indirection-ptr=%p"
+ebpf_rss_unload(void *ctx) "rss unload ctx=%p"
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2 7/7] hw/net: improve tracing of eBPF RSS setup
2024-09-05 18:13 [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs Daniel P. Berrangé
` (5 preceding siblings ...)
2024-09-05 18:13 ` [PATCH v2 6/7] ebpf: improve trace event coverage to all key operations Daniel P. Berrangé
@ 2024-09-05 18:13 ` Daniel P. Berrangé
2024-09-06 10:12 ` Philippe Mathieu-Daudé
2024-09-06 9:57 ` [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs Michael S. Tsirkin
7 siblings, 1 reply; 17+ messages in thread
From: Daniel P. Berrangé @ 2024-09-05 18:13 UTC (permalink / raw)
To: qemu-devel
Cc: Jason Wang, Yuri Benditovich, Michael S. Tsirkin,
Andrew Melnychenko, Daniel P. Berrangé
This adds more trace events to key eBPF RSS setup operations, and
also distinguishes events from multiple NIC instances.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
hw/net/trace-events | 8 +++++---
hw/net/virtio-net.c | 9 ++++++---
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/hw/net/trace-events b/hw/net/trace-events
index 78efa2ec2c..6cad34aba2 100644
--- a/hw/net/trace-events
+++ b/hw/net/trace-events
@@ -399,9 +399,11 @@ virtio_net_announce_notify(void) ""
virtio_net_announce_timer(int round) "%d"
virtio_net_handle_announce(int round) "%d"
virtio_net_post_load_device(void)
-virtio_net_rss_disable(void)
-virtio_net_rss_error(const char *msg, uint32_t value) "%s, value 0x%08x"
-virtio_net_rss_enable(uint32_t p1, uint16_t p2, uint8_t p3) "hashes 0x%x, table of %d, key of %d"
+virtio_net_rss_load(void *nic, size_t nfds, void *fds) "nic=%p nfds=%zu fds=%p"
+virtio_net_rss_attach_ebpf(void *nic, int prog_fd) "nic=%p prog-fd=%d"
+virtio_net_rss_disable(void *nic) "nic=%p"
+virtio_net_rss_error(void *nic, const char *msg, uint32_t value) "nic=%p msg=%s, value 0x%08x"
+virtio_net_rss_enable(void *nic, uint32_t p1, uint16_t p2, uint8_t p3) "nic=%p hashes 0x%x, table of %d, key of %d"
# tulip.c
tulip_reg_write(uint64_t addr, const char *name, int size, uint64_t val) "addr 0x%02"PRIx64" (%s) size %d value 0x%08"PRIx64
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index f2690390c1..5d26a8e260 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1241,6 +1241,7 @@ static bool virtio_net_attach_ebpf_to_backend(NICState *nic, int prog_fd)
return false;
}
+ trace_virtio_net_rss_attach_ebpf(nic, prog_fd);
return nc->info->set_steering_ebpf(nc, prog_fd);
}
@@ -1297,12 +1298,13 @@ static void virtio_net_commit_rss_config(VirtIONet *n)
}
}
- trace_virtio_net_rss_enable(n->rss_data.hash_types,
+ trace_virtio_net_rss_enable(n,
+ n->rss_data.hash_types,
n->rss_data.indirections_len,
sizeof(n->rss_data.key));
} else {
virtio_net_detach_ebpf_rss(n);
- trace_virtio_net_rss_disable();
+ trace_virtio_net_rss_disable(n);
}
}
@@ -1353,6 +1355,7 @@ static bool virtio_net_load_ebpf(VirtIONet *n, Error **errp)
bool ret = false;
if (virtio_net_attach_ebpf_to_backend(n->nic, -1)) {
+ trace_virtio_net_rss_load(n, n->nr_ebpf_rss_fds, n->ebpf_rss_fds);
if (n->ebpf_rss_fds) {
ret = virtio_net_load_ebpf_fds(n, errp);
} else {
@@ -1484,7 +1487,7 @@ static uint16_t virtio_net_handle_rss(VirtIONet *n,
virtio_net_commit_rss_config(n);
return queue_pairs;
error:
- trace_virtio_net_rss_error(err_msg, err_value);
+ trace_virtio_net_rss_error(n, err_msg, err_value);
virtio_net_disable_rss(n);
return 0;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs
2024-09-05 18:13 [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs Daniel P. Berrangé
` (6 preceding siblings ...)
2024-09-05 18:13 ` [PATCH v2 7/7] hw/net: improve tracing of eBPF RSS setup Daniel P. Berrangé
@ 2024-09-06 9:57 ` Michael S. Tsirkin
2024-09-09 2:34 ` Jason Wang
7 siblings, 1 reply; 17+ messages in thread
From: Michael S. Tsirkin @ 2024-09-06 9:57 UTC (permalink / raw)
To: Daniel P. Berrangé
Cc: qemu-devel, Jason Wang, Yuri Benditovich, Andrew Melnychenko
On Thu, Sep 05, 2024 at 07:13:23PM +0100, Daniel P. Berrangé wrote:
> The virtio-net code for eBPF RSS is still ignoring errors when
> failing to load the eBPF RSS program passed in by the mgmt app
> via pre-opened FDs.
>
> This series re-factors the eBPF common code so that it actually
> reports using "Error" objects. Then it makes virtio-net treat
> a failure to load pre-opened FDs as a fatal problem. When doing
> speculative opening of eBPF FDs, QEMU merely prints a warning,
> and allows the software fallback to continue.
>
> Trace event coverage is significantly expanded to make this all
> much more debuggable too.
looks good
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Jason's tree.
> Changed in v2:
>
> - Split 'ebpf_error' probe into multiple probes
>
> Daniel P. Berrangé (7):
> hw/net: fix typo s/epbf/ebpf/ in virtio-net
> ebpf: drop redundant parameter checks in static methods
> ebpf: improve error trace events
> ebpf: add formal error reporting to all APIs
> hw/net: report errors from failing to use eBPF RSS FDs
> ebpf: improve trace event coverage to all key operations
> hw/net: improve tracing of eBPF RSS setup
>
> ebpf/ebpf_rss.c | 118 ++++++++++++++++++++++++++++----------------
> ebpf/ebpf_rss.h | 10 ++--
> ebpf/trace-events | 8 ++-
> hw/net/trace-events | 8 +--
> hw/net/virtio-net.c | 63 +++++++++++++++--------
> 5 files changed, 137 insertions(+), 70 deletions(-)
>
> --
> 2.45.2
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2 4/7] ebpf: add formal error reporting to all APIs
2024-09-05 18:13 ` [PATCH v2 4/7] ebpf: add formal error reporting to all APIs Daniel P. Berrangé
@ 2024-09-06 10:07 ` Philippe Mathieu-Daudé
2024-10-23 3:55 ` Jason Wang
1 sibling, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-09-06 10:07 UTC (permalink / raw)
To: Daniel P. Berrangé, qemu-devel
Cc: Jason Wang, Yuri Benditovich, Michael S. Tsirkin,
Andrew Melnychenko
On 5/9/24 20:13, Daniel P. Berrangé wrote:
> The eBPF code is currently reporting error messages through trace
> events. Trace events are fine for debugging, but they are not to be
> considered the primary error reporting mechanism, as their output
> is inaccessible to callers.
>
> This adds an "Error **errp" parameter to all methods which have
> important error scenarios to report to the caller.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> ebpf/ebpf_rss.c | 59 ++++++++++++++++++++++++++++++++++++---------
> ebpf/ebpf_rss.h | 10 +++++---
> hw/net/virtio-net.c | 7 +++---
> 3 files changed, 59 insertions(+), 17 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2 5/7] hw/net: report errors from failing to use eBPF RSS FDs
2024-09-05 18:13 ` [PATCH v2 5/7] hw/net: report errors from failing to use eBPF RSS FDs Daniel P. Berrangé
@ 2024-09-06 10:09 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-09-06 10:09 UTC (permalink / raw)
To: Daniel P. Berrangé, qemu-devel
Cc: Jason Wang, Yuri Benditovich, Michael S. Tsirkin,
Andrew Melnychenko
On 5/9/24 20:13, Daniel P. Berrangé wrote:
> If the user/mgmt app passed in a set of pre-opened FDs for eBPF RSS,
> then it is expecting QEMU to use them. Any failure to do so must be
> considered a fatal error and propagated back up the stack, otherwise
> deployment mistakes will not be detectable in a prompt manner. When
> not using pre-opened FDs, then eBPF RSS is tried on a "best effort"
> basis only and thus fallback to software RSS is valid.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> hw/net/virtio-net.c | 41 +++++++++++++++++++++++++++++------------
> 1 file changed, 29 insertions(+), 12 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2 6/7] ebpf: improve trace event coverage to all key operations
2024-09-05 18:13 ` [PATCH v2 6/7] ebpf: improve trace event coverage to all key operations Daniel P. Berrangé
@ 2024-09-06 10:10 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-09-06 10:10 UTC (permalink / raw)
To: Daniel P. Berrangé, qemu-devel
Cc: Jason Wang, Yuri Benditovich, Michael S. Tsirkin,
Andrew Melnychenko
On 5/9/24 20:13, Daniel P. Berrangé wrote:
> The existing error trace event is renamed to have a name prefix
> matching its source file & to remove the redundant first arg that
> adds no useful information.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> ebpf/ebpf_rss.c | 19 +++++++++++++++++++
> ebpf/trace-events | 4 ++++
> 2 files changed, 23 insertions(+)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2 7/7] hw/net: improve tracing of eBPF RSS setup
2024-09-05 18:13 ` [PATCH v2 7/7] hw/net: improve tracing of eBPF RSS setup Daniel P. Berrangé
@ 2024-09-06 10:12 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-09-06 10:12 UTC (permalink / raw)
To: Daniel P. Berrangé, qemu-devel
Cc: Jason Wang, Yuri Benditovich, Michael S. Tsirkin,
Andrew Melnychenko
On 5/9/24 20:13, Daniel P. Berrangé wrote:
> This adds more trace events to key eBPF RSS setup operations, and
> also distinguishes events from multiple NIC instances.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> hw/net/trace-events | 8 +++++---
> hw/net/virtio-net.c | 9 ++++++---
> 2 files changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/hw/net/trace-events b/hw/net/trace-events
> index 78efa2ec2c..6cad34aba2 100644
> --- a/hw/net/trace-events
> +++ b/hw/net/trace-events
> @@ -399,9 +399,11 @@ virtio_net_announce_notify(void) ""
> virtio_net_announce_timer(int round) "%d"
> virtio_net_handle_announce(int round) "%d"
> virtio_net_post_load_device(void)
> -virtio_net_rss_disable(void)
> -virtio_net_rss_error(const char *msg, uint32_t value) "%s, value 0x%08x"
> -virtio_net_rss_enable(uint32_t p1, uint16_t p2, uint8_t p3) "hashes 0x%x, table of %d, key of %d"
> +virtio_net_rss_load(void *nic, size_t nfds, void *fds) "nic=%p nfds=%zu fds=%p"
> +virtio_net_rss_attach_ebpf(void *nic, int prog_fd) "nic=%p prog-fd=%d"
> +virtio_net_rss_disable(void *nic) "nic=%p"
> +virtio_net_rss_error(void *nic, const char *msg, uint32_t value) "nic=%p msg=%s, value 0x%08x"
> +virtio_net_rss_enable(void *nic, uint32_t p1, uint16_t p2, uint8_t p3) "nic=%p hashes 0x%x, table of %d, key of %d"
Nitpicking for pre-existing error, unsigned format is %u ;)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs
2024-09-06 9:57 ` [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs Michael S. Tsirkin
@ 2024-09-09 2:34 ` Jason Wang
2024-10-15 13:50 ` Daniel P. Berrangé
0 siblings, 1 reply; 17+ messages in thread
From: Jason Wang @ 2024-09-09 2:34 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Daniel P. Berrangé, qemu-devel, Yuri Benditovich,
Andrew Melnychenko
On Fri, Sep 6, 2024 at 5:57 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Thu, Sep 05, 2024 at 07:13:23PM +0100, Daniel P. Berrangé wrote:
> > The virtio-net code for eBPF RSS is still ignoring errors when
> > failing to load the eBPF RSS program passed in by the mgmt app
> > via pre-opened FDs.
> >
> > This series re-factors the eBPF common code so that it actually
> > reports using "Error" objects. Then it makes virtio-net treat
> > a failure to load pre-opened FDs as a fatal problem. When doing
> > speculative opening of eBPF FDs, QEMU merely prints a warning,
> > and allows the software fallback to continue.
> >
> > Trace event coverage is significantly expanded to make this all
> > much more debuggable too.
>
>
> looks good
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>
> Jason's tree.
>
Queued.
Thanks
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs
2024-09-09 2:34 ` Jason Wang
@ 2024-10-15 13:50 ` Daniel P. Berrangé
0 siblings, 0 replies; 17+ messages in thread
From: Daniel P. Berrangé @ 2024-10-15 13:50 UTC (permalink / raw)
To: Jason Wang
Cc: Michael S. Tsirkin, qemu-devel, Yuri Benditovich,
Andrew Melnychenko
On Mon, Sep 09, 2024 at 10:34:32AM +0800, Jason Wang wrote:
> On Fri, Sep 6, 2024 at 5:57 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Thu, Sep 05, 2024 at 07:13:23PM +0100, Daniel P. Berrangé wrote:
> > > The virtio-net code for eBPF RSS is still ignoring errors when
> > > failing to load the eBPF RSS program passed in by the mgmt app
> > > via pre-opened FDs.
> > >
> > > This series re-factors the eBPF common code so that it actually
> > > reports using "Error" objects. Then it makes virtio-net treat
> > > a failure to load pre-opened FDs as a fatal problem. When doing
> > > speculative opening of eBPF FDs, QEMU merely prints a warning,
> > > and allows the software fallback to continue.
> > >
> > > Trace event coverage is significantly expanded to make this all
> > > much more debuggable too.
> >
> >
> > looks good
> > Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> >
> > Jason's tree.
> >
>
> Queued.
I'm still not seeing this in master - is any PR planned in near future ?
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2 4/7] ebpf: add formal error reporting to all APIs
2024-09-05 18:13 ` [PATCH v2 4/7] ebpf: add formal error reporting to all APIs Daniel P. Berrangé
2024-09-06 10:07 ` Philippe Mathieu-Daudé
@ 2024-10-23 3:55 ` Jason Wang
2024-10-23 8:52 ` Daniel P. Berrangé
1 sibling, 1 reply; 17+ messages in thread
From: Jason Wang @ 2024-10-23 3:55 UTC (permalink / raw)
To: Daniel P. Berrangé
Cc: qemu-devel, Yuri Benditovich, Michael S. Tsirkin,
Andrew Melnychenko
On Fri, Sep 6, 2024 at 2:13 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> The eBPF code is currently reporting error messages through trace
> events. Trace events are fine for debugging, but they are not to be
> considered the primary error reporting mechanism, as their output
> is inaccessible to callers.
>
> This adds an "Error **errp" parameter to all methods which have
> important error scenarios to report to the caller.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This doesn't compile:
[3/84] Compiling C object libcommon.a.p/ebpf_ebpf_rss-stub.c.o
FAILED: libcommon.a.p/ebpf_ebpf_rss-stub.c.o
cc -m64 -Ilibcommon.a.p -Isubprojects/dtc/libfdt
-I../subprojects/dtc/libfdt -Isubprojects/slirp -I../subprojects/slirp
-I../subprojects/slirp/src -Isubprojects/libvduse
-I../subprojects/libvduse -I/usr/include/pixman-1
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
-I/usr/include/sysprof-4 -I/usr/include/libmount -I/usr/include/blkid
-I/usr/include/gio-unix-2.0 -fdiagnostics-color=auto -Wall
-Winvalid-pch -Werror -std=gnu11 -O2 -g -fstack-protector-strong
-Wempty-body -Wendif-labels -Wexpansion-to-defined -Wformat-security
-Wformat-y2k -Wignored-qualifiers -Wimplicit-fallthrough=2 -Winit-self
-Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs
-Wold-style-declaration -Wold-style-definition -Wredundant-decls
-Wshadow=local -Wstrict-prototypes -Wtype-limits -Wundef -Wvla
-Wwrite-strings -Wno-missing-include-dirs -Wno-psabi
-Wno-shift-negative-value -isystem /home/devel/git/qemu/linux-headers
-isystem linux-headers -iquote . -iquote /home/devel/git/qemu -iquote
/home/devel/git/qemu/include -iquote
/home/devel/git/qemu/host/include/x86_64 -iquote
/home/devel/git/qemu/host/include/generic -iquote
/home/devel/git/qemu/tcg/i386 -pthread -mcx16 -msse2 -D_GNU_SOURCE
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing
-fno-common -fwrapv -fzero-call-used-regs=used-gpr -fPIE
-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNCURSES_WIDECHAR=1 -MD -MQ
libcommon.a.p/ebpf_ebpf_rss-stub.c.o -MF
libcommon.a.p/ebpf_ebpf_rss-stub.c.o.d -o
libcommon.a.p/ebpf_ebpf_rss-stub.c.o -c ../ebpf/ebpf_rss-stub.c
../ebpf/ebpf_rss-stub.c:26:6: error: conflicting types for
‘ebpf_rss_load’; have ‘_Bool(struct EBPFRSSContext *)’
26 | bool ebpf_rss_load(struct EBPFRSSContext *ctx)
| ^~~~~~~~~~~~~
In file included from ../ebpf/ebpf_rss-stub.c:14:
/home/devel/git/qemu/ebpf/ebpf_rss.h:46:6: note: previous declaration
of ‘ebpf_rss_load’ with type ‘_Bool(struct EBPFRSSContext *, Error
**)’
46 | bool ebpf_rss_load(struct EBPFRSSContext *ctx, Error **errp);
| ^~~~~~~~~~~~~
../ebpf/ebpf_rss-stub.c:31:6: error: conflicting types for
‘ebpf_rss_load_fds’; have ‘_Bool(struct EBPFRSSContext *, int, int,
int, int)’
31 | bool ebpf_rss_load_fds(struct EBPFRSSContext *ctx, int program_fd,
| ^~~~~~~~~~~~~~~~~
In file included from ../ebpf/ebpf_rss-stub.c:14:
/home/devel/git/qemu/ebpf/ebpf_rss.h:48:6: note: previous declaration
of ‘ebpf_rss_load_fds’ with type ‘_Bool(struct EBPFRSSContext *, int,
int, int, int, Error **)’
48 | bool ebpf_rss_load_fds(struct EBPFRSSContext *ctx, int program_fd,
| ^~~~~~~~~~~~~~~~~
../ebpf/ebpf_rss-stub.c:37:6: error: conflicting types for
‘ebpf_rss_set_all’; have ‘_Bool(struct EBPFRSSContext *, struct
EBPFRSSConfig *, uint16_t *, uint8_t *)’ {aka ‘_Bool(struct
EBPFRSSContext *, struct EBPFRSSConfig *, short unsigned int *,
unsigned char *)’}
37 | bool ebpf_rss_set_all(struct EBPFRSSContext *ctx, struct
EBPFRSSConfig *config,
| ^~~~~~~~~~~~~~~~
In file included from ../ebpf/ebpf_rss-stub.c:14:
/home/devel/git/qemu/ebpf/ebpf_rss.h:52:6: note: previous declaration
of ‘ebpf_rss_set_all’ with type ‘_Bool(struct EBPFRSSContext *, struct
EBPFRSSConfig *, uint16_t *, uint8_t *, Error **)’ {aka ‘_Bool(struct
EBPFRSSContext *, struct EBPFRSSConfig *, short unsigned int *,
unsigned char *, Error **)’}
52 | bool ebpf_rss_set_all(struct EBPFRSSContext *ctx, struct
EBPFRSSConfig *config,
| ^~~~~~~~~~~~~~~~
Thanks
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2 4/7] ebpf: add formal error reporting to all APIs
2024-10-23 3:55 ` Jason Wang
@ 2024-10-23 8:52 ` Daniel P. Berrangé
0 siblings, 0 replies; 17+ messages in thread
From: Daniel P. Berrangé @ 2024-10-23 8:52 UTC (permalink / raw)
To: Jason Wang
Cc: qemu-devel, Yuri Benditovich, Michael S. Tsirkin,
Andrew Melnychenko
On Wed, Oct 23, 2024 at 11:55:42AM +0800, Jason Wang wrote:
> On Fri, Sep 6, 2024 at 2:13 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
> >
> > The eBPF code is currently reporting error messages through trace
> > events. Trace events are fine for debugging, but they are not to be
> > considered the primary error reporting mechanism, as their output
> > is inaccessible to callers.
> >
> > This adds an "Error **errp" parameter to all methods which have
> > important error scenarios to report to the caller.
> >
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
>
> This doesn't compile:
>
> [3/84] Compiling C object libcommon.a.p/ebpf_ebpf_rss-stub.c.o
Opps, I didn't update the stub for the new Error parameter.
I've sent a new series with the fix
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2024-10-23 8:53 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-05 18:13 [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs Daniel P. Berrangé
2024-09-05 18:13 ` [PATCH v2 1/7] hw/net: fix typo s/epbf/ebpf/ in virtio-net Daniel P. Berrangé
2024-09-05 18:13 ` [PATCH v2 2/7] ebpf: drop redundant parameter checks in static methods Daniel P. Berrangé
2024-09-05 18:13 ` [PATCH v2 3/7] ebpf: improve error trace events Daniel P. Berrangé
2024-09-05 18:13 ` [PATCH v2 4/7] ebpf: add formal error reporting to all APIs Daniel P. Berrangé
2024-09-06 10:07 ` Philippe Mathieu-Daudé
2024-10-23 3:55 ` Jason Wang
2024-10-23 8:52 ` Daniel P. Berrangé
2024-09-05 18:13 ` [PATCH v2 5/7] hw/net: report errors from failing to use eBPF RSS FDs Daniel P. Berrangé
2024-09-06 10:09 ` Philippe Mathieu-Daudé
2024-09-05 18:13 ` [PATCH v2 6/7] ebpf: improve trace event coverage to all key operations Daniel P. Berrangé
2024-09-06 10:10 ` Philippe Mathieu-Daudé
2024-09-05 18:13 ` [PATCH v2 7/7] hw/net: improve tracing of eBPF RSS setup Daniel P. Berrangé
2024-09-06 10:12 ` Philippe Mathieu-Daudé
2024-09-06 9:57 ` [PATCH v2 0/7] Report fatal errors from failure with pre-opened eBPF RSS FDs Michael S. Tsirkin
2024-09-09 2:34 ` Jason Wang
2024-10-15 13:50 ` Daniel P. Berrangé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).