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

From: Ard Biesheuvel
Date: Tue Jun 05 2018 - 15:55:22 EST


On 5 June 2018 at 21:29, Prakhya, Sai Praneeth
<sai.praneeth.prakhya@xxxxxxxxx> wrote:
>> > + case RESET_SYSTEM:
>> > + __efi_call_virt(reset_system, *(int *)arg1,
>> > + *(efi_status_t *)arg2,
>> > + *(unsigned long *)arg3,
>> > + (efi_char16_t *)arg4);
>> > + break;
>>
>> 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.

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.


>> > @@ -340,7 +441,8 @@ static void virt_efi_reset_system(int reset_type,
>> > "could not get exclusive access to the firmware\n");
>> > return;
>> > }
>> > - __efi_call_virt(reset_system, reset_type, status, data_size, data);
>> > + efi_queue_work(RESET_SYSTEM, &reset_type, &status, &data_size, data,
>> > + NULL);
>> > up(&efi_runtime_lock);
>> > }
>
> Regards,
> Sai