All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Melnichenko <andrew@daynix.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	qemu-devel@nongnu.org,
	"Yuri Benditovich" <yuri.benditovich@daynix.com>,
	"Yan Vugenfirer" <yan@daynix.com>,
	"Eric Blake" <eblake@redhat.com>
Subject: Re: [PATCH 5/5] qmp: Added qemu-ebpf-rss-path command.
Date: Thu, 9 Sep 2021 13:35:08 +0300	[thread overview]
Message-ID: <CABcq3pF4P50=Rv8J9M4_Gm-bG7ntP+8f5KkjkEz3TTZAXa6RBw@mail.gmail.com> (raw)
In-Reply-To: <CAOEp5Oc_uUn2nJq+B+SK-iQSo5udyUTirWHS5=8N0JxerRaz7A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3363 bytes --]

Hi,

> Ther first two are bogus.  /work/armbru/tmp/inst-qemu/... is where "make
> install" would put things.  I last ran "make install" almost three
> months ago.
>
The stamp check is implemented only for the RSS helper. Qemu looks for a
helper first in HelpDir, then next to the binary.
Bridge/PR helpers found in "inst-qemu" according to build configuration.
To be more strict, for the next patch we may return only ebpf helper in the
list. Other helpers may be added later with stamp check.

 It's still unreliable in the sense of "may not
> find the helper"
>
Ok, I see the problem.
Here I can propose possible solutions:

   1. Add the argument to QMP request - the path(s) where the qemu should
   look for helper by priority: argument path, installation dir, qemu's dir.
   And return an array of all possible helpers binaries.
   2. Retrieve the stamp from QMP request, so Libvirt may check the stamp
   by itself.
   3. Set suid bit to helper and pass the helper's path to the qemu, so
   qemu may run it by itself.

Searching the ELF symbol table requires ELF.  I suspect your meson.build
> doesn't reflect that.
>

>
It also requires the symbol table to be present.  Statically linked
> programs don't have one, if I remember correctly.
>

Well, qemu-ebpf-rss-helper is only for Linux and expectations are to have
ELF binaries.
The helper builds dynamically linked with libbpf.so at least.

Management applications run qemu-system-FOO and helpers.  They know
> where to find qemu-system-FOO.  It stands to reason that they also know
> where to find the matching helpers.  I fail to see why they need help
> from qemu-system-FOO via QMP.  Even if they need help, qemu-system-FOO
> can't give it, because it cannot know for sure.  It is wherever the
> system administrator / distro put it.
>

We may have several different qemu builds which may require different rss
helpers.
Domain with a custom emulator:

>
> *  <devices>
> <emulator>/path_to_my_awesome_qemu_with_custom_bpf/qemu-system-FOO</emulator>
> *
>
Libvirt would gather properties of that qemu and we need to provide the
proper helper for it.
The "default" helper from libvirt configure may not suit the qemu.
So the idea is to ask the qemu itself where is a possible helper.
So Libvirt may use only <emulator> without additional changes in XML
document.

So we need to solve next cases:


   - System admin or distributor places the qemu and helpers in InstallPath.
   Libvirt uses installed qemu and helpers. No hints from qemu are required.
   - Libvirt uses custom qemu <emulator>. Libvirt doesn't know where is the
   helper
   that was built with custom qemu. Qemu if finds the helper - verifies the
   stamp, to make sure.
   - Custom-built qemu is installed in the configured path(proper prefix
   etc.). Libvirt may
   use that emulator but don't know where is the helper - qemu knows and
   may provide a hint.


There are much easier ways for that than searching through ELF symbol
> tables.  Have a command line option to print it.  For qemu-system-FOO,
> you can also have a QMP command to query it.
>
The stamp was added in a similar way as qemu modules(special symbol,
checked during load).
Also, checking the stamp without running is a good security measure.

I get a few warnings.  I'm copying the ones from Clang:
>
Thank you, I'll fix them in v2 patches with rebased tree.

[-- Attachment #2: Type: text/html, Size: 5495 bytes --]

  parent reply	other threads:[~2021-09-09 10:40 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABcq3pF4P50=Rv8J9M4_Gm-bG7ntP+8f5KkjkEz3TTZAXa6RBw@mail.gmail.com' \
    --to=andrew@daynix.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yan@daynix.com \
    --cc=yuri.benditovich@daynix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.