[RFC PATCH v3 5/6] qemu_conf: Added configuration to optionally disable eBPF loading.

Andrew Melnychenko posted 6 patches 6 months, 2 weeks ago
There is a newer version of this series
[RFC PATCH v3 5/6] qemu_conf: Added configuration to optionally disable eBPF loading.
Posted by Andrew Melnychenko 6 months, 2 weeks ago
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 <andrew@daynix.com>
---
 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);
 
-    qemuOpenEbpfRssFds(net, qemuCaps);
-    for (n = netpriv->ebpfrssfds; n; n = n->next)
-        qemuFDPassDirectTransferCommand(n->data, cmd);
+    if (cfg->allowEBPF) {
+        qemuOpenEbpfRssFds(net, qemuCaps);
+        for (n = netpriv->ebpfrssfds; n; n = n->next)
+            qemuFDPassDirectTransferCommand(n->data, cmd);
+    }
 
     if (!(hostnetprops = 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 privileged,
     cfg->deprecationBehavior = g_strdup("none");
     cfg->storageUseNbdkit = USE_NBDKIT_DEFAULT;
 
+    cfg->allowEBPF = true;
+
     return g_steal_pointer(&cfg);
 }
 
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;
 
     virQEMUSchedCore schedCore;
+
+    bool allowEBPF;
 };
 
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virQEMUDriverConfig, virObjectUnref);
-- 
2.44.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [RFC PATCH v3 5/6] qemu_conf: Added configuration to optionally disable eBPF loading.
Posted by Michal Prívozník 6 months, 1 week ago
On 5/12/24 21:45, Andrew Melnychenko wrote:
> 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 <andrew@daynix.com>
> ---
>  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);
>  
> -    qemuOpenEbpfRssFds(net, qemuCaps);
> -    for (n = netpriv->ebpfrssfds; n; n = n->next)
> -        qemuFDPassDirectTransferCommand(n->data, cmd);
> +    if (cfg->allowEBPF) {
> +        qemuOpenEbpfRssFds(net, qemuCaps);
> +        for (n = netpriv->ebpfrssfds; n; n = n->next)
> +            qemuFDPassDirectTransferCommand(n->data, cmd);
> +    }
>  
>      if (!(hostnetprops = 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 privileged,
>      cfg->deprecationBehavior = g_strdup("none");
>      cfg->storageUseNbdkit = USE_NBDKIT_DEFAULT;
>  
> +    cfg->allowEBPF = true;
> +
>      return g_steal_pointer(&cfg);
>  }
>  
> 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;
>  
>      virQEMUSchedCore schedCore;
> +
> +    bool allowEBPF;
>  };

This structure should reflect knobs that are tunable in qemu.conf. If
you need a temporary change of behaviour just for tests we use env vars
for that.

Michal
Re: [RFC PATCH v3 5/6] qemu_conf: Added configuration to optionally disable eBPF loading.
Posted by Andrew Melnichenko 6 months ago
Hi all,

On Fri, May 17, 2024 at 5:00 PM Michal Prívozník <mprivozn@redhat.com> wrote:
>
> On 5/12/24 21:45, Andrew Melnychenko wrote:
> > 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 <andrew@daynix.com>
> > ---
> >  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);
> >
> > -    qemuOpenEbpfRssFds(net, qemuCaps);
> > -    for (n = netpriv->ebpfrssfds; n; n = n->next)
> > -        qemuFDPassDirectTransferCommand(n->data, cmd);
> > +    if (cfg->allowEBPF) {
> > +        qemuOpenEbpfRssFds(net, qemuCaps);
> > +        for (n = netpriv->ebpfrssfds; n; n = n->next)
> > +            qemuFDPassDirectTransferCommand(n->data, cmd);
> > +    }
> >
> >      if (!(hostnetprops = 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 privileged,
> >      cfg->deprecationBehavior = g_strdup("none");
> >      cfg->storageUseNbdkit = USE_NBDKIT_DEFAULT;
> >
> > +    cfg->allowEBPF = true;
> > +
> >      return g_steal_pointer(&cfg);
> >  }
> >
> > 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;
> >
> >      virQEMUSchedCore schedCore;
> > +
> > +    bool allowEBPF;
> >  };
>
> This structure should reflect knobs that are tunable in qemu.conf. If
> you need a temporary change of behaviour just for tests we use env vars
> for that.

Yes, I need it only for tests. I'll work on it in the next version of patches.


>
> Michal
>