[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: Andrew Cooper <amc96@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 4 Oct 2022 13:09:09 +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=0G2iTgslzTmppFWNurxZ4gsNJab+1yPUREtAJRT7cR0=; b=gipaB13t1E1xAj9CUegb7Ef3cVTFO4oyd8DOtcsElmY0XcRHHUh+fLwQrUY7F38BpSwUq6jlTHa4/2s8Ps4ATywSMxllCvNpxZ+3es0y0xb+sgggzS8ZO0qvykZ8xACHpHsF4Ijgi5LdekRu4K7LiyYckucj48D764VvOxA1HCRWpUj4ToBAejruL4y3ZacIJyFbDxZfLmiSZFV0P38YWKr0GpdBWIS+lSBws43J5TuXTU7aHpM33nvnDxwbHxTxYegVm1bKhMl3wx9yKiT5gL5MD9P6K/Dwj1X9LdUZW6FTaMkYQxN9VupgQ25B2UTCdSeFRY05ZqnsMLWXul+5YQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IToqcuQ9TCdtqWDWj983g1LQcIf3gOVdy241HtcbMwe4uQ8G1KcK92SqN4ncqvwUwSZvgItNJOGCoALLHafhM28ZkKqINHxWaMaGCw/ILWSYwhLGmgI9LI/TLIUU9mEAQlIG1Yhtw0tYiZPXMkne7L51sRVTUULrK7x7xL47hEzLQl4bvy8WiwHZKFaG7m87+vUc2NljiGNlR/NgKzh09K8Gr58xPGGalvTzXtN0hSTTi761X5dRKf7SGTpIps+t6Y/woHPJEPrkJl+04gGfcp0b2GAYJ0sfTb6EYBq/fCUsUXgXqv3VxcdCS4BVi20BkJJliUJwEDDl0C2mycUkJQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 04 Oct 2022 11:09:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 04.10.2022 12:49, Andrew Cooper wrote:
> On 04/10/2022 11:23, Jan Beulich wrote:
>> On 04.10.2022 11:33, Roger Pau Monné wrote:
>>> On Tue, Oct 04, 2022 at 10:06:36AM +0200, Jan Beulich wrote:
>>>> On 30.09.2022 16:28, Roger Pau Monné wrote:
>>>>> On Fri, Sep 30, 2022 at 09:50:40AM +0200, Jan Beulich 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.
>>>>> What about dom0?  Should it be translated to E820_RESERVED so that
>>>>> dom0 doesn't try to use it either?
>>>> I'm afraid I don't understand the questions. Not the least because I
>>>> think "it" can't really mean "dom0" from the earlier sentence.
>>> Sorry, let me try again:
>>>
>>> The memory map provided to dom0 will contain E820_ACPI entries for
>>> memory ranges with the EFI_MEMORY_RUNTIME attributes in the EFI memory
>>> map.  Is there a risk from dom0 reclaiming such E820_ACPI ranges,
>>> overwriting the data needed for runtime services?
>> How would Dom0 go about doing so?
> 
> Zeroing the memory and putting it into its own heap.

This makes no sense.

> You seem to be presuming that some unwritten and unenforced rules exist.

There's the PV interface. All memory management related functionality
has to be based on the E820 map handed to the domain (irrespective of
it being Dom0 or DomU). That map has no E820_ACPI entries for PV (and
PVH Dom0 is as of yet unsupported). Dom0 is also handed the host E820,
but it is supposed to use it only for resource management (e.g. to
determine where BARs may be placed, or how to arrange its PFN space).

> Once dom0 has booted, Xen cannot safety touch any ACPI reclaimable
> range.

I clearly disagree, and I expect existing behavior also disagrees with
you.

Jan

>  It doesn't go wrong in practice because OSes don't actually
> reclaim the reclaimable ranges (which is also why Xen HVM guests don't
> explode either.)
> 
> ~Andrew




 


Rackspace

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