RE: [PATCH V5 3/3] efi: Use efi_rts_wq to invoke EFI Runtime Services

From: Prakhya, Sai Praneeth
Date: Tue Jun 05 2018 - 16:15:29 EST


> >> I noticed that -unsurprisingly- reboot no longer works with these changes.
> >>
> >> I will fix up the patch, and revert the efi_reset_system() change,
> >> both here and below.
> >
> > Could you please let me know what the bug is here? I am unable to see
> > it right away :( I have tested reboot on qemu x86_64 by passing
> > "reboot=efi" as command line arg and saw that reboot is working fine.
> >
>
> My arm64 hangs at reboot or power off, unless i revert the ResetSystem() part.
>

That's interesting. Not sure how the behavior could be different between x86 and arm64.
Maybe worth debugging further?
As you said, reverting ResetSystem() part makes things work, we cannot suspect a
buggy efi_reset_system() (I came across buggy efi_reset_system() implementations
on some x86 systems).

> But given that it is both risky (relying on a kthread running a workqueue in the
> shutdown path) and unnecessary (ResetSystem() is not supposed to return, and is
> only called by the kernel when the whole system has already been torn down), I
> think the main reason is simply that there is no reason to add it.

Makes sense.
I think, before calling firmware ResetSystem() kernel has already shut down all other parts
and hence as the control will not transfer back to kernel (other than ResetSystem() failure),
we could safely assume that no kernel code would access user space while in
efi_reset_system() and hence we don't need to take the work queue path.

Regards,
Sai