[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: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 4 Oct 2022 14:52:59 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=k/TcYOnQB+B4LfX/EKZFFhVW8q230A8TlPcO8afUaj0=; b=ewK6Zk5wwRbYcU0XHyvSyATkIfxh2YfvLTkGsHUwuO7rvPeM2xCct2DIVIcQdixmcxyY56nxPjHj3DVIBUo9kwaalOFxPEzmq/9FRJ1iMwi+emnlRD5Be4F2wcRUtQRQ1RdtQxi00+WQ+4h2BzNhZHu4WbE6IKayrpKvdScicrfmTfDHzyb1Yz9QgsYbMcj0FVFCQdEuwPmKSU/ezBACClnH/j8gLiICLvK/nvz4TDAykd/abZUsPfOIavZwJAZcm4dRp6WdrHu/nHVB4YL2CDzkyOzivDjNPmpYWeB82Tl/zG6lroNcZzn6RTapvIJE6/ni1q+AjALisZSQmUqBNA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AumjX0i71oO/B4LPHbLugLzrJ3m6JuMOguqfjtkxiN++op9ls5f1wpzVqFj5979KlLq0g+1lG7/esio1/HtIPW962gJkxIXRF5meWMFTOfwhcve3gVkZUy3unsHuzcUhub3Tqx+sKlwDJwLX8/my77+ZmIqSAO9aTFAf6r6xsBaHWVvYGU8uj8wahPjstRuNRHe19GNfMc0jrQmrj9VTpGpyV7DjHwyN1FBGicCNV7b1mRS3fYmWf0V9ioAjhaKmLrLqzvp7Q9CF6s0pfr9e7vyVDcdgpCua+7r+WuaOAdmRO6VkMcEbfKPrvxRtmZb1uNu/VxaZ8LSGxfX1pF5SCg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.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>
  • Delivery-date: Tue, 04 Oct 2022 12:54:48 +0000
  • Ironport-data: A9a23:Ra0FZq0e/iUWWS9GrPbD5UZwkn2cJEfYwER7XKvMYLTBsI5bp2dVz zAbD23UM/uJNmKjLot1aYi3/R4HsJOHn4BiHgZvpC1hF35El5HIVI+TRqvS04F+DeWYFR46s J9OAjXkBJppJpMJjk71atANlVEliefSAOKU5NfsYkhZXRVjRDoqlSVtkus4hp8AqdWiCkaGt MiaT/f3YTdJ4BYpdDNPg06/gEk35q6r4GtE5gZWic1j5zcyqVFEVPrzGonpR5fIatE8NvK3Q e/F0Ia48gvxl/v6Ior4+lpTWhRiro/6ZWBiuFIPM0SRqkEqShgJ+rQ6LJIhhXJ/0F1lqTzTJ OJl7vRcQS9xVkHFdX90vxNwS0mSNoUekFPLzOTWXWV+ACQqflO1q8iCAn3aMqU8+elaImIf6 cY6IWgSVQKHiOG5maO0H7wEasQLdKEHPas5k1Q5lHTyKq9jRprOBaLX+dVfwTE8wNhUGurTb NYYbjwpawncZxpIOREcD5dWcOWA3yGjNWEH7g/L4/NovgA/zyQouFTpGMDSddGQA91cg26Tp 37c/nS/CRYfXDCa4Wrcqi/917ef9c/9cL9DT/7h3M5jvEWOmVIdVUYWX37iisDs3yZSXPoac ST44BEGr6I/6UiqRdnVRACjrTiPuRt0c8pdFag25R+AzoLQ4h2FHS4UQzhZctskucQqAzsw2 TehgNfBFTFp9rqPRhq19KqQrD60ETgYKykFfyBsZRAe/9DprYU3jxTOZtVuCqi4ipvyAz6Y6 y6NqC8ylrACl/kB3q+w/U3Eqz+0r52PRQkwji3dU3i59Ap/aMigbpax9FnAxf9aKcCSSVzpl FgJndKPqt8HC56lnTaIBu4KGdmUC+2tNTTdhRtkGMAn/jH0onq7J9kPvXd5OVtjNdsCdXnxe kjPtAhN5ZhVeny3catwZIH3AMMvpUT9KenYujnvRoImSvBMmMWvpkmCuWb4M7jRrXUR
  • Ironport-hdrordr: A9a23:Ua+8lKsNObR0dBy2x4IZ1hjr7skC7YMji2hC6mlwRA09TyXGra 2TdaUgvyMc1gx7ZJhBo7+90We7MBbhHLpOkPEs1NCZLXLbUQqTXfhfBO7ZrwEIdBefygcw79 YCT0E6MqyLMbEYt7eE3ODbKadG/DDvysnB64bjJjVWPGdXgslbnntE422gYylLrWd9dPgE/M 323Ls7m9PsQwVgUu2LQl0+G8TTrdzCk5zrJTYAGh4c8QGLyRel8qTzHRS01goXF2on+8ZrzU H11yjCoomzufCyzRHRk0fV8pRtgdPkjv9OHtaFhMQ5IijlziyoeINicbufuy1dmpDn1H8a1P 335zswNcV67H3cOkmzvBvWwgHllA0j7nfzoGXo9EfLkIjcfnYXGsBBjYVWfl/y8Ew7puxx16 pNwiawq4dXJQmoplWw2/H4EzVR0makq3srluAey1ZFV5EFVbNXpYsDuGtIDZY7Gj7g4oxPKp giMCjl3ocZTbqmVQGZgoE2q+bcHkjbXy32CHTqg/blnAS/xxtCvgglLM92pAZzyHtycegH2w 3+CNUZqFh/dL5pUUtDPpZxfSKWMB24ffueChPkHX3XUIc6Blnql7nbpJ0I2cDCQu168HJ1ou WLbG9l
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Oct 04, 2022 at 02:18:31PM +0200, Jan Beulich wrote:
> On 04.10.2022 12:54, Roger Pau Monné wrote:
> > On Tue, Oct 04, 2022 at 12:44:16PM +0200, Jan Beulich wrote:
> >> On 04.10.2022 12:38, Roger Pau Monné wrote:
> >>> On Tue, Oct 04, 2022 at 12:23:23PM +0200, 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? It has no control over what we hand
> >>>> to the page allocator - it can only free pages which were actually
> >>>> allocated to it. E820_ACPI and E820_RESERVED pages are assigned to
> >>>> DomIO - Dom0 can map and access them, but it cannot free them.
> >>>
> >>> Maybe I'm very confused, but what about dom0 overwriting the data
> >>> there, won't it cause issues to runtime services?
> >>
> >> If it overwrites it, of course there are going to be issues. Just like
> >> there are going to be problems from anything else Dom0 does wrong.
> > 
> > But would dom0 know it's doing something wrong?
> 
> Yes. Please also see my reply to Andrew.
> 
> > The region is just marked as E820_ACPI from dom0 PoV, so it doesn't
> > know it's required by EFI runtime services, and dom0 could
> > legitimately overwrite the region once it considers all ACPI parsing
> > done from it's side.
> 
> PV Dom0 won't ever see E820_ACPI in the relevant E820 map; this type can
> only appear in the machine E820. In how far PVH Dom0 might need to take
> special care I can't tell right now (but at least for kexec purposes I
> expect Linux isn't going to recycle E820_ACPI regions even going forward).

Even if unlikely, couldn't some dom0 OS look at the machine map after
processing ACPI and just decide to overwrite the ACPI regions?

Not that it's useful from an OS PoV, but also we have no statement
saying that E820_ACPI in the machine memory map shouldn't be
overwritten.

Thanks, Roger.



 


Rackspace

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