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

Re: [PATCH][4.17] EFI: don't convert memory marked for runtime use to ordinary RAM


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Fri, 30 Sep 2022 11:55:26 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=anL1P0itDgHK7+ScI98pOYbc099ObRlXgl+VxysqEc8=; b=SMqBIKUFrZuz1lgaDCZN5ROKeRmZ8minm/3mNtQ/qOq5mr0XmrBHkDxnQoBLUt71Opuodhkm89lqdFDLBJ0qqLS2EwnUecOwm/UQk9HjjM6LNqU7M59Eo5nxjncX5SrFKLl438q9X9m9L8OpLfc//ji8O5thNdEfktGJEjXR+FAv2nmVBsgK0x19j0TKch8xlZAu4llxVIxS3bFSjpPbtoV68HSe+s4YUgUxViOpotMs7vPx2dsi5215EHfUF6+SAL2BikQRcixco63tCZjO815lKo5/MoEYVuytpjtBwKqMnhksK+PkA1a3blUThkkcRZTdJT8Q0nILSaKIVVYKng==
  • 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=anL1P0itDgHK7+ScI98pOYbc099ObRlXgl+VxysqEc8=; b=bmEfo0JAosO+AV2pn9GVVE/nsymANbARsh9weCJ37hw53wy8avS7nb5ptEgQkr2hvhd9/oyqSdHgeBpBI2BDeMECwBMMf2vDkft0MC39QPvwdCSIt2C25ZHW4y8WC3tIbno9+Lr5+JM1jjbfz32If/KSUnyWGq5A1148cDzfifrL4nJQiisf91/xe2q8knbRJX/lHKw0y1YUHQhqAeWdXP6e83zoEd83kUlVsyfxadw2E3OiObcr/JYyc7SZ45HLq0m1JiWhgRk7VTVOD9LyI/FZpZ+UN7cP1gY+ChIqWCcLvkGaVH3qQXyTzck44qKGeNYdoI3q3+ojbxSMVJ1qWA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=jArTLkhlcgQ0vfjfgK5vX0KRdL0q3b27LUMKInBe/EZ+wCTc7njQR2RMkcQG4AoNRRJEmmR6iRaXVjksqiP3MpD3y/mfFIUZc+AKoQNa3LhZhkTj8A7oWZynea0jhYPlnCGPMBAYRL1aObHaiyzPS98+QNOJ/WQJ2547X9LzmTSvvSlYAqsRgG9tGZdMi9QHwOis7shqGZgtjACHIe2q/lJd/m4u+j8VSZiDFKLaKkgeh/YJZxCfq5KA8+3k7GIyWabEBCWkbLtgnivJ45Hgy18a/UdPwaisMg5K7VuJh0hqIqzFTem2flk11+xc2QvnxqrIoJL1pGNiDLSW7IpEBQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SSwcUQVZq7bfKZJAasAusjHcnJwuyzuq3HW9Uh+P+w9Gf6kweEE7z5n2WE1l1bgqkJVYAvVBGSbvcAmtIgUcytsdHZM53DaCKUJFI9Irx8vlRTVMnh+K9JZzjXxB8ltSAQ7s0939Og3/Z2VtD2H5kGuen4q6iC7+UjMAi8rpCVn9WO2uKbUPuWHynJ6ir8Uc/KWWo0owA0QZeumwPK2piAN9ZUWS6xaKGmX1NcMN3ChGKj0HMGqmXf1L5z/FhbDLPAezM6ztUGsFYDUl+RvDBkD44ZaqEya2jdzNHxB6k/jcK6naRLEHcIv6W76Y4ijwWTJiPU45/Q/v4PURJQGQ1Q==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>
  • Delivery-date: Fri, 30 Sep 2022 11:55:47 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHY1KFdAull5ChokkeaXft6EPXQra333cqA
  • Thread-topic: [PATCH][4.17] EFI: don't convert memory marked for runtime use to ordinary RAM

Hi Jan,

We will review and test the arm part (even though it is modifying some unused
 code at the moment) but I wanted to answer you on some questions you have ..

> On 30 Sep 2022, at 09:50, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> efi_init_memory() in both relevant places is treating EFI_MEMORY_RUNTIME
> higher priority than the type of the range. To avoid accessing memory at
> runtime which was re-used for other purposes, make
> efi_arch_process_memory_map() follow suit. While on x86 in theory the
> same would apply to EfiACPIReclaimMemory, we don't actually "reclaim"
> E820_ACPI memory there and hence that type's handling can be left alone.
> 
> Fixes: bf6501a62e80 ("x86-64: EFI boot code")
> Fixes: facac0af87ef ("x86-64: EFI runtime code")
> Fixes: 6d70ea10d49f ("Add ARM EFI boot support")
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> Partly RFC for Arm, for two reasons:
> 
> On Arm I question the conversion of EfiACPIReclaimMemory, in two ways:
> For one like on x86 such ranges would likely better be retained, as Dom0
> may (will?) have a need to look at tables placed there. Plus converting
> such ranges to RAM even if EFI_MEMORY_WB is not set looks suspicious to
> me as well. I'd be inclined to make the latter adjustment right here
> (while the other change probably would better be separate, if there
> aren't actually reasons for the present behavior).
> 
> On Arm efi_init_memory() is compiled out, so adjusting Arm code here is
> perhaps more for consistency (not leaving a trap for someone to later
> fall into) than a strict requirement. I wonder though how Arm has
> managed to get away without at least some parts of efi_init_memory() for
> all the years that ACPI support has been present there. I guess this is
> connected to most of runtime.c also being compiled out, but that
> continuing to be the case is another aspect puzzling me.

On arm we only use the boot services in Xen and we do not provide
any efi services to dom0. The required info is passed through a simple device
tree.
There was a discussion on that subject some weeks ago and it is still an open
point to be solved.
Also APCI is officially unsupported on arm.

Cheers
Bertrand

> 
> --- a/xen/arch/arm/efi/efi-boot.h
> +++ b/xen/arch/arm/efi/efi-boot.h
> @@ -183,13 +183,15 @@ static EFI_STATUS __init efi_process_mem
> 
>     for ( Index = 0; Index < (mmap_size / desc_size); Index++ )
>     {
> -        if ( desc_ptr->Attribute & EFI_MEMORY_WB &&
> -             (desc_ptr->Type == EfiConventionalMemory ||
> -              desc_ptr->Type == EfiLoaderCode ||
> -              desc_ptr->Type == EfiLoaderData ||
> -              (!map_bs &&
> -               (desc_ptr->Type == EfiBootServicesCode ||
> -                desc_ptr->Type == EfiBootServicesData))) )
> +        if ( desc_ptr->Attribute & EFI_MEMORY_RUNTIME )
> +            /* nothing */;
> +        else if ( (desc_ptr->Attribute & EFI_MEMORY_WB) &&
> +                  (desc_ptr->Type == EfiConventionalMemory ||
> +                   desc_ptr->Type == EfiLoaderCode ||
> +                   desc_ptr->Type == EfiLoaderData ||
> +                   (!map_bs &&
> +                    (desc_ptr->Type == EfiBootServicesCode ||
> +                     desc_ptr->Type == EfiBootServicesData))) )
>         {
>             if ( !meminfo_add_bank(&bootinfo.mem, desc_ptr) )
>             {
> --- a/xen/arch/x86/efi/efi-boot.h
> +++ b/xen/arch/x86/efi/efi-boot.h
> @@ -185,7 +185,9 @@ static void __init efi_arch_process_memo
>             /* fall through */
>         case EfiLoaderCode:
>         case EfiLoaderData:
> -            if ( desc->Attribute & EFI_MEMORY_WB )
> +            if ( desc->Attribute & EFI_MEMORY_RUNTIME )
> +                type = E820_RESERVED;
> +            else if ( desc->Attribute & EFI_MEMORY_WB )
>                 type = E820_RAM;
>             else
>         case EfiUnusableMemory:




 


Rackspace

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