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

Re: Issue with shared information page on Xen/ARM 4.17


  • To: Elliott Mitchell <ehem+xen@xxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 3 Oct 2023 10:26:28 +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=s4SEbSUeX0wxdf1TuoUu0dy7VlBty+SBa7e7DTPIhds=; b=c3ZlkX0P6zosEn7uc2wei5hgqJ5dta7DwXG+Er45nx/CY747PjZsDNZDjJu+rWhc0Zh0Y6FFLCRGe+PLNzLbrg3xQFnE8AlmOJlQC74335mcFYkfCnVv2tUhBtG2qsX8b3bsIvbTXTczhToMqnFUodyiTNc7Y/dnWixkt0jt4pZcqbwSVX4osQDF3huhhpVXo4SSag5Z05lDc64gVd5FsfFMbcTQMwvSO3Sd+S0CvWYx/e+zIDYVR6B1yAKJ8J8sq22xzJ1jZDfelTU8lyODswMYBk7qpS3MjcimhDy/hbIhgXMtNcyajnS0R79KePg/qvf7dGIc6jNcLNEM1Opfjg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PfFl7JXDILhKzSQixv0rZgxIk3xeVmMB7OsFPyfWuPnlLoEGZBEr5mtkqyjAJBJDmPOrmjpUx5G5Fd4uL3CIsTvxN/zTa3DGcqLmg/GVadEMf+n9vUq8F3L2GIQ0xiJCgny+0ykUJ9PiQKKwfIAft5yrQgSz8EOTT9e1vL7mGrlYeGhzLaJU3lFGFYitthOT6FsnYNAnwngYCKWBBKjQQDdex2doWn5eAxhO4ptzHPsTrk+oe7dQ9ZEE5S79mt2AO5tP5dwaVbEHROoxLjSaWHjVoKGK/w4pI5h3xEyrjjY1LQNKYm9pNt96jf/MlHEr6rGK+sajuFs6qVq5IzHNgw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
  • Delivery-date: Tue, 03 Oct 2023 08:26:59 +0000
  • Ironport-data: A9a23:4ReRKq/ABrOrRK9tazkKDrUDFn+TJUtcMsCJ2f8bNWPcYEJGY0x3y WpLWm+Cb/iNMGX0fowjad+3o0kH7MODyt5jHgVq/yE8E34SpcT7XtnIdU2Y0wF+jCHgZBk+s 5hBMImowOQcFCK0SsKFa+C5xZVE/fjVAOK6UKidYnwZqTZMEE8JkQhkl/MynrlmiN24BxLlk d7pqojUNUTNNwRcawr40Ird7ks01BjOkGlA5AdnPagQ5AW2e0Q9V/rzG4ngdxMUfaEMdgKKb 76r5K20+Grf4yAsBruN+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+v9T2M4nQVVWk120c+VZk 72hg3ASpTABZcUgkMxFO/VR/roX0aduoNcrKlDn2SCfItGvn9IBDJyCAWlvVbD09NqbDklF/ 9gldywjNyvbqPqc4pajYMVp3MUseZyD0IM34hmMzBn/JNN/GdXpZfqP4tVVmjAtmspJAPDSI dIDbiZiZwjBZBsJPUoLDJU5n6GjgXyXnz9w8QrJ4/ZopTeLilUpjtABM/KMEjCObd9SkUuC4 HrP4kzyAw0ANczZwj2Amp6prraVwnmhAN1MRNVU8NZT3maezFMPMyROFkuciKfgskOgX+pQf hl8Fi0G6PJaGFaQZ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OY6TEYLfI/c34+TAYegtFZA/arxhhj9pYSP7nuv7bqvXi8f8TNH/YJLQLBdMYBKOPp JEZkm4GPl9
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Sep 28, 2023 at 07:49:18PM -0700, Elliott Mitchell wrote:
> I'm trying to get FreeBSD/ARM operational on Xen/ARM.  Current issue is
> the changes with the handling of the shared information page appear to
> have broken things for me.
> 
> With a pre-4.17 build of Xen/ARM things worked fine.  Yet with a build
> of the 4.17 release, mapping the shared information page doesn't work.

This is due to 71320946d5edf AFAICT.

> I'm using Tianocore as the first stage loader.  This continues to work
> fine.  The build is using tag "edk2-stable202211", commit fff6d81270.
> While Tianocore does map the shared information page, my reading of their
> source is that it properly unmaps the page and therefore shouldn't cause
> trouble.
> 
> Notes on the actual call is gpfn was 0x0000000000040072.  This is outside
> the recommended address range, but my understanding is this is supposed
> to be okay.
> 
> The return code is -16, which is EBUSY.
> 
> Ideas?

I think the issue is that you are mapping the shared info page over a
guest RAM page, and in order to do that you would fist need to create
a hole and then map the shared info page.  IOW: the issue is not with
edk2 not having unmapped the page, but with FreeBSD trying to map the
shared_info over a RAM page instead of a hole in the p2m.  x86
behavior is different here, and does allow mapping the shared_info
page over a RAM gfn (by first removing the backing RAM page on the
gfn).

Ideally we would like to use an unpopulated gfn, but doing so is not
trivial right now, as the point where the shared_info page is mapped
we don't yet have an easy way to account for unpopulated regions.

My suggestion would be to do something like:

diff --git a/sys/x86/xen/hvm.c b/sys/x86/xen/hvm.c
index 4122daeaf600..7251bc69ae15 100644
--- a/sys/x86/xen/hvm.c
+++ b/sys/x86/xen/hvm.c
@@ -194,18 +194,20 @@ xen_hvm_init_shared_info_page(void)
 {
        struct xen_add_to_physmap xatp;
 
-       if (xen_pv_domain()) {
-               /*
-                * Already setup in the PV case, shared_info is passed inside
-                * of the start_info struct at start of day.
-                */
-               return;
-       }
-
        if (HYPERVISOR_shared_info == NULL) {
+               struct xen_remove_from_physmap rm = {
+                       .domid = DOMID_SELF,
+               };
+               int rc;
+
                HYPERVISOR_shared_info = malloc(PAGE_SIZE, M_XENHVM, M_NOWAIT);
                if (HYPERVISOR_shared_info == NULL)
                        panic("Unable to allocate Xen shared info page");
+
+               rm.gpfn = vtophys(HYPERVISOR_shared_info) >> PAGE_SHIFT;
+               rc = HYPERVISOR_memory_op(XENMEM_remove_from_physmap, &rm);
+               if (rc != 0)
+                       printf("Failed to remove shared_info GFN: %d\n", rc);
        }
 
        xatp.domid = DOMID_SELF;

But in the long term we should see about initializing the shared_info
page as part of xenpv_attach().

Regards, Roger.



 


Rackspace

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