efi: Allow to enable EFI runtime services with PREEMPT_RT
PATCH 1/1 efi: Allow to enable EFI runtime services with PREEMPT_RT
Commit d9f283ae71af ("efi: Disable runtime services on RT") disabled EFI runtime services when the CONFIG_PREEMPT_RT option is enabled.
The rationale for the change is that some EFI calls could take too much time, leading to large latencies which are an issue for RT kernels.
But a side effect of that commit is that now is not possible anymore to enable the EFI runtime services by default when CONFIG_PREEMPT_RT is set to y, even for platforms that could guarantee bounded time for EFI calls.
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.
---
drivers/firmware/efi/Kconfig | 15 +++++++++++++++ drivers/firmware/efi/efi.c | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-)
drivers/firmware/efi/Kconfig +15 -0
@@ -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 are + an issue for RT. + + This default can be overridden by using the efi=runtime option.
drivers/firmware/efi/efi.c +1 -1
@@ -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;
Signature · 1 line
2.35.1
Quoted 10 lines · Javier Martinez Canillas
Commit
d9f283ae71af("efi: Disable runtime services on RT") disabled EFI runtime services when theCONFIG_PREEMPT_RToption is enabled.The rationale for the change is that some EFI calls could take too much time, leading to large latencies which are an issue for RT kernels.
But a side effect of that commit is that now is not possible anymore to enable the EFI runtime services by default when
CONFIG_PREEMPT_RTis set to y, even for platforms that could guarantee bounded time for EFI calls.
Quoted 5 lines
Instead, let's add a new
EFI_DISABLE_RUNTIMEbooleanKconfigoption, that would be set to n by default but to y ifCONFIG_PREEMPT_RTis 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.
Is the command line switch
efi=runtime
not working?
Sebastian
Hello Sebastian,
Quoted 14 lines · Sebastian Andrzej Siewior
Quoted 13 lines · Javier Martinez Canillas
Commit
d9f283ae71af("efi: Disable runtime services on RT") disabled EFI runtime services when theCONFIG_PREEMPT_RToption is enabled.The rationale for the change is that some EFI calls could take too much time, leading to large latencies which are an issue for RT kernels.
But a side effect of that commit is that now is not possible anymore to enable the EFI runtime services by default when
CONFIG_PREEMPT_RTis set to y, even for platforms that could guarantee bounded time for EFI calls.Instead, let's add a new
EFI_DISABLE_RUNTIMEbooleanKconfigoption, that would be set to n by default but to y ifCONFIG_PREEMPT_RTis enabled.
Quoted 8 lines
Quoted 2 lines
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.
Is the command line switch
efi=runtimenot working?
Yes, it is but the motivation is to be able to have EFI runtime services by default without the need for any kernel command line parameter.
In the same vein, I could ask if efi=noruntime wasn't enough instead of commit ("efi: Disable runtime services on RT").
Signature · 5 lines
Best regards, Javier Martinez Canillas Linux Engineering Red Hat
Quoted 1 line · Javier Martinez Canillas
Hello Sebastian,
Hi Javier,
Quoted 2 lines
Yes, it is but the motivation is to be able to have EFI runtime services by default without the need for any kernel command line parameter.
This part wasn't clear. It is not mentioned by the description but now that I look at Kconfig, it is there.
Quoted 2 lines
In the same vein, I could ask if efi=noruntime wasn't enough instead of commit ("efi: Disable runtime services on RT").
No, it is not because it should not lead to any surprise latencies by default.
Sebastian
Quoted 10 lines · Sebastian Andrzej Siewior
Quoted 1 line · Javier Martinez Canillas
Hello Sebastian,
Hi Javier,
Quoted 2 lines
Yes, it is but the motivation is to be able to have EFI runtime services by default without the need for any kernel command line parameter.
This part wasn't clear. It is not mentioned by the description but now that I look at
Kconfig, it is there.
Sure, I can post a v2 with better wording in the description to make it clear.
Quoted 6 lines
Quoted 2 lines
In the same vein, I could ask if efi=noruntime wasn't enough instead of commit ("efi: Disable runtime services on RT").
No, it is not because it should not lead to any surprise latencies by default.
Yes, it was a rhetorical question. I understand the motivation of that commit and agree with it. That's why $SUBJECT doesn't change the current behaviour, and the EFI runtime services will still be disabled by default for RT.
It's just to allow a way to enable for RT users that may want to. But having a separate boolean symbol also allow non RT users to disable it by default.
Quoted 2 lines
Sebastian
Signature · 5 lines
Best regards, Javier Martinez Canillas Linux Engineering Red Hat