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

[Xen-devel] [PATCH] x86/acpi: fix unmapping of low 1MB memory in acpi_os_unmap_memory

Current code in acpi_os_map_memory uses the direct map in order to map memory
in the low 1MB, but acpi_os_unmap_memory doesn't takes that into account, and
always tries to perform a vunmap, which results in the following WARN:

(XEN) Xen WARN at vmap.c:185
(XEN) ----[ Xen-4.9-unstable  x86_64  debug=y   Tainted:  C   ]----
(XEN) CPU:    0
(XEN) RIP:    e008:[<ffff82d0801369d7>] vmap.c#vm_free+0xd7/0xe0
(XEN) Xen call trace:
(XEN)    [<ffff82d0801369d7>] vmap.c#vm_free+0xd7/0xe0
(XEN)    [<ffff82d0802bdeda>] acpi_find_root_pointer+0x3a/0x170
(XEN)    [<ffff82d0802bd0ee>] acpi_os_get_root_pointer+0x4e/0x60
(XEN)    [<ffff82d0802d74d0>] domain_build.c#pvh_setup_acpi_xsdt+0x90/0x240
(XEN)    [<ffff82d0802d5d1a>] domain_build.c#pvh_setup_acpi+0x18a/0x2e0
(XEN)    [<ffff82d0802d3ad2>] domain_build.c#construct_dom0_pvh+0xd2/0x120
(XEN)    [<ffff82d0802c9174>] __start_xen+0x1d14/0x2420
(XEN)    [<ffff82d080100073>] __high_start+0x53/0x60

Fix this by checking if the virtual address passed to acpi_os_unmap_memory
belongs to the direct map.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
 xen/drivers/acpi/osl.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c
index 7199047..930e2d9 100644
--- a/xen/drivers/acpi/osl.c
+++ b/xen/drivers/acpi/osl.c
@@ -104,6 +104,13 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size 
 void acpi_os_unmap_memory(void __iomem * virt, acpi_size size)
+       if (IS_ENABLED(CONFIG_X86) &&
+           (unsigned long)virt >= DIRECTMAP_VIRT_START &&
+           (unsigned long)virt < DIRECTMAP_VIRT_END) {
+               ASSERT(!((__pa(virt) + size - 1) >> 20));
+               return;
+       }
        if (system_state >= SYS_STATE_boot)
                vunmap((void *)((unsigned long)virt & PAGE_MASK));
2.10.1 (Apple Git-78)

Xen-devel mailing list



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