From mboxrd@z Thu Jan 1 00:00:00 1970 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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8FFDC00528 for ; Tue, 1 Aug 2023 17:32:02 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7A21086ADE; Tue, 1 Aug 2023 19:32:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="rGgYmvNv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5D46486B53; Tue, 1 Aug 2023 19:31:59 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A4A77867EA for ; Tue, 1 Aug 2023 19:31:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=maz@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E4A5261602; Tue, 1 Aug 2023 17:31:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53685C433C7; Tue, 1 Aug 2023 17:31:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690911114; bh=+BP1cnMVy7VPcJPznlbNqMuImDhcEjUy2syOegQGI4U=; h=Date:From:To:Subject:In-Reply-To:References:From; b=rGgYmvNvj0skdxfgFb0oqfH4yJCnxPYtIdjEazEZtMKoLlEGbxO94/XMdgTsPIFU8 EO6HZ5f7g13mQcHGJkmn350PfUm2y8Yq8ojbR9gXeT02s5cqlE5In94PfNLnZ8fJtw JTmEfaaqzUk5BHHueWPz688jUUJylToJCp1dG52g+zd7fjRFP0fN4117SWLNALwIUR 2m/Zk51pmNMp/1cs/00Optr6Zvn7smESGfiBXf0YtnNFLDH9l3PnG3x+0fpW/0tzxe rlAQcvLTjl/2bLxa7MM57nb0f1X5g40g49XTJuC/uRy7EkQkbZn6w/llRdcBFwTnzL ScNtVPC0akRmA== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qQtDr-00191q-RF; Tue, 01 Aug 2023 18:31:52 +0100 Date: Tue, 01 Aug 2023 18:31:47 +0100 Message-ID: <86pm46654s.wl-maz@kernel.org> From: Marc Zyngier To: "Ying-Chun Liu (PaulLiu)" , Marc Zyngier , u-boot@lists.denx.de, =?UTF-8?B?UGllcnJlLUNsw6ltZW50?= Tosi , Tom Rini Subject: Re: [PATCH 1/2] arm64: Reduce add_map() complexity In-Reply-To: References: <20230214133814.4173549-1-paul.liu@linaro.org> <20230214133814.4173549-2-paul.liu@linaro.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: paul.liu@linaro.org, maz@kernel.org, u-boot@lists.denx.de, ptosi@google.com, trini@konsulko.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean On Tue, 01 Aug 2023 09:53:52 +0100, Oliver Graute wrote: >=20 > On 14/02/23, Ying-Chun Liu (PaulLiu) wrote: > > From: Marc Zyngier > >=20 > > In the add_map() function, for each level it populates, it iterates from > > the root of the PT tree, making it ineficient if a mapping needs to occ= ur > > past level 1. > >=20 > > Instead, replace it with a recursive (and much simpler) algorithm > > that keeps the complexity as low as possible. With this, mapping > > 512GB at level 2 goes from several seconds down to not measurable > > on an A55 machine. > >=20 > > We keep the block mappings at level 1 for now though. > >=20 > > Signed-off-by: Marc Zyngier > > Signed-off-by: Pierre-Cl=C3=A9ment Tosi > > [ Paul: pick from the Android tree. Fixup Pierre's commit. Rebase to the > > upstream ] > > Signed-off-by: Ying-Chun Liu (PaulLiu) > > Cc: Tom Rini > > Link: https://android.googlesource.com/platform/external/u-boot/+/96ad7= 29cf4cab53bdff8222bb3eb256f38b5c3a6 > > Link: https://android.googlesource.com/platform/external/u-boot/+/6be93= 30601d81545c7c941e3609f35bf68a09059 >=20 > Hello Marc, >=20 > this patch somehow broke the boot of my imx8qm board. I run into this > issue: >=20 > U-Boot 2023.07-rc6-00004-g5527698481 (Aug 01 2023 - 10:10:52 +0200) >=20 > Model: Advantech iMX8QM DMSSE20 > Board: DMS-SE20A1 8GB > Build: SCFW 549b1e18, SECO-FW c9de51c0, ATF 5782363 > Boot: USB > DRAM: 8 GiB > "Error" handler, esr 0xbf000000 SError. > elr: 0000000080020938 lr : 00000000800209c8 (reloc) > elr: 00000000ffecf938 lr : 00000000ffecf9c8 > x0 : 0000000000000001 x1 : 0000000060000000 > x2 : 0000000010000000 x3 : 0000000000000002 > x4 : 0000000040000000 x5 : 0060000000000401 > x6 : 0000000000000800 x7 : 00000000fff44a60 > x8 : 0068000000000481 x9 : 0000000000000008 > x10: 000000000a200023 x11: 0000000000000002 > x12: 0000000000000002 x13: 0000000080095a00 > x14: 00000000ffffffff x15: 00000000ffecfd2c > x16: 000000008005454c x17: 0000000000000000 > x18: 00000000fd6afd50 x19: 000000000fe00000 > x20: 0000000000000000 x21: 0060000000000401 > x22: 0000000060200000 x23: 0000000000200000 > x24: 0000000040000808 x25: 00000000001fffff > x26: 0000000000000003 x27: 0000000060200000 > x28: 0000000000000002 x29: 00000000fd6ab110 >=20 > Code: a94573fb a8c67bfd d65f03c0 b9418a40 (8a160334) > Resetting CPU ... >=20 > resetting ... > SCI reboot request.......................................................= ...........................................................................= ...........................................................................= ............... >=20 > After some bisecting this patch poped up:=20 >=20 > 41e2787f5ec4249cb2e77a3ebd3c49035e3c6535 is the first bad commit > arm64: Reduce add_map() complexity >=20 > After I reverted everything on top of this patch its booting again with v= 2023.07 >=20 > commit c1da6fdb5c239b432440721772d993e63cfdeb20 > armv8: enable HAFDBS for other ELx when FEAT_HAFDBS is present >=20 > commit 836b8d4b205d2175b57cb9ef271e638b0c116e89 > arm64: Use level-2 for largest block mappings when FEAT_HAFDBS is present >=20 > commit 6cdf6b7a340db4ddd008516181de7e08e3f8c213 > arm64: Use FEAT_HAFDBS to track dirty pages when available >=20 >=20 > Do you have any idea whats going on here? Not really. I can only tell you that your HW has generated a SError, which is usually pretty fatal. There could be all sort of reasons why this happen, such as mapping a piece of address space that you are not supposed to access. If the previous incarnation of the PT code was behaving in a better way, the way to debug this is to dump both sets of page tables and compare what they actually map, figuring out where things go wrong. M. --=20 Without deviation from the norm, progress is not possible.