On Sun, 10 Mar 2013, Brandon Gooch wrote:

On Sun, Mar 10, 2013 at 1:17 AM, AN <a...@neu.net> wrote:

FreeBSD FBSD10 10.0-CURRENT FreeBSD 10.0-CURRENT #36 r248127: Sun Mar 10 
00:13:59 CST 2013     root@FBSD10:/usr/obj/usr/src/sys/MYKERNEL  amd64

/usr/ports/x11/nvidia-driver is broken, probably by this commit:
http://svnweb.freebsd.org/base?view=revision&revision=248084

From commit log:"The KPI results heavilly broken by this commit.  Thirdy part ports 
must be updated accordingly (I can think off-hand of VirtualBox, for example)."



root@FBSD10 /usr/ports/x11/nvidia-driver]# make clean
===>  Cleaning for nvidia-driver-310.32
[root@FBSD10 /usr/ports/x11/nvidia-driver]# make install clean
===>  License NVIDIA accepted by the user
===>  Found saved configuration for nvidia-driver-304.64
===>   nvidia-driver-310.32 depends on file: /usr/local/sbin/pkg - found
===>  Extracting for nvidia-driver-310.32
=> SHA256 Checksum OK for NVIDIA-FreeBSD-x86_64-310.32.tar.gz.
===>  Patching for nvidia-driver-310.32
===>  Applying extra patch 
/usr/ports/x11/nvidia-driver/files/r246085-patch-src-nvidia_linux.c
===>   nvidia-driver-310.32 depends on file: 
/usr/local/libdata/pkgconfig/xorg-server.pc - found
===>   nvidia-driver-310.32 depends on shared library: GL.1 - found
===>  Configuring for nvidia-driver-310.32
===>  Building for nvidia-driver-310.32
===> src (all)
@ -> /usr/src/sys
machine -> /usr/src/sys/amd64/include
x86 -> /usr/src/sys/x86/include
awk -f @/tools/makeobjops.awk @/kern/device_if.m -h
awk -f @/tools/makeobjops.awk @/kern/bus_if.m -h
awk -f @/tools/makeobjops.awk @/dev/pci/pci_if.m -h
awk -f @/tools/vnode_if.awk @/kern/vnode_if.src -p
awk -f @/tools/vnode_if.awk @/kern/vnode_if.src -q
awk -f @/tools/vnode_if.awk @/kern/vnode_if.src -h
cc -O2 -pipe -fno-strict-aliasing -DNV_VERSION_STRING=\"310.32\" -D__KERNEL__ 
-DNVRM -Wno-unused-function -Wuninitialized -O -mno-red-zone -mcmodel=kernel -UDEBUG 
-U_DEBUG -DNDEBUG -Werror -D_KERNEL -DKLD_MODULE -nostdinc  -I. -I. -I@ -I@/contrib/altq 
-fno-common -fno-omit-frame-pointer  -mno-aes -mno-avx -mcmodel=kernel -mno-red-zone 
-mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding 
-fstack-protector -std=iso9899:1999 -Qunused-arguments -fstack-protector -Wall 
-Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes 
-Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions 
-Wmissing-include-dirs -fdiagnostics-show-option -Wno-error-tautological-compare 
-Wno-error-empty-body -Wno-error-parentheses-equality -c nvidia_ctl.c
In file included from nvidia_ctl.c:14:
In file included from ./nv-freebsd.h:77:
@/vm/vm_pager.h:127:2: error: implicit declaration of function 'rw_assert' is 
invalid in C99 [-Werror,-Wimplicit-function-declaration]
        VM_OBJECT_ASSERT_WLOCKED(object);
        ^
@/vm/vm_object.h:212:2: note: expanded from macro 'VM_OBJECT_ASSERT_WLOCKED'
        rw_assert(&(object)->lock, RA_WLOCKED)
        ^
In file included from nvidia_ctl.c:14:
In file included from ./nv-freebsd.h:77:
@/vm/vm_pager.h:127:2: error: use of undeclared identifier 'RA_WLOCKED'
        VM_OBJECT_ASSERT_WLOCKED(object);
        ^
@/vm/vm_object.h:212:29: note: expanded from macro 'VM_OBJECT_ASSERT_WLOCKED'
        rw_assert(&(object)->lock, RA_WLOCKED)
                                   ^
In file included from nvidia_ctl.c:14:
In file included from ./nv-freebsd.h:77:
@/vm/vm_pager.h:144:2: error: use of undeclared identifier 'RA_WLOCKED'
        VM_OBJECT_ASSERT_WLOCKED(object);
        ^
@/vm/vm_object.h:212:29: note: expanded from macro 'VM_OBJECT_ASSERT_WLOCKED'
        rw_assert(&(object)->lock, RA_WLOCKED)
                                   ^
In file included from nvidia_ctl.c:14:
In file included from ./nv-freebsd.h:77:
@/vm/vm_pager.h:168:2: error: use of undeclared identifier 'RA_WLOCKED'
        VM_OBJECT_ASSERT_WLOCKED(object);
        ^
@/vm/vm_object.h:212:29: note: expanded from macro 'VM_OBJECT_ASSERT_WLOCKED'
        rw_assert(&(object)->lock, RA_WLOCKED)
                                   ^
In file included from nvidia_ctl.c:14:
In file included from ./nv-freebsd.h:77:
@/vm/vm_pager.h:191:2: error: use of undeclared identifier 'RA_WLOCKED'
        VM_OBJECT_ASSERT_WLOCKED(m->object);
        ^
@/vm/vm_object.h:212:29: note: expanded from macro 'VM_OBJECT_ASSERT_WLOCKED'
        rw_assert(&(object)->lock, RA_WLOCKED)
                                   ^
5 errors generated.
*** [nvidia_ctl.o] Error code 1

Stop in /usr/ports/x11/nvidia-driver/work/NVIDIA-FreeBSD-x86_64-310.32/src.
*** [all] Error code 1

Stop in /usr/ports/x11/nvidia-driver/work/NVIDIA-FreeBSD-x86_64-310.32.
*** [do-build] Error code 1

Stop in /usr/ports/x11/nvidia-driver.
*** [install] Error code 1

Stop in /usr/ports/x11/nvidia-driver.
[root@FBSD10 /usr/ports/x11/nvidia-driver]#


Place the following diff in a file at
/usr/ports/x11/nvidia-driver/files/patch-r248084-vm-locking-changes.diff
(assuming your ports tree is at /usr/ports; adjust accordingly):

--- src/nv-freebsd.h    2013-03-10 11:29:12.000000000 -0500
+++ src/nv-freebsd.h    2013-03-10 11:23:12.000000000 -0500
@@ -59,6 +59,7 @@
#include <sys/mman.h>
#include <sys/file.h>
#include <sys/poll.h>
+#include <sys/rwlock.h>

#include <sys/syscall.h>
#include <sys/bus.h>
--- src/nvidia_subr.c   2013-03-10 11:22:19.000000000 -0500
+++ src/nvidia_subr.c   2013-03-10 11:24:27.000000000 -0500
@@ -83,7 +83,7 @@
            if (!sc->BAR_objects[i])
                goto failed;

-            VM_OBJECT_LOCK(sc->BAR_objects[i]);
+            VM_OBJECT_WLOCK(sc->BAR_objects[i]);
            switch (i) {
                case NV_GPU_BAR_INDEX_FB:
                    vm_object_set_memattr(sc->BAR_objects[i],
@@ -95,7 +95,7 @@
                            VM_MEMATTR_UNCACHEABLE);
                    break;
            }
-            VM_OBJECT_UNLOCK(sc->BAR_objects[i]);
+            VM_OBJECT_WUNLOCK(sc->BAR_objects[i]);
        }
    }

@@ -541,9 +541,9 @@
                goto failed;
            }

-            VM_OBJECT_LOCK(sc->UD_object);
+            VM_OBJECT_WLOCK(sc->UD_object);
            vm_object_set_memattr(sc->UD_object, VM_MEMATTR_UNCACHEABLE);
-            VM_OBJECT_UNLOCK(sc->UD_object);
+            VM_OBJECT_WUNLOCK(sc->UD_object);
        }

        nv->flags |= NV_FLAG_OPEN;
@@ -965,9 +965,9 @@
        goto failed;
    }

-    VM_OBJECT_LOCK(at->object);
+    VM_OBJECT_WLOCK(at->object);
    vm_object_set_memattr(at->object, attr);
-    VM_OBJECT_UNLOCK(at->object);
+    VM_OBJECT_WUNLOCK(at->object);

    *private = at;
    SLIST_INSERT_HEAD(&sc->alloc_list, at, list);
@@ -1108,9 +1108,9 @@
        goto failed;
    }

-    VM_OBJECT_LOCK(at->object);
+    VM_OBJECT_WLOCK(at->object);
    vm_object_set_memattr(at->object, attr);
-    VM_OBJECT_UNLOCK(at->object);
+    VM_OBJECT_WUNLOCK(at->object);

    *private = at;
    SLIST_INSERT_HEAD(&sc->alloc_list, at, list);





-Brandon


I can confirm that with the attached patch, nvidia-driver is working again. Thank you Brandon for the quick fix.
_______________________________________________
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"

Reply via email to