NetBSD Problem Report #49536

From o.vd.linden@quicknet.nl  Sun Jan  4 19:42:28 2015
Return-Path: <o.vd.linden@quicknet.nl>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(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 4B3C3A5B2E
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  4 Jan 2015 19:42:28 +0000 (UTC)
Message-Id: <20150104181857.GA2485@sheep>
Date: Sun, 4 Jan 2015 19:18:57 +0100
From: Onno van der Linden <o.vd.linden@quicknet.nl>
To: gnats-bugs@netbsd.org
Subject: broken drm since changes on dec 14 2014

>Number:         49536
>Category:       kern
>Synopsis:       radeondrm won't work with sources after 14-12-2014 23:40
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    chs
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 04 19:45:00 +0000 2015
>Closed-Date:    Wed Jan 14 05:54:53 +0000 2015
>Last-Modified:  Wed Jan 14 05:54:53 +0000 2015
>Originator:     Onno van der Linden
>Release:        NetBSD 7.99.4
>Organization:

>Environment:


System: NetBSD sheep 7.99.4 NetBSD 7.99.4 (SHEEP) #3: Sun Jan 4 13:58:28 MET 2015 onno@sheep:/usr/src/sys/arch/i386/compile/SHEEP i386
Architecture: i386
Machine: i386
>Description:
Since the drm related mmap changes on Dec 14 2014 the non kms radeondrm driver
won't start X anymore on my i386 with an AGP HD3450.
>How-To-Repeat:
run startx
>Fix:

1) uvm_mmap_dev is called with an uninitialized variable, set it to NULL

--- /sys/external/bsd/drm/dist/bsd-core/drm_bufs.c.orig 2015-01-03 15:01:03.000000000 +0100
+++ /sys/external/bsd/drm/dist/bsd-core/drm_bufs.c      2015-01-04 15:36:34.000000000 +0100
@@ -1122,6 +1122,7 @@
 #elif   defined(__NetBSD__)
        /* XXXNETBSD */
        rsize = round_page(size);
+       addr = NULL;
        retcode = uvm_mmap_dev(curproc, &addr, rsize, dev->kdev, foff);
        vaddr = (vaddr_t)addr;
        DRM_DEBUG("mmap %#lx/%#lx foff %#llx\n", vaddr, rsize, (long long)foff);

2) Kernel with DRM_DEBUG and fix above now gets
[drm_mmap] [drm_mmap] Can't find map, requested offset = 0
and
[    31.716] (II) RADEON(0): [drm] Added 32 65536 byte vertex/indirect buffers
[    31.716] (EE) RADEON(0): [drm] Failed to map vertex/indirect buffers list
[    31.725] (II) RADEON(0): [drm] removed 1 reserved context for kernel
[    31.725] (II) RADEON(0): [drm] unmapping 8192 bytes of SAREA 0xc2987000 at 0xbb400000
[    31.725] (II) RADEON(0): [drm] Closed DRM master.
[    31.725] (WW) RADEON(0): Direct rendering disabled
[    31.733] (EE) RADEON(0): Acceleration initialization failed
[    31.733] (II) RADEON(0): Acceleration disabled


# diff -u `pwd`/uvm_mmap.c.orig `pwd`/uvm_mmap.c
--- /sys/uvm/uvm_mmap.c.orig    2015-01-03 15:27:57.000000000 +0100
+++ /sys/uvm/uvm_mmap.c 2015-01-04 18:23:12.000000000 +0100
@@ -1084,7 +1084,7 @@
                *addrp = (void *)p->p_emul->e_vm_default_addr(p,
                    (vaddr_t)p->p_vmspace->vm_daddr, len);

-       uobj = udv_attach(dev, prot, 0, len);
+       uobj = udv_attach(dev, prot, off, len);
        if (uobj == NULL)
                return EINVAL;


3) with the 2 previous fixes I now get
[drm:pid201:drm_ioctl] [drm:pid201:drm_ioctl] pid=201, cmd=0xc0286429, nr=0x29, dev 0xc2c9a200, auth=1
[drm:pid201:radeon_freelist_get] [drm:pid201:radeon_freelist_get] done_age = -559038737
[drm:pid201:drm_mmap] [drm:pid201:drm_mmap] Can't find map, requested offset = 10000
[drm:pid201:drm_mmap] [drm:pid201:drm_mmap] map offset = 00000000c2984000, handle = 00000000c2984000
[drm:pid201:drm_mmap] [drm:pid201:drm_mmap] map offset = 00000000df000000, handle = 00000000db700000
[drm:pid201:drm_mmap] [drm:pid201:drm_mmap] map offset = 00000000e0000000, handle = 0000000000000000
[drm:pid201:drm_mmap] [drm:pid201:drm_mmap] map offset = 00000000db710000, handle = 00000000db710000
[drm:pid201:drm_mmap] [drm:pid201:drm_mmap] map offset = 00000000db811000, handle = 00000000db811000
[drm:pid201:drm_mmap] [drm:pid201:drm_mmap] map offset = 00000000db812000, handle = 00000000db812000
[drm:pid201:drm_mmap] [drm:pid201:drm_mmap] map offset = 00000000dba12000, handle = 0000000000000000

That offset is way too small.

And then it all crashes due to a SIGSEGV in r600_start_3d()

(And why is the DRM_DEBUG macro printing stuff twice ?)

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->chs
Responsible-Changed-By: chs@NetBSD.org
Responsible-Changed-When: Mon, 05 Jan 2015 19:31:56 +0000
Responsible-Changed-Why:
my fault


From: Onno van der Linden <o.vd.linden@quicknet.nl>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/49536
Date: Tue, 6 Jan 2015 23:00:22 +0100

 My previous fix for uvm_mmap_dev() needs an
 additional fix: the offset parameter in the call
 to uvm_mmap(). With the complete fix below I'm
 not getting the "Can't find map" drm_debug output.
 There's still a "segmentation violation
 at address 0xa8xxxxxx" somewhere (at exit ?)
 which doesn't crash X. Not sure yet where that
 one comes from.


 --- uvm_mmap.c.orig	2015-01-03 15:27:57.000000000 +0100
 +++ uvm_mmap.c	2015-01-06 22:42:51.000000000 +0100
 @@ -1084,13 +1084,13 @@
  		*addrp = (void *)p->p_emul->e_vm_default_addr(p,
  		    (vaddr_t)p->p_vmspace->vm_daddr, len);

 -	uobj = udv_attach(dev, prot, 0, len);
 +	uobj = udv_attach(dev, prot, off, len);
  	if (uobj == NULL)
  		return EINVAL;

  	error = uvm_mmap(&p->p_vmspace->vm_map, (vaddr_t *)addrp,
  			 (vsize_t)len, prot, prot, flags, UVM_ADV_RANDOM,
 -			 uobj, 0, p->p_rlimit[RLIMIT_MEMLOCK].rlim_cur);
 +			 uobj, off, p->p_rlimit[RLIMIT_MEMLOCK].rlim_cur);
  	return error;
  }


 Onno

From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: chs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
    Onno van der Linden <o.vd.linden@quicknet.nl>
Subject: re: kern/49536
Date: Wed, 07 Jan 2015 12:28:31 +1100

 i can confirm that with this patch (and the prior one for drm_bufs.c)
 allows my radeon 4670 laptop to run with old drm again.

From: "Chuck Silvers" <chs@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49536 CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Date: Sat, 10 Jan 2015 23:34:49 +0000

 Module Name:	src
 Committed By:	chs
 Date:		Sat Jan 10 23:34:49 UTC 2015

 Modified Files:
 	src/sys/external/bsd/drm/dist/bsd-core: drm_bufs.c

 Log Message:
 initialize "addr" before passing its address to uvm_mmap_dev().
 from Onno van der Linden in PR 49536.


 To generate a diff of this commit:
 cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c

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

From: "Chuck Silvers" <chs@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49536 CVS commit: src/sys/uvm
Date: Sat, 10 Jan 2015 23:35:02 +0000

 Module Name:	src
 Committed By:	chs
 Date:		Sat Jan 10 23:35:02 UTC 2015

 Modified Files:
 	src/sys/uvm: uvm_mmap.c

 Log Message:
 in uvm_mmap_dev(), use the passed-in offset instead of 0.
 from Onno van der Linden in PR 49536.


 To generate a diff of this commit:
 cvs rdiff -u -r1.150 -r1.151 src/sys/uvm/uvm_mmap.c

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

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49536 CVS commit: [netbsd-7] src/sys/external/bsd/drm/dist/bsd-core
Date: Sun, 11 Jan 2015 06:25:31 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Sun Jan 11 06:25:31 UTC 2015

 Modified Files:
 	src/sys/external/bsd/drm/dist/bsd-core [netbsd-7]: drm_bufs.c

 Log Message:
 Pull up following revision(s) (requested by chs in ticket #402):
 	sys/external/bsd/drm/dist/bsd-core/drm_bufs.c: revision 1.13
 initialize "addr" before passing its address to uvm_mmap_dev().
 from Onno van der Linden in PR 49536.


 To generate a diff of this commit:
 cvs rdiff -u -r1.11.14.1 -r1.11.14.2 \
     src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c

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

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49536 CVS commit: [netbsd-7] src/sys/uvm
Date: Sun, 11 Jan 2015 06:27:40 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Sun Jan 11 06:27:40 UTC 2015

 Modified Files:
 	src/sys/uvm [netbsd-7]: uvm_mmap.c

 Log Message:
 Pull up following revision(s) (requested by chs in ticket #403):
 	sys/uvm/uvm_mmap.c: revision 1.151
 in uvm_mmap_dev(), use the passed-in offset instead of 0.
 from Onno van der Linden in PR 49536.


 To generate a diff of this commit:
 cvs rdiff -u -r1.148.4.1 -r1.148.4.2 src/sys/uvm/uvm_mmap.c

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

From: Chuck Silvers <chuq@chuq.com>
To: gnats-bugs@NetBSD.org
Cc: mrg@netbsd.org
Subject: Re: kern/49536: broken drm since changes on dec 14 2014
Date: Tue, 13 Jan 2015 10:25:49 -0800

 the remaining problem with the X server getting a SEGV when exiting
 appears to be due to something not getting pulled to the netbsd-7 branch.
 this problem doesn't happen with -current userland (even with a
 netbsd-7 kernel).

 -Chuck

From: Onno van der Linden <o.vd.linden@quicknet.nl>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/49536: broken drm since changes on dec 14 2014
Date: Tue, 13 Jan 2015 20:02:21 +0100

 On Tue, Jan 13, 2015 at 06:30:01PM +0000, Chuck Silvers wrote:
 >  the remaining problem with the X server getting a SEGV when exiting
 >  appears to be due to something not getting pulled to the netbsd-7 branch.
 >  this problem doesn't happen with -current userland (even with a
 >  netbsd-7 kernel).

 After recompiling the Xorg server with several older xsrc source trees
 I wasn't able to reproduce the SEGV. Then I proceeded to build the Xorg
 server with the -current sources: no SEGV either ........


 Call can be closed as far as I'm concerned.

 Onno

From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/49536: broken drm since changes on dec 14 2014
Date: Tue, 13 Jan 2015 16:30:18 -0600 (CST)

 Not radeon, but related:

 This commit:

   http://mail-index.netbsd.org/source-changes/2014/12/14/msg061433.html

 Causes X initialization to fail to complete when running a kernel using
 the UMS r128drm kernel driver from 14-Dec-2014 23:49 UTC.  It then
 proceeds to fill up the "/var" filesystem with Xorg.0.log ending in a
 series of messages like:

 [...]
 [   123.364] (II) AIGLX: Screen 0 is not DRI2 capable
 [   123.364] (II) AIGLX: Screen 0 is not DRI capable
 [   123.656] (II) AIGLX: Loaded and initialized /usr/X11R7/lib/modules/dri/swrast_dri.so
 [   123.656] (II) GLX: Initialized DRISWRAST GL provider for screen 0
 [   123.813] (EE) R128(0): R128CCEWaitForIdle: CCE idle -9
 [   123.813] (EE) R128(0): Idle timed out, resetting engine...
 [   123.813] (EE) R128(0): R128CCEWaitForIdle: CCE stop -9
 [   123.813] (EE) R128(0): R128CCEWaitForIdle: CCE start -9
 [   123.813] (EE) R128(0): R128CCEWaitForIdle: CCE idle -9
 [   123.813] (EE) R128(0): Idle timed out, resetting engine...
 [   123.813] (EE) R128(0): R128CCEWaitForIdle: CCE stop -9
 [   123.813] (EE) R128(0): R128CCEWaitForIdle: CCE start -9
 [..., repeats until "/var" is out of space, ...]

 A UMS r128drm kernel from 14-Dec-2014 23:48 UTC produces a working X
 display.

 The symptoms persist in the very latest -current and in netbsd-7 following
 the pullup of the changes in the above-mentioned commit.

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645
 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/49536: broken drm since changes on dec 14 2014
Date: Tue, 13 Jan 2015 19:54:04 -0600 (CST)

 On Tue, 13 Jan 2015, John D. Baker wrote:

 > Not radeon, but related:
 > 
 > This commit:
 > 
 >   http://mail-index.netbsd.org/source-changes/2014/12/14/msg061433.html

 The changes already committed and pulled up for this PR fix the issue
 I was seeing as well.  (I was still bisecting code, but was unable to
 visit the test system's console for almost a week.)

 I confirmed the fix on netbsd-7, will do so with -current soon.

 Thanks.

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/49536: broken drm since changes on dec 14 2014
Date: Tue, 13 Jan 2015 22:21:30 -0600 (CST)

 On Tue, 13 Jan 2015, John D. Baker wrote:

 > I confirmed the fix on netbsd-7, will do so with -current soon.

 Confirmed working.

 Thanks.

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

State-Changed-From-To: open->closed
State-Changed-By: msaitoh@NetBSD.org
State-Changed-When: Wed, 14 Jan 2015 05:54:53 +0000
State-Changed-Why:
Fixed and pulled up.
Thanks.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.