[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] xen/x86/pvh: copy ACPI tables to Dom0 instead of mapping
- To: Xenia Ragiadakou <xenia.ragiadakou@xxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Thu, 18 May 2023 11:31:14 +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=+OMXQrhCQaBqSvOUEgCtRxojhKihVOS7X5ukdb3X92A=; b=N29955NlCpVIhnl3tD6NhnVe1Q33+Qb3W9kI56WTavCJM8Cb6ndV5bQCabKwNyTUJBTYpA6ZJZkAe0AiE/JzPxTpu8YDMHjgQuNn9ISWUggqIMNTmBydxNYi8bje3fSq+AWDM0vic3sRFE7iYphCHveSB2jiYf+Q+73ikJfNxK9D2B48o1Ulh+seAHa0aUJduqhUdRZC6IyUJdq5ZyoNESRdpaz1DvP+ISZsMKEdnkcG/+eAYH94DlkZDAb1p60Kz9+RSanEnTuHnyR8gH5YPT0U65qWpGq7V+qsOBjBAidcwIUfpjXBoZx9KKXJQGd1WG0U5pxI8/2Z6Q0r8n47dw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gHMwULcYjEJQv3aNV3ivpLS/cP11bZSPxEuplKEMyuTQIT1B18lGK9VTQqBJX5QHt+Dc3Mjs3A+OwHimxOUfBZPGMuDzX34rXnumPM/9VT7gutUg3yqNjBVM3eBUVPhVR37hDCxY+bHLFQurbKzRc9Gpm7ceOVZ+4z0s6gmVcSwagjkSSAejYWjXYt30HvXsblHdya8jbV9VWgSvPBBxEcisEkB/qYBamEWivQ1AgBUwzxYTAzskOeaaWeyIMwF7Mx2scCoZJEXLY2AMzmeJcB03xnofDDqT95YpGjw8htmuhrsHQzLgwGZJ04Azgs61Y1Uu45Fk6Dja+iMu54ufmA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Jan Beulich <jbeulich@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Stefano Stabellini <stefano.stabellini@xxxxxxx>, andrew.cooper3@xxxxxxxxxx
- Delivery-date: Thu, 18 May 2023 09:31:36 +0000
- Ironport-data: A9a23:cIikw623mpPlKOtrCfbD5TNwkn2cJEfYwER7XKvMYLTBsI5bpzNSz jRKCj2HPK6CY2T2L9wnbNy09B9S75/Rz9AxTlM9pC1hF35El5HIVI+TRqvS04F+DeWYFR46s J9OAjXkBJppJpMJjk71atANlVEliefTAOK6ULWeUsxIbVcMYD87jh5+kPIOjIdtgNyoayuAo tq3qMDEULOf82cc3lk8tuTS+XuDgNyo4GlD5gFnNagS1LPjvyJ94Kw3dPnZw0TQGuG4LsbiL 87fwbew+H/u/htFIrtJRZ6iLyXm6paLVeS/oiI+t5qK23CulQRrukoPD9IOaF8/ttm8t4sZJ OOhF3CHYVxB0qXkwIzxWvTDes10FfUuFLTveRBTvSEPpqFvnrSFL/hGVSkL0YMkFulfAkEVz OAieG43VVOMnOft/pWgZvlGr5F2RCXrFNt3VnBI6xj8VKxja7aTBqLA6JlfwSs6gd1IEbDGf c0FZDFzbRPGJRpSJlMQD5F4l+Ct7pX9W2QA9BTJ+uxqvi6Kk1EZPLvFabI5fvSQQspYhACAr 3/u9GXlGBAKcteYzFJp91r13r6SxXikCdx6+LuQ7dJI2k2N6zMvAxwJaEuLocHhoUSQVIcKQ 6AT0m90xUQoz2S7Q9/8VluiqXGFtxIVWN1NO+Q/5EeGza+8ywSTC3UATzVBQ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lists.xenproject.org>
On Thu, May 18, 2023 at 10:24:10AM +0300, Xenia Ragiadakou wrote:
>
> On 15/5/23 17:17, Jan Beulich wrote:
> > On 13.05.2023 03:17, Stefano Stabellini wrote:
> > > From: Stefano Stabellini <stefano.stabellini@xxxxxxx>
> > >
> > > Mapping the ACPI tables to Dom0 PVH 1:1 leads to memory corruptions of
> > > the tables in the guest. Instead, copy the tables to Dom0.
> > Do you really mean "in the guest" (i.e. from Xen's perspective, i.e.
> > ignoring that when running on qemu it is kind of a guest itself)?
> >
> > I also consider the statement too broad anyway: Various people have
> > run PVH Dom0 without running into such an issue, so it's clearly not
> > just "leads to".
>
> In my opinion the issue is broader.
>
> In pvh_setup_acpi(), the code adding the ACPI tables to dom0 memory map does
> not check the return value of pvh_add_mem_range(). If there is an overlap
> and the overlapping region is marked as E820_ACPI, it maps not just the
> allowed tables but the entire overlapping range ,
But that's the indented behavior: all ACPI regions will be mapped into
the dom0 physmap, the filtering of the tables exposed to dom0 is done
in the XSDT, but not in by filtering the mapped regions. Note this
won't be effective anyway, as the minimal granularity of physmap
entries is 4k, so multiple tables could live in the same 4K region.
Also Xen cannot parse dynamic tables (SSDT) or execute methods, and
hence doesn't know exactly which memory will be used.
Xen relies on the firmware to have the ACPI tables in ACPI, NVS or
RESERVED regions in order for them to be mapped into the gust physmap.
The call to pvh_add_mem_range() in pvh_setup_acpi() is just an attempt
to workaround broken systems that have tables placed in memory map
holes, and hence ignoring the return value is fine.
> while if the overlapping
> range is marked as E820_RESERVED, it does not map the tables at all (the
> issue that Stefano saw with qemu). Since dom0 memory map is initialized
> based on the native one, the code adding the ACPI table memory ranges will
> naturally fall into one of the two cases above.
Xen does map them, but that's done in arch_iommu_hwdom_init() which get
short-circuited by the usage of dom0-iommu=none in your example. See
my reply to Stefano about moving such mappings into pvh_populate_p2m().
> So even when not running into this issue, pvh_add_mem_range() still fails
> and the memory range mapped is wider than the allowed one.
The intention of that call to pvh_add_mem_range() is not to limit what
gets mapped into dom0 physmap, but rather to workaround bugs in the
firmware if ACPI tables are placed in memory map holes.
Thanks, Roger.
|