Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3914890rwe; Mon, 17 Apr 2023 05:36:26 -0700 (PDT) X-Google-Smtp-Source: AKy350ZN8BiK47R0Hsb/z/EuAKHzDa6Iq+MFc0Tq8FpamM3Aj8NIV0RaNYTF+WEJYE3YCta2+y7S X-Received: by 2002:a17:90b:144:b0:23f:ec0f:aaae with SMTP id em4-20020a17090b014400b0023fec0faaaemr13846961pjb.33.1681734985826; Mon, 17 Apr 2023 05:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681734985; cv=none; d=google.com; s=arc-20160816; b=XhLZERemK3snzQLZXA9o8TkyAV00XneOPTWBGbIEdZ4qHE+567741t7EUww9Etlboq Gl+IYBar874TCHOgHw5NHkaJN4wOCTeJ60YfZ/uwA54nybO8CeRlnxSzuQSKwTRacV1I vAcj6aeg+bfZ6riy41LSUp9ZQdwA9UZbQoWuKjSLld/Qd6It8wBTtOqksF2Fbo/KtmHq E20L+Cy57dxVsys0cp5JQwQNUp5eyLsr91Ewt4xxgEgOg3U/81m16egC7kXsdXwnPDI/ es+uQmSwkE/cBAoEeAHUwpPHzoZ7oeZbV9ssRCnUneSjh5csewFW2bX/zUJETB7lEUld j4vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:reply-to:user-agent :mime-version:date:message-id; bh=sCXxxu7I1MW2JmeIRk710oRo3NmWUqK0vzg7dFdLCvM=; b=UuLBhMBgaNoDkWGStQ3LODnJvbeTTDT16IFJGTCLHZs79qqP8ut4FvIeAkUlCZaUcl RYImQStAocQL8l0he+W/nn2VP6VN69H5JZDlDOxom4rzl4DCSvdSU/pk3iRLxIQl1hne OIfkTU/1dOS8YfVRF6IJa/6JhHhGWN4wrk0SafMJsWgLCdQlOX5UPR6H73bCg1iu4AFY Kpm2a5Qe0RzbQYmXuNd12jTWx+vOkvKisHMg9FWPG9rVJ6FtkCFG0EIgH43dJVGHYOOv kn7SCMLsZxATqOm+dLqktxyY6zyaclNr64wRWwPFjLd6tlTgFy4k8i09sGD7zPVrfgV8 YwAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x21-20020a17090abc9500b0023f5452b573si6196438pjr.141.2023.04.17.05.36.14; Mon, 17 Apr 2023 05:36:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230061AbjDQM2A (ORCPT + 99 others); Mon, 17 Apr 2023 08:28:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229575AbjDQM16 (ORCPT ); Mon, 17 Apr 2023 08:27:58 -0400 Received: from wp530.webpack.hosteurope.de (wp530.webpack.hosteurope.de [80.237.130.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0335911C; Mon, 17 Apr 2023 05:27:32 -0700 (PDT) Received: from [2a02:8108:8980:2478:8cde:aa2c:f324:937e]; authenticated by wp530.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1poNx9-0005H7-Lh; Mon, 17 Apr 2023 14:27:27 +0200 Message-ID: Date: Mon, 17 Apr 2023 14:27:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Reply-To: Linux regressions mailing list Subject: Re: Kernel Panic - V6.2 - Reseved memory issue Content-Language: en-US, de-DE To: Christian Hewitt , tanure@linux.com, Stefan Agner Cc: kernelnewbies , Rob Herring , Frank Rowand , devicetree , LKML , AML , Linux kernel regressions list References: <9BAD677A-74AF-4515-B19C-A15A69CE53EF@gmail.com> From: "Linux regression tracking (Thorsten Leemhuis)" In-Reply-To: <9BAD677A-74AF-4515-B19C-A15A69CE53EF@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-bounce-key: webpack.hosteurope.de;regressions@leemhuis.info;1681734452;2e1ebda9; X-HE-SMSGID: 1poNx9-0005H7-Lh X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Thorsten here, the Linux kernel's regression tracker. Top-posting for once, to make this easily accessible to everyone. This is apparently is a regression and thus got on my radar. This all sounds a bit unfortunate. What can we do to get this properly solved? Which commit actually causes this? I wonder if poking maintainer higher in the hierarchy might help getting this finally fixed. Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) -- Everything you wanna know about Linux kernel regression tracking: https://linux-regtracking.leemhuis.info/about/#tldr If I did something stupid, please tell me, as explained on that page. #regzbot poke On 02.04.23 15:11, Christian Hewitt wrote: >> On 2 Apr 2023, at 12:10 pm, Lucas Tanure wrote: >> >> I am trying to fix a kernel panic I am seeing on my vim3 board (Amlogic A311D). >> I don't have enough knowledge about this area, but my current guess is >> the kernel is using a piece of memory belonging to ARM-trusted >> firmware that I shouldn't. >> Log: >> >> [ 9.792966] SError Interrupt on CPU3, code 0x00000000bf000000 -- SError >> [ 9.792980] CPU: 3 PID: 3471 Comm: kded5 Tainted: G C 6.2.0 #1 >> [ 9.792985] Hardware name: Khadas VIM3 (DT) >> [ 9.792987] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) >> [ 9.792991] pc : kmem_cache_free_bulk.part.98+0x1f0/0x528 >> [ 9.793004] lr : kmem_cache_free_bulk.part.98+0x2f8/0x528 >> [ 9.793008] sp : ffff80000a2eb7f0 >> [ 9.793009] x29: ffff80000a2eb7f0 x28: ffff00001f358518 x27: ffff000000008800 >> [ 9.793016] x26: ffff00000262b300 x25: ffff00000262b300 x24: 0000000000000001 >> [ 9.793019] x23: ffff00000262b000 x22: 0000000000000000 x21: ffff00001f358538 >> [ 9.793022] x20: fffffc0000098ac0 x19: 0000000000000004 x18: 0000000000000040 >> [ 9.793025] x17: 0000000000000018 x16: 00000000000007f8 x15: 0000000000000003 >> [ 9.793028] x14: 0000000000000006 x13: ffff800008e48550 x12: 0000ffff9dc91fff >> [ 9.793031] x11: 0000000000000004 x10: 0000000000000001 x9 : ffff000007e93680 >> [ 9.793035] x8 : 0000000000000020 x7 : ffff000001d2b100 x6 : 0000000000000007 >> [ 9.793037] x5 : 0000000000000020 x4 : ffff000000008800 x3 : 0000000000000001 >> [ 9.793040] x2 : 0000000000000007 x1 : 0000000000000000 x0 : ffff00001f358540 >> [ 9.793045] Kernel panic - not syncing: Asynchronous SError Interrupt >> >> This doesn't happen with downstream Khadas 6.2 kernel, and that's >> because the downstream kernel removed this from >> early_init_dt_reserve_memory (drivers/of/fdt.c): >> >> /* >> * If the memory is already reserved (by another region), we >> * should not allow it to be marked nomap, but don't worry >> * if the region isn't memory as it won't be mapped. >> */ >> if (memblock_overlaps_region(&memblock.memory, base, size) && >> memblock_is_region_reserved(base, size)) >> return -EBUSY; >> >> >> And this causes 3 MiB of memory belonging to ARM Trusted firmware to >> be reserved. >> >> arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi : >> /* 3 MiB reserved for ARM Trusted Firmware (BL31) */ >> secmon_reserved: secmon@5000000 { >> reg = <0x0 0x05000000 0x0 0x300000>; >> no-map; >> }; >> >> And the mainline kernel fails to reserve that memory: >> [ 0.000000] OF: fdt: Reserved memory: failed to reserve memory for >> node 'secmon@5000000': base 0x0000000005000000, size 3 MiB >> >> It fails to reserve because memblock_overlaps_region and >> memblock_is_region_reserved return one. >> I think memblock_is_region_reserved is saying the memory is already >> reserved by uboot and shouldn't be nomap, but it should. >> >> Is there a bug here? >> Why the kernel is failing to reserve this memory? >> Is this an u-boot issue? >> >> I would appreciate any help. The current mainline kernel fails 90% of >> the time to boot into the Vim3 board. > > The issue was raised before by Stefan Agner here: > > https://lore.kernel.org/linux-arm-kernel/40ca11f84b7cdbfb9ad2ddd480cb204a@agner.ch/ > > The thread sort of points at the general issue but the conversation > fizzled out and didn’t lead to any changes. At one point Stefan made > a suggestion about reverting part of the code, leading to this patch > in my own patchset: > > https://github.com/chewitt/linux/commit/9633c9b24f6f16afdb7fa8c2e163b6ea7a7ac5f8 > > The issue is still present and the patch does work around it. The > crashes would probably show up more, only a large percentage of > distros that actively support Amlogic boards (and several vendors) > are picking chunks of my curated LibreELEC patchset for their own > kernels and thus that patch is quite widely used. > > Christian >