From owner-freebsd-ppc@freebsd.org Mon Apr 16 21:24:27 2018 Return-Path: Delivered-To: freebsd-ppc@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6CABFA6B9E for ; Mon, 16 Apr 2018 21:24:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 58746873A6 for ; Mon, 16 Apr 2018 21:24:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 0922FFA6B9A; Mon, 16 Apr 2018 21:24:26 +0000 (UTC) Delivered-To: ppc@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9945FA6B98 for ; Mon, 16 Apr 2018 21:24:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7243A87379 for ; Mon, 16 Apr 2018 21:24:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id 9BB6B1EE90 for ; Mon, 16 Apr 2018 21:24:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id w3GLOOrk032431 for ; Mon, 16 Apr 2018 21:24:24 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id w3GLOO3f032430 for ppc@FreeBSD.org; Mon, 16 Apr 2018 21:24:24 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: ppc@FreeBSD.org Subject: [Bug 226974] kernel DSI read trap at boot Date: Mon, 16 Apr 2018 21:24:24 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: leandro.lupori@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: ppc@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Apr 2018 21:24:27 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D226974 --- Comment #12 from Leandro Lupori --- I have an update on this. I think I've found what is causing this issue. When ofw_mem_regions() is called during initialization, it looks for /chosen/fdtmemreserv property in the device tree. When FDT is enabled, this property will always exist, as it's a "fake" property returned by OFW FDT getprop itself. Then, if the fdtmemreserv property exists, excise_fdt_reserved() is called,= and it does 2 main things: 1- Excludes reserved memory from available memory regions 2- Excludes FDT memory region itself from available memory In my case, it's the second item that causes a problem later, at moea64_early_bootstrap(). There is one part of this function that checks for overlaps between availab= le memory regions and the region where the kernel was loaded. When this overla= p is found, the available memory list is supposed to be adjusted to exclude kern= el memory. But this code doesn't work correctly for some available memory regions, like the one that is produced by excise_fdt_reserved() when there is an overlap between FDT and kernel end. This is the relevant part of the available regions in my case: 0x00004000 - 0x01800074 (~24MB) 0x0180b04c - 0x02c00000 (~20MB) 0x0344d3f0 - 0x7dbe0000 (~2GB) kernelstart =3D 0x0100100 kernelend =3D 0x1b60000 fdt =3D 0x1b5b000 - 0x1b5f000 (upper bound rounded to page size) When FDT is not used, moea64_early_bootstrap() will adjust the regions like this: 0x00004000 - 0x01000000 0x01b60000 - 0x02c00000 0x0344d3f0 - 0x7dbe0000 And everything works fine. However, when FDT is used, excise_fdt_reserved() will change the available regions to this: 0x00004000 - 0x01800074 0x0180b04c - 0x01b5b000 0x01b5f000 - 0x02c00000 0x0344d3f0 - 0x7dbe0000 And then moea64_early_bootstrap() will adjust the regions and produce this: 0x00004000 - 0x01000000 0x0180b04c - 0x01b5b000 0x01b61000 - 0x02c00000 0x0344d3f0 - 0x7dbe0000 Which turns a large part of the kernel memory (0x0180b04c - 0x01b5b000) into available memory, causing the issue when this region starts being used as s= uch. I'm not sure about the best way to fix this. Maybe one (or more) of the following: 1- Change moea64_early_bootstrap() to make it able to detect and adjust reg= ions such as (0x0180b04c - 0x01b5b000), in which case the whole region should be removed from available list. 2- Change the boot loader to place the FDT after kernelend. And one last thing that I noticed and seems odd to me is that region (0x01800074 - 0x0180b04c) is not reported as available, but even so the ker= nel is loaded at (0x0100100 - 0x1b60000), which includes the not available regi= on. --=20 You are receiving this mail because: You are the assignee for the bug.=