Re: [PATCH v2] efivarfs: add nostatfs mount option to skip QueryVariableInfo()
From: Ard Biesheuvel
Date: Thu Sep 24 2026 - 07:18:05 EST
On Thu, 24 Sep 2026, at 13:05, Luis Claudio R. Goncalves wrote:
> On Fri, Sep 18, 2026 at 09:41:24PM -0700, Prashant Singh wrote:
>> QueryVariableInfo() is an EFI runtime service that, on some firmware,
>> takes tens of milliseconds and runs with preemption disabled, stalling
>> the CPU that services it. efivarfs_statfs() calls it (rate-limited since
>> commit b2326338dc68 ("efivarfs: Rate limit statfs() handler")) to report
>> the variable-store used/available capacity, so any statfs(2) -- e.g.
>> every "df" -- can inject that stall into unrelated latency-sensitive
>> workloads on the same CPU.
>>
>> Add a "nostatfs" mount option: when set, statfs(2) skips
>> QueryVariableInfo() entirely and reports zero used/available. It is set
>> by default on CONFIG_PREEMPT_RT so real-time kernels do not take the
>> stall out of the box.
>
> I tested the patch and was quite satisfied with the results, but upon a
> comment from colleagues I ran a few more tests and noticed (confirmed their
> hunch) that fwupd complains about not being able to get the free space in
> efivars:
>
> # fwupdmgr get-devices | grep efivars
> │ Update Error: getting efivars free space is not supported
> │ │ Update Error: getting efivars free space is not supported
> ...
>
> I was not able to establish whether that would prevent specific operations
> due to the HW I had available for such test.
>
We might have to teach fwupdmgr to check the efivarfs mount flags and remount
it if it requires this information. We should check whether that is possible
with the current version of the patch.
> One idea that I have been musing over is whether or not it would be interesting
> to create a static view of the efivars statfs data when first mounting it
> and updating this data whenever efivars is modified (create/write/delete).
> Does that sound reasonable?
>
efivarfs is not the only component setting EFI variables. You would also have to
hook every caller of efivar_set_variable() as well as efi.set_variable().