From nobody@FreeBSD.org  Sun Aug 18 22:52:02 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTP id F4061CCA
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 18 Aug 2013 22:52:01 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id E104121AA
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 18 Aug 2013 22:52:01 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r7IMq1B7048996
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 18 Aug 2013 22:52:01 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r7IMq0X8048945;
	Sun, 18 Aug 2013 22:52:00 GMT
	(envelope-from nobody)
Message-Id: <201308182252.r7IMq0X8048945@oldred.freebsd.org>
Date: Sun, 18 Aug 2013 22:52:00 GMT
From: AN <andy@neu.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: CURRENT crashes with nvidia GPU BLOB : vm_radix_insert: key 23c078 is already present
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         181387
>Category:       ports
>Synopsis:       x11/nvidia-driver: CURRENT crashes with nvidia GPU BLOB : vm_radix_insert: key 23c078 is already present
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    danfe
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 18 23:00:00 UTC 2013
>Closed-Date:    Thu Aug 22 14:02:50 UTC 2013
>Last-Modified:  Thu Aug 22 14:02:50 UTC 2013
>Originator:     AN
>Release:        10-current
>Organization:
>Environment:
FreeBSD FBSD10 10.0-CURRENT FreeBSD 10.0-CURRENT #79 r254497: Sun Aug 18 15:52:31 CDT 2013     root@FBSD10:/usr/obj/usr/src/sys/MYKERNEL  amd64

nvidia-driver-319.32           NVidia graphics card binary drivers for hardware OpenGL rendering
>Description:
complete deadlock and reboot on starting X (startx from command line)

---------------------------------------------------------------------------------
Yes, I can confirm, that it builds, installs and runs fine for me.

The patch should be placed as
x11/nvidia-driver/files/patch-src__nvidia_subr.c, shoudn't it?

Many thanks for this work.

Regards and a nice weekend,
Rainer Hurling

---------------------------------------------------------------------------------

I also confirm the patch works on current at r254497 (AN).
>How-To-Repeat:
startx
>Fix:
Patch written by: Gary Jennejohn <gljennjohn@googlemail.com>

I am only submitting the patch as a PR.

http://docs.freebsd.org/cgi/getmsg.cgi?fetch=989426+0+archive/2013/freebsd-current/20130811.freebsd-current

http://docs.freebsd.org/cgi/getmsg.cgi?fetch=978445+0+archive/2013/freebsd-current/20130811.freebsd-current

The REINPLACE_CMD at line 160 of nvidia-driver/Makefile is incorrect.

How do I know that?  Because I made a patch which results in a working
nvidia-driver-319.32 with r254050.  That's what I'm running right now.

Here's the patch (loaded with :r in vi, so all spaces etc. are correct):

--- src/nvidia_subr.c.orig	2013-08-09 11:32:26.000000000 +0200
+++ src/nvidia_subr.c	2013-08-09 11:33:23.000000000 +0200
@@ -945,7 +945,7 @@
         return ENOMEM;
     }
 
-    address = kmem_alloc_contig(kernel_map, size, flags, 0,
+    address = kmem_alloc_contig(kmem_arena, size, flags, 0,
             sc->dma_mask, PAGE_SIZE, 0, attr);
     if (!address) {
         status = ENOMEM;
@@ -994,7 +994,7 @@
         os_flush_cpu_cache();
 
     if (at->pte_array[0].virtual_address != NULL) {
-        kmem_free(kernel_map,
+        kmem_free(kmem_arena,
                 at->pte_array[0].virtual_address, at->size);
         malloc_type_freed(M_NVIDIA, at->size);
     }
@@ -1021,7 +1021,7 @@
     if (at->attr != VM_MEMATTR_WRITE_BACK)
         os_flush_cpu_cache();
 
-    kmem_free(kernel_map, at->pte_array[0].virtual_address,
+    kmem_free(kmem_arena, at->pte_array[0].virtual_address,
             at->size);
     malloc_type_freed(M_NVIDIA, at->size);
 
@@ -1085,7 +1085,7 @@
     }
 
     for (i = 0; i < count; i++) {
-        address = kmem_alloc_contig(kernel_map, PAGE_SIZE, flags, 0,
+        address = kmem_alloc_contig(kmem_arena, PAGE_SIZE, flags, 0,
                 sc->dma_mask, PAGE_SIZE, 0, attr);
         if (!address) {
             status = ENOMEM;
@@ -1139,7 +1139,7 @@
     for (i = 0; i < count; i++) {
         if (at->pte_array[i].virtual_address == 0)
             break;
-        kmem_free(kernel_map,
+        kmem_free(kmem_arena,
                 at->pte_array[i].virtual_address, PAGE_SIZE);
         malloc_type_freed(M_NVIDIA, PAGE_SIZE);
     }
@@ -1169,7 +1169,7 @@
         os_flush_cpu_cache();
 
     for (i = 0; i < count; i++) {
-        kmem_free(kernel_map,
+        kmem_free(kmem_arena,
                 at->pte_array[i].virtual_address, PAGE_SIZE);
         malloc_type_freed(M_NVIDIA, PAGE_SIZE);
     }


Thanks to Gary for the fix.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->danfe 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Mon Aug 19 01:09:05 UTC 2013 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=181387 
State-Changed-From-To: open->feedback 
State-Changed-By: danfe 
State-Changed-When: Thu Aug 22 07:12:34 UTC 2013 
State-Changed-Why:  
Can you update your ports tree to revision r325027 (or higher), and tell me 
if you still observe this problem?  Thank you. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=181387 
State-Changed-From-To: feedback->closed 
State-Changed-By: danfe 
State-Changed-When: Thu Aug 22 14:02:11 UTC 2013 
State-Changed-Why:  
Everything should work now per original submitter's feedback. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=181387 
>Unformatted:
