Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2 This code should be MP-safe. Use IPL_S...



details:   https://anonhg.NetBSD.org/src/rev/8a317f220004
branches:  trunk
changeset: 333443:8a317f220004
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Nov 04 11:27:31 2014 +0000

description:
This code should be MP-safe. Use IPL_SCHED in place of IPL_DRM/IPL_VM and set
D_MPSAFE flag in cdevsw.

diffstat:

 sys/external/bsd/drm2/drm/drm_drv.c                |  7 +++----
 sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h |  4 +---
 sys/external/bsd/drm2/include/linux/spinlock.h     |  5 ++---
 sys/external/bsd/drm2/include/linux/ww_mutex.h     |  4 ++--
 sys/external/bsd/drm2/linux/linux_idr.c            |  8 ++++----
 sys/external/bsd/drm2/linux/linux_kmap.c           |  8 ++++----
 sys/external/bsd/drm2/linux/linux_work.c           |  8 ++++----
 sys/external/bsd/drm2/linux/linux_writecomb.c      |  6 +++---
 sys/external/bsd/drm2/pci/drm_pci.c                |  6 +++---
 9 files changed, 26 insertions(+), 30 deletions(-)

diffs (234 lines):

diff -r dc4d8bce1dcf -r 8a317f220004 sys/external/bsd/drm2/drm/drm_drv.c
--- a/sys/external/bsd/drm2/drm/drm_drv.c       Tue Nov 04 09:17:31 2014 +0000
+++ b/sys/external/bsd/drm2/drm/drm_drv.c       Tue Nov 04 11:27:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_drv.c,v 1.9 2014/07/26 21:15:45 riastradh Exp $    */
+/*     $NetBSD: drm_drv.c,v 1.10 2014/11/04 11:27:31 jmcneill Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.9 2014/07/26 21:15:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.10 2014/11/04 11:27:31 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -234,8 +234,7 @@
        .d_kqfilter = nokqfilter,
        .d_discard = nodiscard,
        /* XXX was D_TTY | D_NEGOFFSAFE */
-       /* XXX Add D_MPSAFE some day... */
-       .d_flag = D_NEGOFFSAFE,
+       .d_flag = D_NEGOFFSAFE | D_MPSAFE,
 };
 
 static const struct fileops drm_fileops = {
diff -r dc4d8bce1dcf -r 8a317f220004 sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h
--- a/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h        Tue Nov 04 09:17:31 2014 +0000
+++ b/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h        Tue Nov 04 11:27:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_irq_netbsd.h,v 1.2 2014/03/18 18:20:43 riastradh Exp $     */
+/*     $NetBSD: drm_irq_netbsd.h,v 1.3 2014/11/04 11:27:31 jmcneill Exp $      */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -41,6 +41,4 @@
 
 #define        IRQF_SHARED     0       /* XXX */
 
-#define        IPL_DRM         IPL_TTY /* XXX */
-
 #endif  /* _DRM_DRM_IRQ_NETBSD_H_ */
diff -r dc4d8bce1dcf -r 8a317f220004 sys/external/bsd/drm2/include/linux/spinlock.h
--- a/sys/external/bsd/drm2/include/linux/spinlock.h    Tue Nov 04 09:17:31 2014 +0000
+++ b/sys/external/bsd/drm2/include/linux/spinlock.h    Tue Nov 04 11:27:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: spinlock.h,v 1.4 2014/08/23 08:03:33 riastradh Exp $   */
+/*     $NetBSD: spinlock.h,v 1.5 2014/11/04 11:27:31 jmcneill Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -88,8 +88,7 @@
 static inline void
 spin_lock_init(spinlock_t *spinlock)
 {
-       /* XXX What's the right IPL?  IPL_DRM...?  */
-       mutex_init(&spinlock->sl_lock, MUTEX_DEFAULT, IPL_VM);
+       mutex_init(&spinlock->sl_lock, MUTEX_DEFAULT, IPL_SCHED);
 }
 
 /*
diff -r dc4d8bce1dcf -r 8a317f220004 sys/external/bsd/drm2/include/linux/ww_mutex.h
--- a/sys/external/bsd/drm2/include/linux/ww_mutex.h    Tue Nov 04 09:17:31 2014 +0000
+++ b/sys/external/bsd/drm2/include/linux/ww_mutex.h    Tue Nov 04 11:27:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ww_mutex.h,v 1.7 2014/09/15 20:24:55 riastradh Exp $   */
+/*     $NetBSD: ww_mutex.h,v 1.8 2014/11/04 11:27:31 jmcneill Exp $    */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -147,7 +147,7 @@
         * XXX Apparently Linux takes these with spin locks held.  That
         * strikes me as a bad idea, but so it is...
         */
-       mutex_init(&mutex->wwm_lock, MUTEX_DEFAULT, IPL_VM);
+       mutex_init(&mutex->wwm_lock, MUTEX_DEFAULT, IPL_SCHED);
        mutex->wwm_state = WW_UNLOCKED;
        mutex->wwm_class = class;
        rb_tree_init(&mutex->wwm_waiters, &ww_acquire_ctx_rb_ops);
diff -r dc4d8bce1dcf -r 8a317f220004 sys/external/bsd/drm2/linux/linux_idr.c
--- a/sys/external/bsd/drm2/linux/linux_idr.c   Tue Nov 04 09:17:31 2014 +0000
+++ b/sys/external/bsd/drm2/linux/linux_idr.c   Tue Nov 04 11:27:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_idr.c,v 1.3 2014/07/16 20:56:25 riastradh Exp $  */
+/*     $NetBSD: linux_idr.c,v 1.4 2014/11/04 11:27:31 jmcneill Exp $   */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_idr.c,v 1.3 2014/07/16 20:56:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_idr.c,v 1.4 2014/11/04 11:27:31 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -58,7 +58,7 @@
 linux_idr_module_init(void)
 {
 
-       mutex_init(&idr_cache.lock, MUTEX_DEFAULT, IPL_VM);
+       mutex_init(&idr_cache.lock, MUTEX_DEFAULT, IPL_SCHED);
        SIMPLEQ_INIT(&idr_cache.preloaded_nodes);
        SIMPLEQ_INIT(&idr_cache.discarded_nodes);
        return 0;
@@ -115,7 +115,7 @@
 idr_init(struct idr *idr)
 {
 
-       mutex_init(&idr->idr_lock, MUTEX_DEFAULT, IPL_VM);
+       mutex_init(&idr->idr_lock, MUTEX_DEFAULT, IPL_SCHED);
        rb_tree_init(&idr->idr_tree, &idr_rb_ops);
 }
 
diff -r dc4d8bce1dcf -r 8a317f220004 sys/external/bsd/drm2/linux/linux_kmap.c
--- a/sys/external/bsd/drm2/linux/linux_kmap.c  Tue Nov 04 09:17:31 2014 +0000
+++ b/sys/external/bsd/drm2/linux/linux_kmap.c  Tue Nov 04 11:27:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_kmap.c,v 1.10 2014/08/27 16:41:50 riastradh Exp $        */
+/*     $NetBSD: linux_kmap.c,v 1.11 2014/11/04 11:27:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_kmap.c,v 1.10 2014/08/27 16:41:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_kmap.c,v 1.11 2014/11/04 11:27:31 jmcneill Exp $");
 
 #include <sys/types.h>
 #include <sys/kmem.h>
@@ -104,8 +104,8 @@
 linux_kmap_init(void)
 {
 
-       /* IPL_VM since interrupt handlers use kmap_atomic.  */
-       mutex_init(&linux_kmap_atomic_lock, MUTEX_DEFAULT, IPL_VM);
+       /* IPL_SCHED since interrupt handlers use kmap_atomic.  */
+       mutex_init(&linux_kmap_atomic_lock, MUTEX_DEFAULT, IPL_SCHED);
 
        linux_kmap_atomic_vaddr = uvm_km_alloc(kernel_map, PAGE_SIZE, 0,
            (UVM_KMF_VAONLY | UVM_KMF_WAITVA));
diff -r dc4d8bce1dcf -r 8a317f220004 sys/external/bsd/drm2/linux/linux_work.c
--- a/sys/external/bsd/drm2/linux/linux_work.c  Tue Nov 04 09:17:31 2014 +0000
+++ b/sys/external/bsd/drm2/linux/linux_work.c  Tue Nov 04 11:27:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_work.c,v 1.8 2014/08/29 15:22:18 riastradh Exp $ */
+/*     $NetBSD: linux_work.c,v 1.9 2014/11/04 11:27:31 jmcneill Exp $  */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.8 2014/08/29 15:22:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.9 2014/11/04 11:27:31 jmcneill Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -123,13 +123,13 @@
 
        wq = kmem_alloc(sizeof(*wq), KM_SLEEP);
        error = workqueue_create(&wq->wq_workqueue, name, &linux_worker,
-           wq, PRI_NONE, IPL_VM, flags);
+           wq, PRI_NONE, IPL_SCHED, flags);
        if (error) {
                kmem_free(wq, sizeof(*wq));
                return NULL;
        }
 
-       mutex_init(&wq->wq_lock, MUTEX_DEFAULT, IPL_VM);
+       mutex_init(&wq->wq_lock, MUTEX_DEFAULT, IPL_SCHED);
        cv_init(&wq->wq_cv, name);
        TAILQ_INIT(&wq->wq_delayed);
        wq->wq_current_work = NULL;
diff -r dc4d8bce1dcf -r 8a317f220004 sys/external/bsd/drm2/linux/linux_writecomb.c
--- a/sys/external/bsd/drm2/linux/linux_writecomb.c     Tue Nov 04 09:17:31 2014 +0000
+++ b/sys/external/bsd/drm2/linux/linux_writecomb.c     Tue Nov 04 11:27:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_writecomb.c,v 1.1 2014/07/16 20:56:25 riastradh Exp $    */
+/*     $NetBSD: linux_writecomb.c,v 1.2 2014/11/04 11:27:31 jmcneill Exp $     */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_writecomb.c,v 1.1 2014/07/16 20:56:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_writecomb.c,v 1.2 2014/11/04 11:27:31 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mtrr.h"
@@ -53,7 +53,7 @@
 linux_writecomb_init(void)
 {
 
-       mutex_init(&linux_writecomb.lock, MUTEX_DEFAULT, IPL_VM);
+       mutex_init(&linux_writecomb.lock, MUTEX_DEFAULT, IPL_SCHED);
        idr_init(&linux_writecomb.idr);
 
        return 0;
diff -r dc4d8bce1dcf -r 8a317f220004 sys/external/bsd/drm2/pci/drm_pci.c
--- a/sys/external/bsd/drm2/pci/drm_pci.c       Tue Nov 04 09:17:31 2014 +0000
+++ b/sys/external/bsd/drm2/pci/drm_pci.c       Tue Nov 04 11:27:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_pci.c,v 1.6 2014/07/26 07:53:14 riastradh Exp $    */
+/*     $NetBSD: drm_pci.c,v 1.7 2014/11/04 11:27:31 jmcneill Exp $     */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_pci.c,v 1.6 2014/07/26 07:53:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_pci.c,v 1.7 2014/11/04 11:27:31 jmcneill Exp $");
 
 #include <sys/types.h>
 #include <sys/errno.h>
@@ -248,7 +248,7 @@
                return -ENOENT;
 
        intrstr = pci_intr_string(pa->pa_pc, ih, intrbuf, sizeof(intrbuf));
-       ih_cookie = pci_intr_establish(pa->pa_pc, ih, IPL_DRM, handler, arg);
+       ih_cookie = pci_intr_establish(pa->pa_pc, ih, IPL_SCHED, handler, arg);
        if (ih_cookie == NULL) {
                aprint_error_dev(dev->dev,
                    "couldn't establish interrupt at %s (%s)\n",



Home | Main Index | Thread Index | Old Index