All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] ebpf: Added ebpf helper for libvirtd.
@ 2021-07-13 15:37 Andrew Melnychenko
  2021-07-13 15:37 ` [PATCH 1/5] ebpf: Added eBPF initialization by fds and map update Andrew Melnychenko
                   ` (6 more replies)
  0 siblings, 7 replies; 45+ messages in thread
From: Andrew Melnychenko @ 2021-07-13 15:37 UTC (permalink / raw)
  To: mst, yuri.benditovich, jasowang, armbru, eblake, berrange; +Cc: yan, qemu-devel

Libvirt usually launches qemu with strict permissions.
To enable eBPF RSS steering, qemu-ebpf-rss-helper was added.

Added property "ebpf_rss_fds" for "virtio-net" that allows to
initialize eBPF RSS context with passed program & maps fds.

Added qemu-ebpf-rss-helper - simple helper that loads eBPF
context and passes fds through unix socket.
Libvirt should call the helper and pass fds to qemu through
"ebpf_rss_fds" property.

Added explicit target OS check for libbpf dependency in meson.
eBPF RSS works only with Linux TAP, so there is no reason to
build eBPF loader/helper for non-Linux.

Changed Qemu updates eBPF maps to array mmaping. Mmaping allows
bypassing unprivileged BPF map update. Also, instead of 3 maps
(config, key and indirection table) there is one map that
combines everything.

Added helper stamp. To check that helper was build with qemu,
qemu would check helper symbols that should contain the stamp.
It was done similar to qemu modules, but checking was performed
by the helper's ELF parsing.

Overall, libvirt process should not be aware of the "interface"
of eBPF RSS, it will not be aware of eBPF maps/program "type" and
their quantity. That's why qemu and the helper should be from
the same build and be "synchronized". Technically each qemu may
have its own helper. That's why "query-helper-paths" qmp command
was added. Qemu should return the path to the helper that suits
and libvirt should use "that" helper for "that" emulator.

qmp sample:
C: { "execute": "query-helper-paths" }
S: { "return": [
     {
       "name": "qemu-ebpf-rss-helper",
       "path": "/usr/local/libexec/qemu-ebpf-rss-helper"
     }
    ]
   }

Changes since v1:
* Mmap() used instead if bpf_map_update_elem().
* Added helper stamp.

Andrew Melnychenko (5):
  ebpf: Added eBPF initialization by fds and map update.
  virtio-net: Added property to load eBPF RSS with fds.
  qmp: Added the helper stamp check.
  ebpf_rss_helper: Added helper for eBPF RSS.
  qmp: Added qemu-ebpf-rss-path command.

 ebpf/ebpf_rss-stub.c              |   6 +
 ebpf/ebpf_rss.c                   | 120 ++++---
 ebpf/ebpf_rss.h                   |   8 +-
 ebpf/qemu-ebpf-rss-helper.c       | 130 +++++++
 ebpf/rss.bpf.skeleton.h           | 557 +++++++++++++++---------------
 hw/net/virtio-net.c               |  77 ++++-
 include/hw/virtio/virtio-net.h    |   1 +
 meson.build                       |  47 ++-
 monitor/meson.build               |   1 +
 monitor/qemu-helper-stamp-utils.c | 297 ++++++++++++++++
 monitor/qemu-helper-stamp-utils.h |  24 ++
 monitor/qmp-cmds.c                |  32 ++
 qapi/misc.json                    |  33 ++
 tools/ebpf/rss.bpf.c              |  67 ++--
 14 files changed, 990 insertions(+), 410 deletions(-)
 create mode 100644 ebpf/qemu-ebpf-rss-helper.c
 create mode 100644 monitor/qemu-helper-stamp-utils.c
 create mode 100644 monitor/qemu-helper-stamp-utils.h

-- 
2.31.1



^ permalink raw reply	[flat|nested] 45+ messages in thread
* [PATCH 0/5] eBPF RSS Helper support.
@ 2023-02-19 16:20 Andrew Melnychenko
  2023-02-19 16:20 ` [PATCH 4/5] ebpf_rss_helper: Added helper for eBPF RSS Andrew Melnychenko
  0 siblings, 1 reply; 45+ messages in thread
From: Andrew Melnychenko @ 2023-02-19 16:20 UTC (permalink / raw)
  To: jasowang, mst, pbonzini, marcandre.lureau, berrange, thuth,
	philmd, armbru, eblake, qemu-devel, toke, mprivozn
  Cc: yuri.benditovich, yan

This series of patches provides the ability to initialize eBPF RSS steering
with the helper.
Now, virtio-net devices can accept eBPF programs and maps through properties
as external file descriptors. Access to the eBPF map is direct through mmap()
call, so it should not require additional capabilities to bpf* calls.
eBPF file descriptors can be passed to QEMU from parent process or by unix
socket with sendfd() qmp command.
The helper is provided that would load eBPF RSS program/maps and pass fd to
the called process(in future - Libvirtd) through unix socket.
Because of structures stored in the maps, it's crucial that the helper provides a proper eBPF program. That's why the stamp was added to the helper and
QEMU may check the binary. Also, additional qmp command was added for checking
the stamp.
Overall, the basic scenario of using the helper looks like this:
 * Libvirt checks for ebpf_fds property.
 * Libvirt ask QEMU for the proper helper(where is located and proper stamp)
 * Libvirt calls the helper with BPF capabilities and retrieves fds.
 * Libvirt launches the QEMU with eBPF fds passed.

Changes since RFC:
 * refactored/rebased code.
 * changed qmp command.
 * refactored helper.
 
Andrew Melnychenko (5):
  ebpf: Added eBPF initialization by fds and map update.
  virtio-net: Added property to load eBPF RSS with fds.
  qmp: Added the helper stamp check.
  ebpf_rss_helper: Added helper for eBPF RSS.
  qmp: Added find-ebpf-rss-helper command.

 ebpf/ebpf_rss-stub.c                       |   6 +
 ebpf/ebpf_rss.c                            | 120 ++++++--
 ebpf/ebpf_rss.h                            |  10 +
 ebpf/qemu-ebpf-rss-helper.c                | 132 +++++++++
 hw/net/virtio-net.c                        |  77 ++++-
 include/hw/virtio/virtio-net.h             |   1 +
 meson.build                                |  47 ++-
 monitor/meson.build                        |   1 +
 monitor/qemu-ebpf-rss-helper-stamp-utils.c | 322 +++++++++++++++++++++
 monitor/qemu-ebpf-rss-helper-stamp-utils.h |  39 +++
 monitor/qmp-cmds.c                         |  28 ++
 qapi/misc.json                             |  42 +++
 12 files changed, 785 insertions(+), 40 deletions(-)
 create mode 100644 ebpf/qemu-ebpf-rss-helper.c
 create mode 100644 monitor/qemu-ebpf-rss-helper-stamp-utils.c
 create mode 100644 monitor/qemu-ebpf-rss-helper-stamp-utils.h

-- 
2.39.1



^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2023-02-27  4:08 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-13 15:37 [PATCH 0/5] ebpf: Added ebpf helper for libvirtd Andrew Melnychenko
2021-07-13 15:37 ` [PATCH 1/5] ebpf: Added eBPF initialization by fds and map update Andrew Melnychenko
2021-08-20  3:34   ` Jason Wang
2021-08-25 18:13     ` Andrew Melnichenko
2021-07-13 15:37 ` [PATCH 2/5] virtio-net: Added property to load eBPF RSS with fds Andrew Melnychenko
2021-08-20  3:36   ` Jason Wang
2021-08-25 18:18     ` Andrew Melnichenko
2021-07-13 15:37 ` [PATCH 3/5] qmp: Added the helper stamp check Andrew Melnychenko
2021-07-13 15:37 ` [PATCH 4/5] ebpf_rss_helper: Added helper for eBPF RSS Andrew Melnychenko
2021-08-20  3:40   ` Jason Wang
2021-08-25 18:24     ` Andrew Melnichenko
2021-09-01  6:37       ` Jason Wang
2021-08-30 17:07     ` Yuri Benditovich
2021-09-01  6:42       ` Jason Wang
2021-09-06 15:50         ` Andrew Melnichenko
2021-09-07  3:22           ` Jason Wang
2021-09-07 10:40         ` Yuri Benditovich
2021-09-08  3:45           ` Jason Wang
2021-09-09  0:00             ` Yuri Benditovich
2021-09-09  1:16               ` Jason Wang
2021-09-09 23:43                 ` Yuri Benditovich
2021-09-10  1:37                   ` Jason Wang
2021-07-13 15:37 ` [PATCH 5/5] qmp: Added qemu-ebpf-rss-path command Andrew Melnychenko
2021-08-07 12:54   ` Markus Armbruster
2021-08-10 11:58     ` Andrew Melnichenko
2021-08-24  6:41       ` Markus Armbruster
2021-08-25 18:45         ` Andrew Melnichenko
2021-08-26  4:53           ` Markus Armbruster
2021-08-29 20:13         ` Yuri Benditovich
2021-08-30  6:10           ` Markus Armbruster
2021-08-30  7:51             ` Yuri Benditovich
2021-08-30  8:13               ` Markus Armbruster
2021-08-30 16:56                 ` Yuri Benditovich
2021-08-31 15:00                   ` Markus Armbruster
2021-08-31 19:37                     ` Andrew Melnichenko
2021-09-01  7:16                       ` Markus Armbruster
     [not found]                         ` <CABcq3pGzs=RqLCuu70KyWt7W6T=qEhihK6v=iHJyfuGqiN_Q+A@mail.gmail.com>
     [not found]                           ` <CAOEp5Oc_uUn2nJq+B+SK-iQSo5udyUTirWHS5=8N0JxerRaz7A@mail.gmail.com>
2021-09-09 10:35                             ` Andrew Melnichenko
2021-09-02 16:06                   ` Markus Armbruster
2021-07-22  8:37 ` [PATCH 0/5] ebpf: Added ebpf helper for libvirtd Andrew Melnichenko
2021-08-16 11:57   ` Yuri Benditovich
2021-08-17  5:49     ` Jason Wang
2021-08-20  3:43 ` Jason Wang
2023-02-19 16:20 [PATCH 0/5] eBPF RSS Helper support Andrew Melnychenko
2023-02-19 16:20 ` [PATCH 4/5] ebpf_rss_helper: Added helper for eBPF RSS Andrew Melnychenko
2023-02-20  9:54   ` Daniel P. Berrangé
2023-02-27  3:50     ` Andrew Melnichenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.