On Thu, 31 Mar 2022 at 17:17, Javier Martinez Canillas
<[email protected]> wrote:
>
> Commit d9f283ae71af ("efi: Disable runtime services on RT") disabled EFI
> runtime services by default when the CONFIG_PREEMPT_RT option is enabled.
>
> The rationale for that commit is that some EFI calls could take too much
> time, leading to large latencies which is an issue for Real-Time kernels.
>
> But a side effect of that change was that now is not possible anymore to
> enable the EFI runtime services by default when CONFIG_PREEMPT_RT is set,
> without passing an efi=runtime command line parameter to the kernel.
>
> Instead, let's add a new EFI_DISABLE_RUNTIME boolean Kconfig option, that
> would be set to n by default but to y if CONFIG_PREEMPT_RT is enabled.
>
> That way, the current behaviour is preserved but gives users a mechanism
> to enable the EFI runtimes services in their kernels if that is required.
> For example, if the firmware could guarantee bounded time for EFI calls.
>
> Also, having a separate boolean config could allow users to disable the
> EFI runtime services by default even when CONFIG_PREEMPT_RT is not set.
>
> Reported-by: Alexander Larsson <[email protected]>
> Fixes: d9f283ae71af ("efi: Disable runtime services on RT")
> Signed-off-by: Javier Martinez Canillas <[email protected]>
> ---
>
> Changes in v2:
> - Improve commit description to make clear the motivation for the change
> (Sebastian Andrzej Siewior).
>
This looks ok to me. I'll queue this up once the merge window closes.
> drivers/firmware/efi/Kconfig | 15 +++++++++++++++
> drivers/firmware/efi/efi.c | 2 +-
> 2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
> index 2c3dac5ecb36..243882f5e5f9 100644
> --- a/drivers/firmware/efi/Kconfig
> +++ b/drivers/firmware/efi/Kconfig
> @@ -284,3 +284,18 @@ config EFI_CUSTOM_SSDT_OVERLAYS
>
> See Documentation/admin-guide/acpi/ssdt-overlays.rst for more
> information.
> +
> +config EFI_DISABLE_RUNTIME
> + bool "Disable EFI runtime services support by default"
> + default y if PREEMPT_RT
> + help
> + Allow to disable the EFI runtime services support by default. This can
> + already be achieved by using the efi=noruntime option, but it could be
> + useful to have this default without any kernel command line parameter.
> +
> + The EFI runtime services are disabled by default when PREEMPT_RT is
> + enabled, because measurements have shown that some EFI functions calls
> + might take too much time to complete, causing large latencies which is
> + an issue for Real-Time kernels.
> +
> + This default can be overridden by using the efi=runtime option.
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 5502e176d51b..ff57db8f8d05 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -66,7 +66,7 @@ struct mm_struct efi_mm = {
>
> struct workqueue_struct *efi_rts_wq;
>
> -static bool disable_runtime = IS_ENABLED(CONFIG_PREEMPT_RT);
> +static bool disable_runtime = IS_ENABLED(CONFIG_EFI_DISABLE_RUNTIME);
> static int __init setup_noefi(char *arg)
> {
> disable_runtime = true;
> --
> 2.35.1
>
Hi Ard, Javier,
Am Do, Mar 31, 2022, schrieb Ard Biesheuvel:
> On Thu, 31 Mar 2022 at 17:17, Javier Martinez Canillas
> <[email protected]> wrote:
> >
> > Commit d9f283ae71af ("efi: Disable runtime services on RT") disabled EFI
> > runtime services by default when the CONFIG_PREEMPT_RT option is enabled.
> >
> > The rationale for that commit is that some EFI calls could take too much
> > time, leading to large latencies which is an issue for Real-Time kernels.
> >
> > But a side effect of that change was that now is not possible anymore to
> > enable the EFI runtime services by default when CONFIG_PREEMPT_RT is set,
> > without passing an efi=runtime command line parameter to the kernel.
> >
> > Instead, let's add a new EFI_DISABLE_RUNTIME boolean Kconfig option, that
> > would be set to n by default but to y if CONFIG_PREEMPT_RT is enabled.
> >
> > That way, the current behaviour is preserved but gives users a mechanism
> > to enable the EFI runtimes services in their kernels if that is required.
> > For example, if the firmware could guarantee bounded time for EFI calls.
> >
> > Also, having a separate boolean config could allow users to disable the
> > EFI runtime services by default even when CONFIG_PREEMPT_RT is not set.
> >
> > Reported-by: Alexander Larsson <[email protected]>
> > Fixes: d9f283ae71af ("efi: Disable runtime services on RT")
> > Signed-off-by: Javier Martinez Canillas <[email protected]>
> > ---
> >
> > Changes in v2:
> > - Improve commit description to make clear the motivation for the change
> > (Sebastian Andrzej Siewior).
> >
>
> This looks ok to me. I'll queue this up once the merge window closes.
>
In case of (CONFIG_PREEMPT_RT=y && CONFIG_EFI_DISABLE_RUNTIME=n),
shouldn't we add a small message in the kernel log warning that EFI
runtime services are enabled for the RT kernel?
In almost all HW, except custom ones with "verified" firmware, such a
warning would be useful... This is especially true since in the embedded
domain, manually-configured RT kernels are almost always the norm.
Thanks,
--
Ahmed S. Darwish
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-M?hlhofen
Phone: +49 7556 25 999 31; Fax.: +49 7556 25 999 99
Hinweise zum Datenschutz finden Sie hier (Informations on data privacy
can be found here): https://linutronix.de/kontakt/Datenschutz.php
Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-M?hlhofen |
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700
806 | Gesch?ftsf?hrer (Managing Directors): Heinz Egger, Thomas Gleixner