From patchwork Tue Mar 25 15:08:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Tyshchenko X-Patchwork-Id: 14029142 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8DA11C35FFC for ; Tue, 25 Mar 2025 15:09:30 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.926601.1329435 (Exim 4.92) (envelope-from ) id 1tx5tj-0006vr-TM; Tue, 25 Mar 2025 15:08:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 926601.1329435; Tue, 25 Mar 2025 15:08:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tx5tj-0006vk-Qq; Tue, 25 Mar 2025 15:08:59 +0000 Received: by outflank-mailman (input) for mailman id 926601; Tue, 25 Mar 2025 15:08:58 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tx5ti-0006ve-Pw for xen-devel@lists.xenproject.org; Tue, 25 Mar 2025 15:08:58 +0000 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazlp170110003.outbound.protection.outlook.com [2a01:111:f403:c201::3]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 0b8357b2-098b-11f0-9ffa-bf95429c2676; Tue, 25 Mar 2025 16:08:44 +0100 (CET) Received: from PR3PR03MB6412.eurprd03.prod.outlook.com (2603:10a6:102:7d::8) by DU0PR03MB9256.eurprd03.prod.outlook.com (2603:10a6:10:474::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.42; Tue, 25 Mar 2025 15:08:43 +0000 Received: from PR3PR03MB6412.eurprd03.prod.outlook.com ([fe80::2887:9068:38f6:8340]) by PR3PR03MB6412.eurprd03.prod.outlook.com ([fe80::2887:9068:38f6:8340%7]) with mapi id 15.20.8534.040; Tue, 25 Mar 2025 15:08:43 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 0b8357b2-098b-11f0-9ffa-bf95429c2676 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== 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-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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fZV1Xrp24hzBjC7X/wRRug3+v8GuB2ErTpL9mzqJDug=; b=A7Xqz+WCoczoYISAxsK7RKP2SydjqIiC0O/XsqI7p3TnXnMWzDpAfameEZDMLw3OQB2KPF9iQpd0lryMU+BO4BgYIm4+MkbSv5i5Hfwrrm/oA5vbxWNIVPE44VvXFcBAUp4yCDmc9VbDuqnamAQnT54InzvW9vmFYRJCPeuKa8df0X8vspCxgiB2qufaccLpZBGlmKuzDAfLFD1HSexDcJ6zXa/XnpfUIVYs8fli9zM/teXKTid5ETqfagl8pS7i/mlIYSFKe1HvdmK1cCWH3/L0iP9/GAo3D00w0TXOfqflkAgrj9FLiy13E150jFbExs2xqPdLBbOu0J3DE1ceaQ== From: Oleksandr Tyshchenko To: "xen-devel@lists.xenproject.org" CC: Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [PATCH V2] xen/arm: Initialize acpi_disabled to true during declaration Thread-Topic: [PATCH V2] xen/arm: Initialize acpi_disabled to true during declaration Thread-Index: AQHbnZfMrs+h0o/uEkuTNWO41qxIcA== Date: Tue, 25 Mar 2025 15:08:42 +0000 Message-ID: <20250325150842.2015968-1-oleksandr_tyshchenko@epam.com> Accept-Language: en-US, ru-RU Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PR3PR03MB6412:EE_|DU0PR03MB9256:EE_ x-ms-office365-filtering-correlation-id: 230c80f1-f831-4a8c-8a1e-08dd6baeeebb x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?qXm6SISIU7WBgutD2M/lI0cm2J?= =?iso-8859-1?q?uwEAQ3YkAUB0Sq/O5f/cPPBGCiYTr6r7TtP4dF4KWk8lYaz29j5dCtx9e7gL?= =?iso-8859-1?q?C0VbehkxNSsmlymmGWtDT4s8pmwgJ+jm38iScsr7L5mbOFIrf3unhbRhpyi5?= =?iso-8859-1?q?GYEOc7kGLVNgMpRjYsFDZS1wILIlANwt7IatEKOyHzVhq4kPQcOr1yMLccDY?= =?iso-8859-1?q?4TJihC0l/E2rdtfb6fh2wwyet6eQHg71Xcu9VHJgBJdDxFtWxG4GcIsY7uDc?= =?iso-8859-1?q?OyLhixroHCiioA7j67ydhT2P08IVZ2gaK4DP3mFxr5gJmERf046HEPC/oEn2?= =?iso-8859-1?q?k9qka7zrkqGzG+NEaLUrGBg12tUrvoOurKzOljQRE/Q/IxMgXJtRCLVFRk2x?= =?iso-8859-1?q?9yV6Z2VdMjZrz6LuGU9m7cQ8hNInd2ykkwE1IgIAkAwrKk4q9Fb4DJKmOQMz?= =?iso-8859-1?q?D3gKXQleJxVXrm6SJ8i0ES5bvsBSPXkkyJILgZbGxEY0w8NbBhaYHo3N2mEk?= =?iso-8859-1?q?NJrBBLL6ytGg5IbqDePHseDq9XYm8Q5H/R5JCJBkES9u+wyN0BUnmoc5yoPt?= =?iso-8859-1?q?z77I170sEPFTFd7y1nd5mzbnABJHqdThnwV0ai5OFQXxAhbCaYEmO/5rjnpT?= =?iso-8859-1?q?neZ+j6BbT233YQgTF6Izc8SNKi3Ry0hTMWhjOpxq9/qSwn2GktpjrqRJDxdL?= =?iso-8859-1?q?7gnMF4gGNCmZOK4DoDKEkkfOCXUtqenFEy72kd6XSd/t6sjxv7YEeOmwdUz4?= =?iso-8859-1?q?jbTo7vixaORSNwPWzj6UfeStLJGmtyW1VYu4JZz+oUJrhNaM9GxeeM8ZPlWc?= =?iso-8859-1?q?Y+tX5wB5B5zTMI450Icz5FRtv17qCRIbST9Ww9GkVaHJtt6uoK16mYEqYUtk?= =?iso-8859-1?q?l3h5B14dNB4T8p+r16TW/rPi/ZaKq/LsA0+S+yj7uVdGHd1fTsE0XRaqTweJ?= =?iso-8859-1?q?odp8bBRUx/ltYFyAjsMTSdfFUxF00uQ41B6pv5j9lO5NfSfNzjAxbHpAT2FU?= =?iso-8859-1?q?ds09eE4dZTgCkLCBJXWgt/EL05NZFGFUL4mlKpg2M7Qr004lj0tLL6bEtMk2?= =?iso-8859-1?q?MUC3OGkumsxF55HBoAdDRMnnL8SKYH+12LwFuIglTp8vvS7a+ApjJPaKLSb+?= =?iso-8859-1?q?L2+ljXiUY8Usybr3i8Qnv9GiKWESC5h0H0XUMEwwxMh2qhR038TF76vwqaii?= =?iso-8859-1?q?tTZCauQ16Ysq1S3g+Xa42UqEkqvNiNHpun1cE9OlrM6mhSkf8M11Vq0iess8?= =?iso-8859-1?q?JRbYddNXd3MdgHEbufecAWmDsAMhpCnyKREV5TjHIN3p8YroT5FVilAKZkaS?= =?iso-8859-1?q?NCT8Qo8JXeBd6iNOgRYUlGHhutLr3uq/94vHjp61rgsKXC14OJgUGGzsSLdT?= =?iso-8859-1?q?xIBiObndAsdk6vavQhmyugNiZw1Nu/TrJcHckj4+u5Nz2/HrYO7Kp3ckqjDB?= =?iso-8859-1?q?jbW058U6vMDuPA/B0vzsqS6/vgnpAN34c4TYNtos3N+kLabWE4m3U4hJ4G81?= =?iso-8859-1?q?QLC02Q?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PR3PR03MB6412.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?JoJW73SJy8vaMkofFhNqwj1?= =?iso-8859-1?q?lT/h3zzdln9tPfgxt+DbXq4Kj0wxhIIrWKhhXIBi7i4Nv0DShYM957+QBW6h?= =?iso-8859-1?q?bmZPl8VHIjeoUVtlxWejD8hBHktJ09MQaI/wkCfckSe9LRZ+RC4GXX1TWoMZ?= =?iso-8859-1?q?oBk6v+x4KwHVqOVeCtsZMQwW2qH0M9+5tMu2rau0Pwl6AyyTWaZPMkvhONXn?= =?iso-8859-1?q?WqcUE6sh9uGuBcIx+8z5OOv/7Gw0tRErgSnvB7JOkRzJy8AJp320Hyfx4PNh?= =?iso-8859-1?q?eNi5F5wqpQNElAwZvoy4sZAjZmuDj3QD2GXZ38gMj3gIRDK/FxnkkdpXymdC?= =?iso-8859-1?q?j7TAWjJTlSX+TOOqX7dqcXxgup+mj/D9kNYySs6t0jVxwXVR6I0WXmn2dDtZ?= =?iso-8859-1?q?1APvyx7RSc+oqTVIYlxANlQT9dOgIdYDhZr6yA3pr/6WUCydIVWyvNyM0G6a?= =?iso-8859-1?q?3mqlQ/dWreDa1W5HtI5bOP1JHA3PjyKWtlqk9PTXE8rfDNZ8qy9rC89L01Kp?= =?iso-8859-1?q?Kd7zf03iUA7zzSy6S+wmOv5MQIrPZCq8YKvg6BK5BZw3Op9VOubSUhb5ELd1?= =?iso-8859-1?q?ieywRbamdXDG2kjwQH64wahH/jhJ0cutO+t4wLbQUS2+9WHafOGSj1BpwnSk?= =?iso-8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+/zdZ2uPjsCjdBMX84Q2SEqAa3UPgpR/V8Sqb3/E1UoFY?= =?iso-8859-1?q?/AJ7TuLsgPp24XSiT0+/5rpc4hpMHIlPedDPLAZbd+7G22cszuM16tkAQNqm?= =?iso-8859-1?q?bfcbid8wQi6y0WiKVhgljfzm9wig3Th513c1cfI4AKZnUv5zBZoU/soqAjDM?= =?iso-8859-1?q?=3D?= MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PR3PR03MB6412.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 230c80f1-f831-4a8c-8a1e-08dd6baeeebb X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Mar 2025 15:08:42.9816 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: zxaZJfGlt+9wjldzm995RfpSRIEkFAmvkAfWq9vSNP+E0+8rU5hda3Izt9lE6X1mv8Rkes3lnscDgEOCIS4qRNEFT85vUOJJZPliRwFmoB0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB9256 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 Signed-off-by: Oleksandr Tyshchenko --- 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;