[libvirt PATCH v2 2/3] build: Add userfaultfd_sysctl build option

Jiri Denemark posted 3 patches 1 year, 8 months ago
[libvirt PATCH v2 2/3] build: Add userfaultfd_sysctl build option
Posted by Jiri Denemark 1 year, 8 months ago
This option controls whether the sysctl config for enabling unprivileged
userfaultfd will be installed.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 meson.build          | 8 ++++++++
 meson_options.txt    | 1 +
 src/qemu/meson.build | 2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index e1c70fce92..dbd9cad6df 100644
--- a/meson.build
+++ b/meson.build
@@ -2019,6 +2019,12 @@ elif get_option('sysctl_config').enabled()
   error('sysctl configuration is supported only on linux')
 endif
 
+if not get_option('userfaultfd_sysctl').disabled() and conf.has('WITH_SYSCTL')
+  conf.set('WITH_USERFAULTFD_SYSCTL', 1)
+elif get_option('userfaultfd_sysctl').enabled()
+  error('userfaultfd_sysctl option requires sysctl_config to be enabled')
+endif
+
 conf.set_quoted('TLS_PRIORITY', get_option('tls_priority'))
 
 
@@ -2318,6 +2324,8 @@ misc_summary = {
   'virt-login-shell': conf.has('WITH_LOGIN_SHELL'),
   'virt-host-validate': conf.has('WITH_HOST_VALIDATE'),
   'TLS priority': conf.get_unquoted('TLS_PRIORITY'),
+  'sysctl config': conf.has('WITH_SYSCTL'),
+  'userfaultfd sysctl': conf.has('WITH_USERFAULTFD_SYSCTL'),
 }
 summary(misc_summary, section: 'Miscellaneous', bool_yn: true, list_sep: ' ')
 
diff --git a/meson_options.txt b/meson_options.txt
index 182e28b3d1..ed91d97abf 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -108,4 +108,5 @@ option('nbdkit', type: 'feature', value: 'auto', description: 'Build nbdkit stor
 option('nbdkit_config_default', type: 'feature', value: 'auto', description: 'Whether to use nbdkit storage backend for network disks by default (configurable)')
 option('pm_utils', type: 'feature', value: 'auto', description: 'use pm-utils for power management')
 option('sysctl_config', type: 'feature', value: 'auto', description: 'Whether to install sysctl configs')
+option('userfaultfd_sysctl', type: 'feature', value: 'auto', description: 'Whether to install sysctl config for enabling unprivileged userfaultfd')
 option('tls_priority', type: 'string', value: 'NORMAL', description: 'set the default TLS session priority string')
diff --git a/src/qemu/meson.build b/src/qemu/meson.build
index 4c3e1dee78..faea656502 100644
--- a/src/qemu/meson.build
+++ b/src/qemu/meson.build
@@ -202,7 +202,7 @@ if conf.has('WITH_QEMU')
     'in_file': files('virtqemud.init.in'),
   }
 
-  if conf.has('WITH_SYSCTL')
+  if conf.has('WITH_USERFAULTFD_SYSCTL')
     install_data(
       'postcopy-migration.sysctl',
       install_dir: prefix / 'lib' / 'sysctl.d',
-- 
2.43.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [libvirt PATCH v2 2/3] build: Add userfaultfd_sysctl build option
Posted by Jiri Denemark 1 year, 8 months ago
On Tue, Feb 13, 2024 at 11:39:26 +0100, Jiri Denemark wrote:
> This option controls whether the sysctl config for enabling unprivileged
> userfaultfd will be installed.
> 
> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> ---
>  meson.build          | 8 ++++++++
>  meson_options.txt    | 1 +
>  src/qemu/meson.build | 2 +-
>  3 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index e1c70fce92..dbd9cad6df 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2019,6 +2019,12 @@ elif get_option('sysctl_config').enabled()
>    error('sysctl configuration is supported only on linux')
>  endif
>  
> +if not get_option('userfaultfd_sysctl').disabled() and conf.has('WITH_SYSCTL')
> +  conf.set('WITH_USERFAULTFD_SYSCTL', 1)
> +elif get_option('userfaultfd_sysctl').enabled()
> +  error('userfaultfd_sysctl option requires sysctl_config to be enabled')
> +endif
> +
>  conf.set_quoted('TLS_PRIORITY', get_option('tls_priority'))
>  
>  
> @@ -2318,6 +2324,8 @@ misc_summary = {
>    'virt-login-shell': conf.has('WITH_LOGIN_SHELL'),
>    'virt-host-validate': conf.has('WITH_HOST_VALIDATE'),
>    'TLS priority': conf.get_unquoted('TLS_PRIORITY'),
> +  'sysctl config': conf.has('WITH_SYSCTL'),
> +  'userfaultfd sysctl': conf.has('WITH_USERFAULTFD_SYSCTL'),
>  }
>  summary(misc_summary, section: 'Miscellaneous', bool_yn: true, list_sep: ' ')
>  
> diff --git a/meson_options.txt b/meson_options.txt
> index 182e28b3d1..ed91d97abf 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -108,4 +108,5 @@ option('nbdkit', type: 'feature', value: 'auto', description: 'Build nbdkit stor
>  option('nbdkit_config_default', type: 'feature', value: 'auto', description: 'Whether to use nbdkit storage backend for network disks by default (configurable)')
>  option('pm_utils', type: 'feature', value: 'auto', description: 'use pm-utils for power management')
>  option('sysctl_config', type: 'feature', value: 'auto', description: 'Whether to install sysctl configs')
> +option('userfaultfd_sysctl', type: 'feature', value: 'auto', description: 'Whether to install sysctl config for enabling unprivileged userfaultfd')
>  option('tls_priority', type: 'string', value: 'NORMAL', description: 'set the default TLS session priority string')

So this change apparently broke mingw build on Fedora:

    ERROR: Problem encountered: userfaultfd_sysctl option requires sysctl_config to be enabled

The mingw part of libvirt.spec runs meson setup with
-Dsysctl_config=disabled and does not specify -Duserfaultfd_sysctl at
all, which I would expect means the same as -Duserfaultfd_sysctl=auto.
But according to the error message it looks like userfaultfd_sysctl was
actually enabled.

I didn't explicitly test mingw builds, but I tested running meson setup
with all combinations, especially with -Dsysctl_config=disabled and not
specifying userfaultfd_sysctl option at all and it worked as expected:

    sysctl config      : NO
    userfaultfd sysctl : NO

Sure, I can easily fix this by passing -Duserfaultfd_sysctl=disable
for mingw builds, but I'm wondering why the build doesn't work with just
-Dsysctl_config=disabled?

Jirka
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [libvirt PATCH v2 2/3] build: Add userfaultfd_sysctl build option
Posted by Jiri Denemark 1 year, 8 months ago
On Tue, Feb 13, 2024 at 18:48:59 +0100, Jiri Denemark wrote:
> On Tue, Feb 13, 2024 at 11:39:26 +0100, Jiri Denemark wrote:
> > This option controls whether the sysctl config for enabling unprivileged
> > userfaultfd will be installed.
> > 
> > Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> > ---
> >  meson.build          | 8 ++++++++
> >  meson_options.txt    | 1 +
> >  src/qemu/meson.build | 2 +-
> >  3 files changed, 10 insertions(+), 1 deletion(-)
> > 
> > diff --git a/meson.build b/meson.build
> > index e1c70fce92..dbd9cad6df 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -2019,6 +2019,12 @@ elif get_option('sysctl_config').enabled()
> >    error('sysctl configuration is supported only on linux')
> >  endif
> >  
> > +if not get_option('userfaultfd_sysctl').disabled() and conf.has('WITH_SYSCTL')
> > +  conf.set('WITH_USERFAULTFD_SYSCTL', 1)
> > +elif get_option('userfaultfd_sysctl').enabled()
> > +  error('userfaultfd_sysctl option requires sysctl_config to be enabled')
> > +endif
> > +
> >  conf.set_quoted('TLS_PRIORITY', get_option('tls_priority'))
> >  
> >  
> > @@ -2318,6 +2324,8 @@ misc_summary = {
> >    'virt-login-shell': conf.has('WITH_LOGIN_SHELL'),
> >    'virt-host-validate': conf.has('WITH_HOST_VALIDATE'),
> >    'TLS priority': conf.get_unquoted('TLS_PRIORITY'),
> > +  'sysctl config': conf.has('WITH_SYSCTL'),
> > +  'userfaultfd sysctl': conf.has('WITH_USERFAULTFD_SYSCTL'),
> >  }
> >  summary(misc_summary, section: 'Miscellaneous', bool_yn: true, list_sep: ' ')
> >  
> > diff --git a/meson_options.txt b/meson_options.txt
> > index 182e28b3d1..ed91d97abf 100644
> > --- a/meson_options.txt
> > +++ b/meson_options.txt
> > @@ -108,4 +108,5 @@ option('nbdkit', type: 'feature', value: 'auto', description: 'Build nbdkit stor
> >  option('nbdkit_config_default', type: 'feature', value: 'auto', description: 'Whether to use nbdkit storage backend for network disks by default (configurable)')
> >  option('pm_utils', type: 'feature', value: 'auto', description: 'use pm-utils for power management')
> >  option('sysctl_config', type: 'feature', value: 'auto', description: 'Whether to install sysctl configs')
> > +option('userfaultfd_sysctl', type: 'feature', value: 'auto', description: 'Whether to install sysctl config for enabling unprivileged userfaultfd')
> >  option('tls_priority', type: 'string', value: 'NORMAL', description: 'set the default TLS session priority string')
> 
> So this change apparently broke mingw build on Fedora:
> 
>     ERROR: Problem encountered: userfaultfd_sysctl option requires sysctl_config to be enabled
> 
> The mingw part of libvirt.spec runs meson setup with
> -Dsysctl_config=disabled and does not specify -Duserfaultfd_sysctl at
> all, which I would expect means the same as -Duserfaultfd_sysctl=auto.
> But according to the error message it looks like userfaultfd_sysctl was
> actually enabled.
> 
> I didn't explicitly test mingw builds, but I tested running meson setup
> with all combinations, especially with -Dsysctl_config=disabled and not
> specifying userfaultfd_sysctl option at all and it worked as expected:
> 
>     sysctl config      : NO
>     userfaultfd sysctl : NO
> 
> Sure, I can easily fix this by passing -Duserfaultfd_sysctl=disable
> for mingw builds, but I'm wondering why the build doesn't work with just
> -Dsysctl_config=disabled?

Oh I see, the %meson* RPM macros explicitly enable all auto features
using --auto-features=enabled.

Jirka
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [libvirt PATCH v2 2/3] build: Add userfaultfd_sysctl build option
Posted by Ján Tomko 1 year, 8 months ago
On a Tuesday in 2024, Jiri Denemark wrote:
>On Tue, Feb 13, 2024 at 18:48:59 +0100, Jiri Denemark wrote:
>> I didn't explicitly test mingw builds, but I tested running meson setup
>> with all combinations, especially with -Dsysctl_config=disabled and not
>> specifying userfaultfd_sysctl option at all and it worked as expected:
>>
>>     sysctl config      : NO
>>     userfaultfd sysctl : NO
>>
>> Sure, I can easily fix this by passing -Duserfaultfd_sysctl=disable
>> for mingw builds, but I'm wondering why the build doesn't work with just
>> -Dsysctl_config=disabled?
>
>Oh I see, the %meson* RPM macros explicitly enable all auto features
>using --auto-features=enabled.
>

That is true for %meson, but it does not seem to be for %mingw_meson
where we add --auto-features=enabled to its invocation.

Jano

>Jirka
>_______________________________________________
>Devel mailing list -- devel@lists.libvirt.org
>To unsubscribe send an email to devel-leave@lists.libvirt.org
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org