From nobody Fri Nov 29 14:52:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1636411555; cv=none; d=zohomail.com; s=zohoarc; b=d+KajwmQ2qZWlL7gRx9yT9wYBAo9RQnPNav0crgIQfkaRuJolxFBSPOqY4A7ab+b304puf4hl7ffqNs4lJDnVuEV+vECDnLnm+zsBPGC5Yn7N9fszomtmTl9ZlDkSNR/G08oMKc2ZZKt8aHRsKMX5PAtUYjcQl0t3QJn93s2uJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636411555; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=BUOBmtofDJRL4AVFvzxwn0sokmiiUnyWtkLb9hd8F1w=; b=NzFaICVuHUvTXnSjF2mfChN8AKghCU5fpLWXOv/iIuPOivU0NAkT2AUxfZ1hXWx3AwLr7ID9Sx/d9HvJIhbCPue6RNs6iQpp7Sj1H/ualjrTb88g94vTHkV09xUN7YbtOTshW/LjliTtDC8jgabGMbEGAV0J0Eulgth02JiJzP0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1636411555860366.415859966162; Mon, 8 Nov 2021 14:45:55 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.223638.386411 (Exim 4.92) (envelope-from ) id 1mkDOG-0005f6-GT; Mon, 08 Nov 2021 22:45:24 +0000 Received: by outflank-mailman (output) from mailman id 223638.386411; Mon, 08 Nov 2021 22:45:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mkDOG-0005ez-BV; Mon, 08 Nov 2021 22:45:24 +0000 Received: by outflank-mailman (input) for mailman id 223638; Mon, 08 Nov 2021 22:45:23 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mkDOF-0005et-5d for xen-devel@lists.xenproject.org; Mon, 08 Nov 2021 22:45:23 +0000 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8cadea44-40e5-11ec-9787-a32c541c8605; Mon, 08 Nov 2021 23:45:20 +0100 (CET) Received: by mail.kernel.org (Postfix) with ESMTPSA id A32AF6134F; Mon, 8 Nov 2021 22:45:18 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 8cadea44-40e5-11ec-9787-a32c541c8605 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636411518; bh=Sc4Vwh2z9w7lDhAvPas9sVQajxYW+o46Zs2uLyTkWhw=; h=Date:From:To:cc:Subject:From; b=gBQsoQJ/9soxvB44qvg1zk/JRzgSZ5CuhHsmLBc9NhxGtIt03YdGFkW2LqBrYeZDz GgsrhMAFgaRtx0nSNGJrMY1c9ez2J3/kfS6f+W7HhxY4JQqEVhzmUwWORl+PfyucmU RyshnVcqPxf6bR4luogM9AOQUz7ZfDpPSzSwxh/LEFS4duVMpXNB5maIz8+C02edVy Cwx6snOiNvL6I2HOXW4F2qGrq4SyxCKvjMKy3S30PJM4eKT+yg4BLkYkbHIFW2SL4N S4Jdxy0WA044jgLazf3gZTo0yhaRc/a5bSkQt27YX/3vGe+0NBjEQxULZANYvfdQF+ YWowoVz3c1K4w== Date: Mon, 8 Nov 2021 14:45:07 -0800 (PST) From: Stefano Stabellini X-X-Sender: sstabellini@ubuntu-linux-20-04-desktop To: oleksandr_tyshchenko@epam.com cc: sstabellini@kernel.org, julien@xen.org, iwj@xenproject.org, Bertrand.Marquis@arm.com, xen-devel@lists.xenproject.org Subject: ASSERT in rangeset_remove_range Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1636411557514100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Hi Oleksandr, Julien, I discovered a bug caused by the recent changes to introduce extended regions in make_hypervisor_node (more logs appended): (XEN) d1 BANK[0] 0x00000040000000-0x0000007e800000 (1000MB) (XEN) d1 BANK[1] 0x00000200000000-0x00000200000000 (0MB) (XEN) DEBUG find_unallocated_memory 994 s=3D40000000 e=3D7e7fffff (XEN) DEBUG find_unallocated_memory 994 s=3D200000000 e=3D1ffffffff (XEN) Assertion 's <=3D e' failed at rangeset.c:189 When a bank of memory is zero in size, then rangeset_remove_range is called with end < start, triggering an ASSERT in rangeset_remove_range. One solution is to avoid creating 0 size banks. The following change does that: diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 49b4eb2b13..3efe542d0f 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -459,9 +459,12 @@ static void __init allocate_memory(struct domain *d, s= truct kernel_info *kinfo) goto fail; =20 bank_size =3D MIN(GUEST_RAM1_SIZE, kinfo->unassigned_mem); - if ( !allocate_bank_memory(d, kinfo, gaddr_to_gfn(GUEST_RAM1_BASE), + if ( bank_size > 0 ) + { + if ( !allocate_bank_memory(d, kinfo, gaddr_to_gfn(GUEST_RAM1_BASE), bank_size) ) - goto fail; + goto fail; + } =20 if ( kinfo->unassigned_mem ) goto fail; We have a couple of other options too: - remove the ASSERT in rangeset_remove_range There is an argument that we should simply return error fromrangeset_remove_range, rather than a full assert. - add a if (end > start) check before calling rangeset_remove_range We could check that end > start before calling rangeset_remove_range at all the call sites in domain_build.c. There are 5 call sites at the moment. Any other ideas or suggestions? Cheers, Stefano (XEN) DEBUG find_memory_holes 1126 s=3Dff990000 e=3Dff990fff (XEN) DEBUG find_memory_holes 1126 s=3Dff990000 e=3Dff990fff (XEN) DEBUG find_memory_holes 1126 s=3Dff990000 e=3Dff990fff (XEN) DEBUG find_memory_holes 1126 s=3Dff990000 e=3Dff990fff (XEN) DEBUG find_memory_holes 1126 s=3Df9010000 e=3Df901ffff (XEN) DEBUG find_memory_holes 1126 s=3Df9020000 e=3Df903ffff (XEN) DEBUG find_memory_holes 1126 s=3Df9040000 e=3Df905ffff (XEN) DEBUG find_memory_holes 1126 s=3Df9060000 e=3Df907ffff (XEN) DEBUG find_memory_holes 1126 s=3Dfd800000 e=3Dfd81ffff (XEN) DEBUG find_memory_holes 1126 s=3Dff060000 e=3Dff060fff (XEN) DEBUG find_memory_holes 1126 s=3Dff070000 e=3Dff070fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd6e0000 e=3Dfd6e8fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd6e9000 e=3Dfd6edfff (XEN) DEBUG find_memory_holes 1126 s=3Dfd500000 e=3Dfd500fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd510000 e=3Dfd510fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd520000 e=3Dfd520fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd530000 e=3Dfd530fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd540000 e=3Dfd540fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd550000 e=3Dfd550fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd560000 e=3Dfd560fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd570000 e=3Dfd570fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd4b0000 e=3Dfd4bffff (XEN) DEBUG find_memory_holes 1126 s=3Dffa80000 e=3Dffa80fff (XEN) DEBUG find_memory_holes 1126 s=3Dffa90000 e=3Dffa90fff (XEN) DEBUG find_memory_holes 1126 s=3Dffaa0000 e=3Dffaa0fff (XEN) DEBUG find_memory_holes 1126 s=3Dffab0000 e=3Dffab0fff (XEN) DEBUG find_memory_holes 1126 s=3Dffac0000 e=3Dffac0fff (XEN) DEBUG find_memory_holes 1126 s=3Dffad0000 e=3Dffad0fff (XEN) DEBUG find_memory_holes 1126 s=3Dffae0000 e=3Dffae0fff (XEN) DEBUG find_memory_holes 1126 s=3Dffaf0000 e=3Dffaf0fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd070000 e=3Dfd09ffff (XEN) DEBUG find_memory_holes 1126 s=3Dff100000 e=3Dff100fff (XEN) DEBUG find_memory_holes 1126 s=3Dff0b0000 e=3Dff0b0fff (XEN) DEBUG find_memory_holes 1126 s=3Dff0c0000 e=3Dff0c0fff (XEN) DEBUG find_memory_holes 1126 s=3Dff0d0000 e=3Dff0d0fff (XEN) DEBUG find_memory_holes 1126 s=3Dff0e0000 e=3Dff0e0fff (XEN) DEBUG find_memory_holes 1126 s=3Dff0a0000 e=3Dff0a0fff (XEN) DEBUG find_memory_holes 1126 s=3Dff020000 e=3Dff020fff (XEN) DEBUG find_memory_holes 1126 s=3Dff030000 e=3Dff030fff (XEN) DEBUG find_memory_holes 1126 s=3Dff960000 e=3Dff960fff (XEN) DEBUG find_memory_holes 1126 s=3Dffa00000 e=3Dffa0ffff (XEN) DEBUG find_memory_holes 1126 s=3Dfd0b0000 e=3Dfd0bffff (XEN) DEBUG find_memory_holes 1126 s=3Dfd490000 e=3Dfd49ffff (XEN) DEBUG find_memory_holes 1126 s=3Dffa10000 e=3Dffa1ffff (XEN) DEBUG find_memory_holes 1126 s=3Dfd0e0000 e=3Dfd0e0fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd480000 e=3Dfd480fff (XEN) DEBUG find_memory_holes 1126 s=3D8000000000 e=3D8000ffffff (XEN) DEBUG handle_pci_range 1056 s=3De0000000 e=3Defffffff (XEN) DEBUG handle_pci_range 1056 s=3D600000000 e=3D7ffffffff (XEN) DEBUG find_memory_holes 1126 s=3Dff0f0000 e=3Dff0f0fff (XEN) DEBUG find_memory_holes 1126 s=3Dc0000000 e=3Dc7ffffff (XEN) DEBUG find_memory_holes 1126 s=3Dffa60000 e=3Dffa60fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd400000 e=3Dfd43ffff (XEN) DEBUG find_memory_holes 1126 s=3Dfd3d0000 e=3Dfd3d0fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd0c0000 e=3Dfd0c1fff (XEN) DEBUG find_memory_holes 1126 s=3Dff160000 e=3Dff160fff (XEN) DEBUG find_memory_holes 1126 s=3Dff170000 e=3Dff170fff (XEN) DEBUG find_memory_holes 1126 s=3Dff040000 e=3Dff040fff (XEN) DEBUG find_memory_holes 1126 s=3Dff050000 e=3Dff050fff (XEN) DEBUG find_memory_holes 1126 s=3Dff110000 e=3Dff110fff (XEN) DEBUG find_memory_holes 1126 s=3Dff120000 e=3Dff120fff (XEN) DEBUG find_memory_holes 1126 s=3Dff130000 e=3Dff130fff (XEN) DEBUG find_memory_holes 1126 s=3Dff140000 e=3Dff140fff (XEN) DEBUG find_memory_holes 1126 s=3Dff000000 e=3Dff000fff (XEN) DEBUG find_memory_holes 1126 s=3Dff010000 e=3Dff010fff (XEN) DEBUG find_memory_holes 1126 s=3Dff9d0000 e=3Dff9d0fff (XEN) DEBUG find_memory_holes 1126 s=3Dfe200000 e=3Dfe23ffff (XEN) DEBUG find_memory_holes 1126 s=3Dff9e0000 e=3Dff9e0fff (XEN) DEBUG find_memory_holes 1126 s=3Dfe300000 e=3Dfe33ffff (XEN) DEBUG find_memory_holes 1126 s=3Dfd4d0000 e=3Dfd4d0fff (XEN) DEBUG find_memory_holes 1126 s=3Dff150000 e=3Dff150fff (XEN) DEBUG find_memory_holes 1126 s=3Dffa50000 e=3Dffa50fff (XEN) DEBUG find_memory_holes 1126 s=3Dffa50000 e=3Dffa50fff (XEN) DEBUG find_memory_holes 1126 s=3Dffa50000 e=3Dffa50fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd4c0000 e=3Dfd4c0fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd4a0000 e=3Dfd4a0fff (XEN) DEBUG find_memory_holes 1126 s=3Dfd4aa000 e=3Dfd4aafff (XEN) DEBUG find_memory_holes 1126 s=3Dfd4ab000 e=3Dfd4abfff (XEN) DEBUG find_memory_holes 1126 s=3Dfd4ac000 e=3Dfd4acfff (XEN) DEBUG find_memory_holes 1126 s=3D0 e=3D7fefffff (XEN) DEBUG find_memory_holes 1126 s=3D800000000 e=3D87fffffff (XEN) Extended region 0: 0x80000000->0xc0000000 (XEN) Extended region 1: 0xc8000000->0xe0000000 (XEN) Extended region 2: 0xf0000000->0xf9000000 (XEN) Extended region 3: 0xffc00000->0x600000000 (XEN) Extended region 4: 0x880000000->0x8000000000 (XEN) Extended region 5: 0x8001000000->0x10000000000 (XEN) Loading zImage from 0000000000e00000 to 0000000020000000-000000002136= 7a00 (XEN) Loading d0 initrd from 0000000002200000 to 0x0000000028200000-0x00000= 000293f936d (XEN) Loading d0 DTB to 0x0000000028000000-0x0000000028009604 (XEN) *** LOADING DOMU cpus=3D1 memory=3Dfa000KB *** (XEN) Loading d1 kernel from boot module @ 0000000003400000 (XEN) Loading ramdisk from boot module @ 0000000004800000 (XEN) Allocating mappings totalling 1000MB for d1: (XEN) d1 BANK[0] 0x00000040000000-0x0000007e800000 (1000MB) (XEN) d1 BANK[1] 0x00000200000000-0x00000200000000 (0MB) (XEN) DEBUG find_unallocated_memory 994 s=3D40000000 e=3D7e7fffff (XEN) DEBUG find_unallocated_memory 994 s=3D200000000 e=3D1ffffffff (XEN) Assertion 's <=3D e' failed at rangeset.c:189 (XEN) ----[ Xen-4.16-rc arm64 debug=3Dy Not tainted ]---- (XEN) CPU: 0 (XEN) PC: 0000000000220e6c rangeset_remove_range+0xbc/0x2bc (XEN) LR: 00000000002cd508 (XEN) SP: 0000000000306f60 (XEN) CPSR: 0000000020000249 MODE:64-bit EL2h (Hypervisor, handler) (XEN) X0: 00008000fbf61e70 X1: 0000000200000000 X2: 00000001ffffffff (XEN) X3: 0000000000000005 X4: 0000000000000000 X5: 0000000000000028 (XEN) X6: 0000000000000080 X7: fefefefefefeff09 X8: 7f7f7f7f7f7f7f7f (XEN) X9: 717164616f726051 X10: 7f7f7f7f7f7f7f7f X11: 0101010101010101 (XEN) X12: 0000000000000008 X13: 0000000000000009 X14: 0000000000306cb8 (XEN) X15: 0000000000000020 X16: 000000000028c5a8 X17: 0000000000000000 (XEN) X18: 0180000000000000 X19: 00000001ffffffff X20: 0000000000000001 (XEN) X21: 0000000200000000 X22: 0000000200000000 X23: 0000000000000002 (XEN) X24: 0000000000000002 X25: 00000000003070e0 X26: 00000000002d9e68 (XEN) X27: 00000000002d8d18 X28: 00008000fbf40000 FP: 0000000000306f60 (XEN)=20 (XEN) VTCR_EL2: 0000000080023558 (XEN) VTTBR_EL2: 0000000000000000 (XEN)=20 (XEN) SCTLR_EL2: 0000000030cd183d (XEN) HCR_EL2: 0000000000000038 (XEN) TTBR0_EL2: 0000000004b45000 (XEN)=20 (XEN) ESR_EL2: 00000000f2000001 (XEN) HPFAR_EL2: 0000000000000000 (XEN) FAR_EL2: 0000000000000000 (XEN)=20 (XEN) Xen stack trace from sp=3D0000000000306f60: (XEN) 0000000000307040 00000000002cf2a8 00008000fbf5a000 0000000000000000 (XEN) 00008000fbf40000 00000000003070a8 0000000000307de4 00000000002aa078 (XEN) 0000000880000000 0000000000000002 00000000002e8d08 00000000000fff00 (XEN) 00008000fbf61e70 00008000fbf5a000 00008000fbf61220 0000000000000000 (XEN) 0000000000307040 00000000002cf288 00008000fbf5a000 0000000000000000 (XEN) 00008000fbf40000 00000000003070a8 0000000000307de4 65782c32766e6578 (XEN) 000000000030006e 2d6e65782c6e6578 6e65780036312e34 000000006e65782c (XEN) 0000000000307d80 00000000002d0440 00008000fbfd95a0 0000000000307dc8 (XEN) 00000000002d99b8 00000000002da338 0000000000307de4 00000000002aa078 (XEN) 000000000000000f 0000000000307110 0000000000000001 00c2010000000002 (XEN) 00000000003070c8 0000000000000000 6d933f29040f0000 0000002200000000 (XEN) 0010000000000000 0020000300000000 0020000000000000 00000000000fa000 (XEN) 0000000000000001 00008000fbf5a000 00008000fbf40000 0000000000000000 (XEN) 0000000000000002 0000000040000000 000000003e800000 0000000000000000 (XEN) 0000000200000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) Xen call trace: (XEN) [<0000000000220e6c>] rangeset_remove_range+0xbc/0x2bc (PC) (XEN) [<00000000002cd508>] domain_build.c#make_hypervisor_node+0x258/0x7= f4 (LR) (XEN) [<00000000002cf2a8>] domain_build.c#construct_domU+0x9cc/0xa8c (XEN) [<00000000002d0440>] create_domUs+0xe8/0x224 (XEN) [<00000000002d4988>] start_xen+0xafc/0xbf0 (XEN) [<00000000002001a0>] arm64/head.o#primary_switched+0xc/0x1c (XEN)=20 (XEN)=20 (XEN) **************************************** (XEN) Panic on CPU 0: (XEN) Assertion 's <=3D e' failed at rangeset.c:189 (XEN) ****************************************