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

[PATCH V2] xen/arm: Initialize acpi_disabled to true during declaration


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>
  • Date: Tue, 25 Mar 2025 15:08:42 +0000
  • Accept-language: en-US, ru-RU
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=fZV1Xrp24hzBjC7X/wRRug3+v8GuB2ErTpL9mzqJDug=; b=x+YbOPZbjYULl/rpj6pv1khL+P4Dna0rbkoRoSJHw3jPbJHO5B1hXQiNDD7BZbIaGCmPbne8ftZkU8Rh7lJ1llHAnNqCGAoKB8tjC6stGLInEoR7w19m/RcZd2iYPvO4zgK7H38SGtafIEA5cFBE97EAERkxO1pk5gdreugvFFl2ZaIb4dxaohfvnYOQy5PVrGKzs8BLtd0epTwR4g63qErVni95LwZLdeOrU7FXrhjGLChW4WlQW3wDe2tj+oICCmB2cW3xhNwFISfVmV/hgAokcqOQq1Rs0qHszuazzSjSqjZGvSvTH3+P2PwFN4G5mqlzI7RMaRnNCYSJGNvypg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=V8E5/t1Fmgtlbrh7x7mm3ly5L1abyM4ThiWK70GQDqP7QXgpHeU6TYgMLv/ManY4F2keOyyVrqsTZHoikMg6L5bMxmaja7Ea9r2y22d/3CnHWzhHsF1Pmpn+kjfhjJWLGIOqCQywR9ia4TrJ9j5urfaS4FolIut+gDlpxN/cbHBBuRaMGBCyOyDPGAjWhdj1AJrlRtlRRX8m+x6Wmea+rhfU3R4oZR5XyDujKvaLchLTQX8tu/vpXRqCewEBek70j1OMuEH+Hk6f40vljHRr5QXQO1JpOB136l9OwS7/61xAy9qem9aOkLNy2ns3RF4+fIa32H4c4sohqaSICHqezA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 25 Mar 2025 15:09:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbnZfMrs+h0o/uEkuTNWO41qxIcA==
  • Thread-topic: [PATCH V2] xen/arm: Initialize acpi_disabled to true during declaration

On the device-tree-based Arm64 system, if Xen is built with
CONFIG_ACPI=y, CONFIG_STATIC_MEMORY=y, and the static memory range
is provided in the host device tree, the BUG is triggered in
common/page_alloc.c during Xen's early boot. The BUG occurs when
the first page from the static range is fed to the domain
sub-allocator and finally ends up in mark_page_free().
The pg->count_info & PGC_state is not in the state that
the code expects to see there.

(XEN) Checking for initrd in /chosen
(XEN) Checking for "xen,static-mem" in domain node
(XEN) RAM: 0000000040000000 - 00000000bfffffff
(XEN)
(XEN) MODULE[0]: 0000000043200000 - 0000000043343fff Xen
(XEN) MODULE[1]: 0000000043400000 - 0000000043402fff Device Tree
(XEN) MODULE[2]: 0000000042e00000 - 0000000043111f82 Ramdisk
(XEN) MODULE[3]: 0000000040400000 - 0000000042cfffff Kernel
(XEN)  RESVD[0]: 0000000050000000 - 000000005fffffff
(XEN)
(XEN) CMDLINE[0000000040400000]:domU0 console=ttyAMA0
(XEN)
(XEN) Command line: console=dtuart conswitch=ax
(XEN) pg MFN 50000 c=0x2180000000000000 o=0 v=0 t=0
(XEN) Xen BUG at common/page_alloc.c:1474
[snip]

The problem is that the static range gets mistakenly unreserved
in populate_boot_allocator() and reaches init_boot_pages().
This happens since by the time the populate_boot_allocator()
is executed, the evaluated in fw_unreserved_regions()
an acpi_disabled variable is still false and as the result
the dt_unreserved_regions() which should simply skip that static range
does not get called. The acpi_disabled will be set to the actual value
(in our case it is true) later on in acpi_boot_table_init().

The important question is why acpi_disabled is false by the time
setup_mm() is executed. With CONFIG_ACPI=n it is a macro that is always
true, but with CONFIG_ACPI=y it is a boolean that is false from the very
beggining, even though the entire acpi_boot_table_init() (which is called
after setup_mm()) is written with the assumption that ACPI is off by default
at the start. So, initialize acpi_disabled to true during declaration
if CONFIG_ACPI=y to avoid an issue and match to acpi_boot_table_init().

Suggested-by: Michal Orzel <michal.orzel@xxxxxxx>
Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
---
  V2:
   - drop post-commit remark
   - use the approach suggested by Michal
   - update commit subject (WAS xen/device-tree: Switch back to 
dt_unreserved_regions() in boot allocator)
     and description
---
---
 xen/arch/arm/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index ffcae900d7..9e94f1a8c7 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -57,7 +57,7 @@
 struct cpuinfo_arm __read_mostly system_cpuinfo;
 
 #ifdef CONFIG_ACPI
-bool __read_mostly acpi_disabled;
+bool __read_mostly acpi_disabled = true;
 #endif
 
 domid_t __read_mostly max_init_domid;
-- 
2.34.1



 


Rackspace

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