[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH RFC] EFI: allow retry of ExitBootServices() call



>>> On 14.11.14 at 16:32, <konrad.wilk@xxxxxxxxxx> wrote:
> On Fri, Nov 14, 2014 at 12:37:30PM +0000, Jan Beulich wrote:
>> @@ -1051,17 +1051,23 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
>>      if ( !efi_memmap )
>>          blexit(L"Unable to allocate memory for EFI memory map");
>>  
>> -    status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key,
>> -                                  &efi_mdesc_size, &mdesc_ver);
>> -    if ( EFI_ERROR(status) )
>> -        PrintErrMesg(L"Cannot obtain memory map", status);
>> +    for ( retry = 0; ; retry = 1 )
>> +    {
>> +        status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, 
>> &map_key,
>> +                                      &efi_mdesc_size, &mdesc_ver);
>> +        if ( EFI_ERROR(status) )
>> +            PrintErrMesg(L"Cannot obtain memory map", status);
>>  
>> -    efi_arch_process_memory_map(SystemTable, efi_memmap, efi_memmap_size,
>> -                                efi_mdesc_size, mdesc_ver);
>> +        efi_arch_process_memory_map(SystemTable, efi_memmap, 
>> efi_memmap_size,
>> +                                    efi_mdesc_size, mdesc_ver);
>>  
>> -    efi_arch_pre_exit_boot();
>> +        efi_arch_pre_exit_boot();
>> +
>> +        status = efi_bs->ExitBootServices(ImageHandle, map_key);
>> +        if ( status != EFI_INVALID_PARAMETER || retry )
>> +            break;
>> +    }
> 
> Any reason for just doing the loop at max twice? Could we iterate
> more than those (say forever?) with an printk at suitable intervals
> to notify the user?

For one, there's no reason to do it more than twice. As said in the
patch description, even doing the first retry is already going beyond
what the current specification requires us to do. And just to make
this clear here too - when I first wrote this EFI boot code, I was
aware of the retry being done elsewhere, and I intentionally
decided against doing so as not being mandated by the spec. I'm
continuing to take the position that we shouldn't give firmware
writers more leeway than we absolutely have to, otherwise they
will never get their stuff conform to the spec.

And then, there's no printk() available at this point. And we mustn't
call boot services anymore either. So there's no way to get anything
out to the user.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.