NetBSD Problem Report #52229

From www@NetBSD.org  Fri May 12 00:49:11 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 277A47A210
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 12 May 2017 00:49:11 +0000 (UTC)
Message-Id: <20170512004910.401817A2B0@mollari.NetBSD.org>
Date: Fri, 12 May 2017 00:49:10 +0000 (UTC)
From: venture37@geeklan.co.uk
Reply-To: venture37@geeklan.co.uk
To: gnats-bugs@NetBSD.org
Subject: 11" mid-2012 MacBook Air crashes very early in boot from UEFI
X-Send-Pr-Version: www-1.0

>Number:         52229
>Category:       kern
>Synopsis:       11" mid-2012 MacBook Air crashes very early in boot from UEFI
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 12 00:50:00 +0000 2017
>Closed-Date:    Sun Aug 18 11:02:05 +0000 2019
>Last-Modified:  Sun Aug 18 11:02:05 +0000 2019
>Originator:     Sevan Janiyan
>Release:        NetBSD-HEAD
>Organization:
>Environment:
>Description:
Attempting to boot the latest NetBSD-7.99.71-amd64-uefi-install.img on a MacBookAir5,1 results in a crash.
System in question has 8GB of RAM but kernel only reports 512MB

Photos of crash along with output from memmap & efivar commands can be found at 
http://www.netbsd.org/~sevan/mbp2012/
>How-To-Repeat:
Boot NetBSD-7.99.71-amd64-uefi-install.img on a 11" mid-2012 MacBook Air
>Fix:

>Release-Note:

>Audit-Trail:
From: Sevan Janiyan <venture37@geeklan.co.uk>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/52229: 11" mid-2012 MacBook Air crashes very early in boot
 from UEFI
Date: Tue, 13 Feb 2018 22:43:17 +0000

 As stated in kern/52995 (duplicate pr) and in the photos linked to in
 this PR, the kernel panics on efi_getsystbl() when booting on a Mac.

 I recompiled a kernel with options DDB_COMMANDONENTER="bt" set & tried
 booting it on a white late 2009 Macbook (mentioned in pr 52995).
 System panicked as expected and I now have a backtrace.

 vpanic()
 snprintf()
 kmem_alloc()
 AcpiUtUpdateRefCount()
 AcpiUtUpdateObjectReference()
 AcpiRsSetSrsMethodData()
 AcpiSetCurrentResources()
 acpi_pci_link_srs()
 acpi_pci_link_route_interrupt()
 mpacpi_findintr_linkdev()
 intr_find_mpmapping()
 pci_intr_map()
 ohci_pci_attach()
 config_attach_loc()
 pci_probe_device()
 pci_enumerate_bus()
 pcirescan()
 pciattach()
 config_attach_loc()
 mp_pci_scan()
 mainbus_attach()
 config_attach_loc()
 cpu_configure()
 main()

 Photo of the backtrace http://www.netbsd.org/~sevan/pr-52229.jpg


 Sevan

From: coypu@sdf.org
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/52229: 11" mid-2012 MacBook Air crashes very early in boot
 from UEFI
Date: Fri, 27 Apr 2018 09:38:41 +0000

 this might even be the same laptop as
 https://mjg59.dreamwidth.org/11235.html

 https://twitter.com/whitequark/status/989585717419372544 mentions the
 fix

From: Sevan Janiyan <venture37@geeklan.co.uk>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/52229: 11" mid-2012 MacBook Air crashes very early in boot
 from UEFI
Date: Sat, 18 Aug 2018 13:09:14 +0100

 With the update of gnu-efi this week, I thought I'd try booting today's
 daily build to see if anything had changed and it looks like they have.
 The system still blows up in efi_getsystbl but now I have a different
 message / backtrace.
 panic: kernel diagnostic assertion "va < VM_MIN_KERNEL_ADDRESS" failed:
 file "./x86/pmap.h", line 491
 cpu0: Begin traceback...
 vpanic() at netbsd:vpanic+0x16f
 ch_voltag_convert_in() at netbsd:ch_voltag_covert_in
 db_disasm() at netbsd:db_disasm+0x10b
 db_trap() at netbsd:db_trap+0xf7
 kdb_trap() at netbsd:kdb_trap+0xe2
 trap() at netbsd:trap+0x51a
 --- trap (number 6) ---
 efi_getsystbl.part.4() at netbsd:efi_getsystbl.part.4+0x4c
 efi_init() at netbsd:efi_init+0x2d
 cpu_configure() at netbsd:cpu_configure+0xe
 main() at netbsd:main+0x331
 cpu0: End trackback
 fatal breakpoint trap in supervisor mode
 trap type 1 code 0 rip 0xffffffff8021de45 cs 0x8 rflags 0x202 cr2
 0xffffec319068ee20 ilevel 0x8 rsp 0xffffffff817fc9e0
 curlwp 0xffffffff81456c40 pid 0.1 lowest kstack 0xffffffff817f82c0
 Stopped in pid 0.0 (system) at netbsd:breakpoint+0x5: leave

From: Rin Okuyama <rokuyama.rk@gmail.com>
To: "gnats-bugs@NetBSD.org" <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: kern/52229: 11" mid-2012 MacBook Air crashes very early in boot
 from UEFI
Date: Thu, 15 Aug 2019 09:19:44 +0900

 This has been fixed by recent works by nonaka:

 - Increase BOOTINFO_MAXSIZE to 16Kib.
 http://cvsweb.netbsd.org/cgi-bin/cvsweb.cgi/src/sys/arch/x86/include/bootinfo.h#rev1.30

 - x86 efiboot: version 1.1.
 http://cvsweb.netbsd.org/cgi-bin/cvsweb.cgi/src/sys/arch/i386/stand/efiboot/version#rev1.2

 These are already in netbsd-9.

 Now, the following machines boot successfully with efiboot:

 - MacBookAir5,2 (Ivy Bridge, 13-inch, Mid 2012)
 - MacBookAir6,1 (Haswell, 11-inch, Early 2014)

 There are still problems in intelfb(4) on these machines.
 Fix by myself is coming soon.

From: Rin Okuyama <rokuyama.rk@gmail.com>
To: "gnats-bugs@NetBSD.org" <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: kern/52229: 11" mid-2012 MacBook Air crashes very early in boot
 from UEFI
Date: Thu, 15 Aug 2019 09:35:08 +0900

 This is a multi-part message in MIME format.
 --------------D158511EF2594BD842AB5AB7
 Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes
 Content-Transfer-Encoding: 7bit

 Oops, PR indicator was missing. Forward by hand.

 -------- Forwarded Message --------
 Subject: CVS commit: src/sys/external/bsd/drm2/i915drm
 Date: Thu, 15 Aug 2019 00:27:47 +0000
 From: Rin Okuyama <rin@netbsd.org>
 Reply-To: source-changes-d@NetBSD.org
 To: source-changes-full@NetBSD.org

 Module Name:	src
 Committed By:	rin
 Date:		Thu Aug 15 00:27:47 UTC 2019

 Modified Files:
 	src/sys/external/bsd/drm2/i915drm: intelfb.c

 Log Message:
 kern/52229

 Correct linebytes (stride) for intelfb(4), which fixes screen
 corruption on the following machines:

 - MacBookAir5,2 (Ivy Bridge, 13-inch, Mid 2012)
 - MacBookAir6,1 (Haswell, 11-inch, Early 2014)

 Now, wsdisplay(4) console as well as intel(4) driver of Xorg
 works fine on these machines.

 Also there's no side effects found on another machine:

 - ThinkPad T480s (Kaby Lake R)

 XXX
 pullup to netbsd-9


 To generate a diff of this commit:
 cvs rdiff -u -r1.16 -r1.17 src/sys/external/bsd/drm2/i915drm/intelfb.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.



 --------------D158511EF2594BD842AB5AB7
 Content-Type: text/x-diff;
  name="=?UTF-8?B?5re75LuY44Oh44OD44K744O844K46YOo?="
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename*0*=iso-2022-jp''%1B%24%42%45%3A%49%55%25%61%25%43%25%3B%21%3C%25;
  filename*1*=%38%49%74%1B%28%42

 Modified files:

 Index: src/sys/external/bsd/drm2/i915drm/intelfb.c
 diff -u src/sys/external/bsd/drm2/i915drm/intelfb.c:1.16 src/sys/external/bsd/drm2/i915drm/intelfb.c:1.17
 --- src/sys/external/bsd/drm2/i915drm/intelfb.c:1.16	Sat Dec  1 01:56:30 2018
 +++ src/sys/external/bsd/drm2/i915drm/intelfb.c	Thu Aug 15 00:27:47 2019
 @@ -1,4 +1,4 @@
 -/*	$NetBSD: intelfb.c,v 1.16 2018/12/01 01:56:30 msaitoh Exp $	*/
 +/*	$NetBSD: intelfb.c,v 1.17 2019/08/15 00:27:47 rin Exp $	*/

  /*-
   * Copyright (c) 2014 The NetBSD Foundation, Inc.
 @@ -30,7 +30,7 @@
   */

  #include <sys/cdefs.h>
 -__KERNEL_RCSID(0, "$NetBSD: intelfb.c,v 1.16 2018/12/01 01:56:30 msaitoh Exp $");
 +__KERNEL_RCSID(0, "$NetBSD: intelfb.c,v 1.17 2019/08/15 00:27:47 rin Exp $");

  #include <sys/types.h>
  #include <sys/bus.h>
 @@ -166,14 +166,12 @@ intelfb_attach_task(struct i915drmkms_ta
  	struct intelfb_softc *const sc = container_of(task,
  	    struct intelfb_softc, sc_attach_task);
  	const struct intelfb_attach_args *const ifa = &sc->sc_ifa;
 -	const struct drm_fb_helper_surface_size *const sizes = &ifa->ifa_fb_sizes;
  	const struct drmfb_attach_args da = {
  		.da_dev = sc->sc_dev,
  		.da_fb_helper = ifa->ifa_fb_helper,
  		.da_fb_sizes = &ifa->ifa_fb_sizes,
  		.da_fb_vaddr = bus_space_vaddr(ifa->ifa_fb_bst, sc->sc_fb_bsh),
 -		.da_fb_linebytes = roundup2((sizes->surface_width *
 -		    howmany(sizes->surface_bpp, 8)), 64),
 +		.da_fb_linebytes = ifa->ifa_fb_helper->fb->pitches[0],
  		.da_params = &intelfb_drmfb_params,
  	};
  	int error;



 --------------D158511EF2594BD842AB5AB7--

State-Changed-From-To: open->pending-pullups
State-Changed-By: rin@NetBSD.org
State-Changed-When: Sun, 18 Aug 2019 07:56:24 +0000
State-Changed-Why:
[pullup-9 #85]


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52229 CVS commit: [netbsd-9] src/sys/external/bsd/drm2/i915drm
Date: Sun, 18 Aug 2019 09:57:40 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun Aug 18 09:57:40 UTC 2019

 Modified Files:
 	src/sys/external/bsd/drm2/i915drm [netbsd-9]: intelfb.c

 Log Message:
 Pull up following revision(s) (requested by rin in ticket #85):

 	sys/external/bsd/drm2/i915drm/intelfb.c: revision 1.17

 PR kern/52229:

 Correct linebytes (stride) for intelfb(4), which fixes screen
 corruption on the following machines:
 - MacBookAir5,2 (Ivy Bridge, 13-inch, Mid 2012)
 - MacBookAir6,1 (Haswell, 11-inch, Early 2014)

 Now, wsdisplay(4) console as well as intel(4) driver of Xorg
 works fine on these machines.

 Also there's no side effects found on another machine:
 - ThinkPad T480s (Kaby Lake R)

 XXX
 pullup to netbsd-9


 To generate a diff of this commit:
 cvs rdiff -u -r1.16 -r1.16.4.1 src/sys/external/bsd/drm2/i915drm/intelfb.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->feedback
State-Changed-By: rin@NetBSD.org
State-Changed-When: Sun, 18 Aug 2019 10:04:50 +0000
State-Changed-Why:
pullup done. Sevan, could you confirm fix?


From: Sevan Janiyan <venture37@geeklan.co.uk>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/52229 (11" mid-2012 MacBook Air crashes very early in boot
 from UEFI)
Date: Sun, 18 Aug 2019 11:07:02 +0100

 On 18/08/2019 11:04, rin@NetBSD.org wrote:
 > pullup done. Sevan, could you confirm fix?

 I'm literally in the process of dding the latest daily build to a usb
 stick to try :)


 Sevan

From: Sevan Janiyan <venture37@geeklan.co.uk>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/52229 (11" mid-2012 MacBook Air crashes very early in boot
 from UEFI)
Date: Sun, 18 Aug 2019 11:52:06 +0100

 On 18/08/2019 11:04, rin@NetBSD.org wrote:
 > pullup done. Sevan, could you confirm fix?

 That works :) thank you for working on this
 dmesg:
 https://dmesgd.nycbug.org/index.cgi?do=view&id=5096

State-Changed-From-To: feedback->closed
State-Changed-By: rin@NetBSD.org
State-Changed-When: Sun, 18 Aug 2019 11:02:05 +0000
State-Changed-Why:
Fix confirmed. Thanks!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.