public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi: Allow to enable EFI runtime services with PREEMPT_RT
@ 2022-03-31 14:10 Javier Martinez Canillas
  2022-03-31 14:13 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 5+ messages in thread
From: Javier Martinez Canillas @ 2022-03-31 14:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Peter Jones, Sebastian Andrzej Siewior, Alexander Larsson,
	Al Stone, linux-efi, Ard Biesheuvel, Andrew Halaney,
	linux-rt-users, Brian Masney, Robbie Harwood,
	Javier Martinez Canillas, Thomas Gleixner

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.

Reported-by: Alexander Larsson <alexl@redhat.com>
Fixes: d9f283ae71af ("efi: Disable runtime services on RT")
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---

 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..3c5373de86fc 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 are
+	  an issue for RT.
+
+	  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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] efi: Allow to enable EFI runtime services with PREEMPT_RT
  2022-03-31 14:10 [PATCH] efi: Allow to enable EFI runtime services with PREEMPT_RT Javier Martinez Canillas
@ 2022-03-31 14:13 ` Sebastian Andrzej Siewior
  2022-03-31 14:25   ` Javier Martinez Canillas
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-03-31 14:13 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: linux-kernel, Peter Jones, Alexander Larsson, Al Stone, linux-efi,
	Ard Biesheuvel, Andrew Halaney, linux-rt-users, Brian Masney,
	Robbie Harwood, Thomas Gleixner

On 2022-03-31 16:10:38 [+0200], Javier Martinez Canillas wrote:
> 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.

Is the command line switch
	efi=runtime

not working?

Sebastian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] efi: Allow to enable EFI runtime services with PREEMPT_RT
  2022-03-31 14:13 ` Sebastian Andrzej Siewior
@ 2022-03-31 14:25   ` Javier Martinez Canillas
  2022-03-31 14:40     ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 5+ messages in thread
From: Javier Martinez Canillas @ 2022-03-31 14:25 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, Peter Jones, Alexander Larsson, Al Stone, linux-efi,
	Ard Biesheuvel, Andrew Halaney, linux-rt-users, Brian Masney,
	Robbie Harwood, Thomas Gleixner

Hello Sebastian,

On 3/31/22 16:13, Sebastian Andrzej Siewior wrote:
> On 2022-03-31 16:10:38 [+0200], Javier Martinez Canillas wrote:
>> 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.
> 
> Is the command line switch
> 	efi=runtime
> 
> not 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").

-- 
Best regards,

Javier Martinez Canillas
Linux Engineering
Red Hat


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] efi: Allow to enable EFI runtime services with PREEMPT_RT
  2022-03-31 14:25   ` Javier Martinez Canillas
@ 2022-03-31 14:40     ` Sebastian Andrzej Siewior
  2022-03-31 14:50       ` Javier Martinez Canillas
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-03-31 14:40 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: linux-kernel, Peter Jones, Alexander Larsson, Al Stone, linux-efi,
	Ard Biesheuvel, Andrew Halaney, linux-rt-users, Brian Masney,
	Robbie Harwood, Thomas Gleixner

On 2022-03-31 16:25:40 [+0200], Javier Martinez Canillas wrote:
> Hello Sebastian,
Hi Javier,

> 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.

> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] efi: Allow to enable EFI runtime services with PREEMPT_RT
  2022-03-31 14:40     ` Sebastian Andrzej Siewior
@ 2022-03-31 14:50       ` Javier Martinez Canillas
  0 siblings, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2022-03-31 14:50 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, Peter Jones, Alexander Larsson, Al Stone, linux-efi,
	Ard Biesheuvel, Andrew Halaney, linux-rt-users, Brian Masney,
	Robbie Harwood, Thomas Gleixner

On 3/31/22 16:40, Sebastian Andrzej Siewior wrote:
> On 2022-03-31 16:25:40 [+0200], Javier Martinez Canillas wrote:
>> Hello Sebastian,
> Hi Javier,
> 
>> 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.
 
>> 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.
 
> Sebastian
> 

-- 
Best regards,

Javier Martinez Canillas
Linux Engineering
Red Hat


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-31 14:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-31 14:10 [PATCH] efi: Allow to enable EFI runtime services with PREEMPT_RT Javier Martinez Canillas
2022-03-31 14:13 ` Sebastian Andrzej Siewior
2022-03-31 14:25   ` Javier Martinez Canillas
2022-03-31 14:40     ` Sebastian Andrzej Siewior
2022-03-31 14:50       ` Javier Martinez Canillas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox