[RFC PATCH v4 0/5] Added virtio-net RSS with eBPF support.

Andrew Melnychenko posted 5 patches 3 months ago
libvirt.spec.in                               |   3 +
meson.build                                   |   7 +
meson_options.txt                             |   1 +
src/qemu/meson.build                          |   1 +
src/qemu/qemu_capabilities.c                  | 132 ++++++++++++
src/qemu/qemu_capabilities.h                  |   5 +
src/qemu/qemu_command.c                       |  60 ++++++
src/qemu/qemu_domain.c                        |   4 +
src/qemu/qemu_domain.h                        |   3 +
src/qemu/qemu_interface.c                     |  87 ++++++++
src/qemu/qemu_interface.h                     |   7 +
src/qemu/qemu_monitor.c                       |   9 +
src/qemu/qemu_monitor.h                       |   4 +
src/qemu/qemu_monitor_json.c                  |  27 +++
src/qemu/qemu_monitor_json.h                  |   4 +
.../caps_9.0.0_sparc.replies                  |  95 +++++----
.../qemucapabilitiesdata/caps_9.0.0_sparc.xml |   3 +
.../caps_9.0.0_x86_64.replies                 | 199 ++++++++++--------
.../caps_9.0.0_x86_64.xml                     |   4 +
.../caps_9.1.0_x86_64.replies                 | 199 ++++++++++--------
.../caps_9.1.0_x86_64.xml                     |   4 +
tests/qemuxml2argvmock.c                      |  24 +++
.../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                       |   5 +
26 files changed, 792 insertions(+), 224 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
[RFC PATCH v4 0/5] Added virtio-net RSS with eBPF support.
Posted by Andrew Melnychenko 3 months ago
This series of rfc patches adds support for loading the RSS eBPF
program and passing it to the QEMU.
Comments and suggestions would be useful.

QEMU with vhost may work with RSS through eBPF. To load eBPF,
the capabilities required that Libvirt may provide.
eBPF program and maps may be unique for particular QEMU and
Libvirt retrieves eBPF through qapi.
For now, there is only "RSS" eBPF object in QEMU, in the future,
there may be another one(g.e. network filters).
That's why in Libvirt added logic to load and store any
eBPF object that QEMU provides using qapi schema.

One of the reasons why this series of patches is in RFC are tests.
To this series of patches, the tests were added.
For now, the tests are synthetic, the proper "reply" file should
be generated with a new "caps" file. Currently, there are changes
in caps-9.0.0* and caps-9.1.0 files. There was added support for
ebpf_rss_fds feature, and request-ebpf command.
So, overall, the tests are required for review, comment, and discussion
how we want them to be implemented in the future.

For virtio-net RSS, the document has not changed.
```
 <interface type="network">
  <model type="virtio"/>
  <driver queues="4" rss="on" rss_hash_report="off"/>
 <interface type="network">
```

Simplified routine for RSS:
 * Libvirt retrieves eBPF "RSS" and load it.
 * Libvirt passes file descriptors to virtio-net with property "ebpf_rss_fds" ("rss" property should be "on" too).
 * if fds was provided - QEMU using eBPF RSS implementation.
 * if fds was not provided - QEMU tries to load eBPF RSS in own context and use it.
 * if eBPF RSS was not loaded - QEMU uses "in-qemu" RSS(vhost not supported).

Changes since RFC v3:
 * changed tests a bit
 * refactored and rebased
 * removed "allowEBPF" from qemu config(now env is used for tests)

Changes since RFC v2:
 * refactored and rebased.
 * applied changes according to the Qemu.
 * added basic test.

Changes since RFC v1:
 * changed eBPF format saved in the XML cache.
 * refactored and checked with syntax test.
 * refactored patch hunks.

Andrew Melnychenko (5):
  qemu_monitor: Added QEMU's "request-ebpf" support.
  qemu_capabilities: Added logic for retrieving eBPF objects from QEMU.
  qemu_interface: Added routine for loading the eBPF objects.
  qemu_command: Added "ebpf_rss_fds" support for virtio-net.
  tests: Added tests for eBPF blob loading.

 libvirt.spec.in                               |   3 +
 meson.build                                   |   7 +
 meson_options.txt                             |   1 +
 src/qemu/meson.build                          |   1 +
 src/qemu/qemu_capabilities.c                  | 132 ++++++++++++
 src/qemu/qemu_capabilities.h                  |   5 +
 src/qemu/qemu_command.c                       |  60 ++++++
 src/qemu/qemu_domain.c                        |   4 +
 src/qemu/qemu_domain.h                        |   3 +
 src/qemu/qemu_interface.c                     |  87 ++++++++
 src/qemu/qemu_interface.h                     |   7 +
 src/qemu/qemu_monitor.c                       |   9 +
 src/qemu/qemu_monitor.h                       |   4 +
 src/qemu/qemu_monitor_json.c                  |  27 +++
 src/qemu/qemu_monitor_json.h                  |   4 +
 .../caps_9.0.0_sparc.replies                  |  95 +++++----
 .../qemucapabilitiesdata/caps_9.0.0_sparc.xml |   3 +
 .../caps_9.0.0_x86_64.replies                 | 199 ++++++++++--------
 .../caps_9.0.0_x86_64.xml                     |   4 +
 .../caps_9.1.0_x86_64.replies                 | 199 ++++++++++--------
 .../caps_9.1.0_x86_64.xml                     |   4 +
 tests/qemuxml2argvmock.c                      |  24 +++
 .../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                       |   5 +
 26 files changed, 792 insertions(+), 224 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

-- 
2.45.2
Re: [RFC PATCH v4 0/5] Added virtio-net RSS with eBPF support.
Posted by Yuri Benditovich 2 months, 1 week ago
ping

On Mon, Jul 29, 2024 at 10:49 PM Andrew Melnychenko <andrew@daynix.com> wrote:
>
> This series of rfc patches adds support for loading the RSS eBPF
> program and passing it to the QEMU.
> Comments and suggestions would be useful.
>
> QEMU with vhost may work with RSS through eBPF. To load eBPF,
> the capabilities required that Libvirt may provide.
> eBPF program and maps may be unique for particular QEMU and
> Libvirt retrieves eBPF through qapi.
> For now, there is only "RSS" eBPF object in QEMU, in the future,
> there may be another one(g.e. network filters).
> That's why in Libvirt added logic to load and store any
> eBPF object that QEMU provides using qapi schema.
>
> One of the reasons why this series of patches is in RFC are tests.
> To this series of patches, the tests were added.
> For now, the tests are synthetic, the proper "reply" file should
> be generated with a new "caps" file. Currently, there are changes
> in caps-9.0.0* and caps-9.1.0 files. There was added support for
> ebpf_rss_fds feature, and request-ebpf command.
> So, overall, the tests are required for review, comment, and discussion
> how we want them to be implemented in the future.
>
> For virtio-net RSS, the document has not changed.
> ```
>  <interface type="network">
>   <model type="virtio"/>
>   <driver queues="4" rss="on" rss_hash_report="off"/>
>  <interface type="network">
> ```
>
> Simplified routine for RSS:
>  * Libvirt retrieves eBPF "RSS" and load it.
>  * Libvirt passes file descriptors to virtio-net with property "ebpf_rss_fds" ("rss" property should be "on" too).
>  * if fds was provided - QEMU using eBPF RSS implementation.
>  * if fds was not provided - QEMU tries to load eBPF RSS in own context and use it.
>  * if eBPF RSS was not loaded - QEMU uses "in-qemu" RSS(vhost not supported).
>
> Changes since RFC v3:
>  * changed tests a bit
>  * refactored and rebased
>  * removed "allowEBPF" from qemu config(now env is used for tests)
>
> Changes since RFC v2:
>  * refactored and rebased.
>  * applied changes according to the Qemu.
>  * added basic test.
>
> Changes since RFC v1:
>  * changed eBPF format saved in the XML cache.
>  * refactored and checked with syntax test.
>  * refactored patch hunks.
>
> Andrew Melnychenko (5):
>   qemu_monitor: Added QEMU's "request-ebpf" support.
>   qemu_capabilities: Added logic for retrieving eBPF objects from QEMU.
>   qemu_interface: Added routine for loading the eBPF objects.
>   qemu_command: Added "ebpf_rss_fds" support for virtio-net.
>   tests: Added tests for eBPF blob loading.
>
>  libvirt.spec.in                               |   3 +
>  meson.build                                   |   7 +
>  meson_options.txt                             |   1 +
>  src/qemu/meson.build                          |   1 +
>  src/qemu/qemu_capabilities.c                  | 132 ++++++++++++
>  src/qemu/qemu_capabilities.h                  |   5 +
>  src/qemu/qemu_command.c                       |  60 ++++++
>  src/qemu/qemu_domain.c                        |   4 +
>  src/qemu/qemu_domain.h                        |   3 +
>  src/qemu/qemu_interface.c                     |  87 ++++++++
>  src/qemu/qemu_interface.h                     |   7 +
>  src/qemu/qemu_monitor.c                       |   9 +
>  src/qemu/qemu_monitor.h                       |   4 +
>  src/qemu/qemu_monitor_json.c                  |  27 +++
>  src/qemu/qemu_monitor_json.h                  |   4 +
>  .../caps_9.0.0_sparc.replies                  |  95 +++++----
>  .../qemucapabilitiesdata/caps_9.0.0_sparc.xml |   3 +
>  .../caps_9.0.0_x86_64.replies                 | 199 ++++++++++--------
>  .../caps_9.0.0_x86_64.xml                     |   4 +
>  .../caps_9.1.0_x86_64.replies                 | 199 ++++++++++--------
>  .../caps_9.1.0_x86_64.xml                     |   4 +
>  tests/qemuxml2argvmock.c                      |  24 +++
>  .../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                       |   5 +
>  26 files changed, 792 insertions(+), 224 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
>
> --
> 2.45.2
>