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

Re: [PATCH] Use EfiACPIReclaimMemory for ESRT


  • To: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 4 Oct 2022 10:31:25 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=67hzZqxB4QTGLBeIr51HNNernqc0uOlWH5XYOthjQQA=; b=Mx89XbPAmPqycHCh9CthBlZVz6rj7t+tcn70YfBz1MGj6lBRq5T/ec3Lsy1kW4/RoNoqyEDNjU/q3YvJ7Myjh4YHubNoqY/ZPpPkaI7ExcqoAn2HK7wV8LCf0BhSu/CCtphoyhwPY1F5H4fRiEZqU3bHvBJRUgHokRoUK1u23qa0T/TS0mj/q95OyLo15/+zT7MvmKgef7MJqi3o7jF+++SGfV1dlzzefvvHXx6IRukoC1TZGatFOQsP/xT/1nNneaA8cKGabnWsk4Of17utARyPVVQUXMKTPWJEIsQpTJAvr8gNQMKV80gdXEJcKebOLJeAqbQ6OxJzks/96fEwPw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ngoAp4Iy9k4+5EKft1lzmJ2oDYl9W6MgP64XykLi60zdILPcH+kzHYNZdgjhPcbmAhe7ekRGd5wBoH59K/80bYsZlGPg0HAiFe7+xhXc2m9A+RTo3tXpgUk8fIWgAr58g62olJ/+1vjLkY/VWLGgZ9Ggkgvcw2J2eZZBHLTMeLQCAYDWYgztvJ4LFluKhuiSubRq923ILJX3kN9cGbP3D8yhcmEJkJzMNq5JvUKXVk5C/f9+jYsHCco+gn3GdaVDreyG0N3F6nmoxEIsegTzs+nz7qfjumbFqOt/VZiGC3WduGLlIiej+ZRN/0uNJ/Zy5g1y7lysJxyw9ojG0QS0ug==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 04 Oct 2022 08:31:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 30.09.2022 23:02, Demi Marie Obenour wrote:
> As discussed on xen-devel, using EfiRuntimeServicesData for more than is
> absolutely necessary is a bad idea.
> ---
>  xen/common/efi/boot.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
> index 
> db0340c8e2628314226c618dda11ede4c62fdf3b..dba23439758d1e842d267dcd19448e0f9113b115
>  100644
> --- a/xen/common/efi/boot.c
> +++ b/xen/common/efi/boot.c
> @@ -601,11 +601,13 @@ static size_t __init get_esrt_size(const 
> EFI_MEMORY_DESCRIPTOR *desc)
>      if ( physical_start > esrt || esrt - physical_start >= len )
>          return 0;
>      /*
> -     * The specification requires EfiBootServicesData, but accept
> -     * EfiRuntimeServicesData, which is a more logical choice.
> +     * The specification requires EfiBootServicesData, but also accept
> +     * EfiRuntimeServicesData (for compatibility) and EfiACPIReclaimMemory
> +     * (which will contain the tables after successful kexec).

What's the compatibility concern here? We haven't released any Xen
version yet where the table would be moved to EfiRuntimeServicesData.

Jan

>       */
>      if ( (desc->Type != EfiRuntimeServicesData) &&
> -         (desc->Type != EfiBootServicesData) )
> +         (desc->Type != EfiBootServicesData) &&
> +         (desc->Type != EfiACPIReclaimMemory) )
>          return 0;
>      available_len = len - (esrt - physical_start);
>      if ( available_len <= offsetof(EFI_SYSTEM_RESOURCE_TABLE, Entries) )
> @@ -1144,18 +1146,19 @@ static void __init efi_relocate_esrt(EFI_SYSTEM_TABLE 
> *SystemTable)
>      for ( i = 0; i < info_size; i += mdesc_size )
>      {
>          /*
> -         * ESRT needs to be moved to memory of type EfiRuntimeServicesData
> +         * ESRT needs to be moved to memory of type EfiACPIReclaimMemory
>           * so that the memory it is in will not be used for other purposes.
>           */
>          void *new_esrt = NULL;
> -        size_t esrt_size = get_esrt_size(memory_map + i);
> +        const EFI_MEMORY_DESCRIPTOR *desc = memory_map + i;
> +        size_t esrt_size = get_esrt_size(desc);
>  
>          if ( !esrt_size )
>              continue;
> -        if ( ((EFI_MEMORY_DESCRIPTOR *)(memory_map + i))->Type ==
> -             EfiRuntimeServicesData )
> +        if ( desc->Type == EfiRuntimeServicesData ||
> +             desc->Type == EfiACPIReclaimMemory )
>              break; /* ESRT already safe from reuse */
> -        status = efi_bs->AllocatePool(EfiRuntimeServicesData, esrt_size,
> +        status = efi_bs->AllocatePool(EfiACPIReclaimMemory, esrt_size,
>                                        &new_esrt);
>          if ( status == EFI_SUCCESS && new_esrt )
>          {




 


Rackspace

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