Re: [PATCH RT] rtc: Disable RTC_DRV_EFI on RT
From: Ard Biesheuvel
Date: Thu Jul 26 2018 - 12:01:57 EST
On 26 July 2018 at 15:14, Sebastian Andrzej Siewior
<bigeasy@xxxxxxxxxxxxx> wrote:
> On 2018-07-26 15:13:23 [+0200], To Ard Biesheuvel wrote:
>> On 2018-07-26 14:52:21 [+0200], Ard Biesheuvel wrote:
>> > We could also make it the default on -rt, but not disable it entirely, so that efi=runtime can be used to re-enable it.
>>
>> Oh. I like that. We have something similar for RCU. So I would need
>> that:
> and then I could make it default off:
>
> ----- >8
>
> Subject: [PATCH] efi: Disable runtime services on RT
>
> Based on meassurements the EFI functions get_variable /
> get_next_variable take up to 2us which looks okay.
> The functions get_time, set_time take around 10ms. Those 10ms are too
> much. Even one ms would be too much.
> Ard mentioned that SetVariable might even trigger larger latencies if
> the firware will erase flash blocks on NOR.
>
> The time-functions are used by efi-rtc and can be triggered during
> runtimed (either via explicit read/write or ntp sync).
>
> The variable write could be used by pstore.
> These functions can be disabled without much of a loss. The poweroff /
> reboot hooks may be provided by PSCI.
>
> Disable EFI's runtime wrappers.
>
> This was observed on "EFI v2.60 by SoftIron Overdrive 1000".
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> ---
> drivers/firmware/efi/efi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 232f4915223b..62c6e4b6ce3e 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -84,7 +84,7 @@ struct mm_struct efi_mm = {
> .mmlist = LIST_HEAD_INIT(efi_mm.mmlist),
> };
>
> -static bool disable_runtime;
> +static bool disable_runtime = IS_ENABLED(CONFIG_PREEMPT_RT_BASE);
> static int __init setup_noefi(char *arg)
> {
> disable_runtime = true;
> --
> 2.18.0
>
Yes, that's what I was thinking. This way, you can still reboot into
the same kernel occasionally with EFI runtime services enabled to,
e.g., use efibootmgr.
Acked-by: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>
for both patches if you queue them in the -rt tree. If you want them
in mainline, please resend them as proper patches once
CONFIG_PREEMPT_RT_BASE has been declared in mainline as well.