kernel-drm: remove duplicated down_read to mmap_sem and add DRM_UNLOCKED flag for...
authorFei Jiang <fei.jiang@intel.com>
Thu, 19 Apr 2012 15:05:29 +0000 (23:05 +0800)
committerMahe, Erwan <erwan.mahe@intel.com>
Thu, 26 Apr 2012 19:01:30 +0000 (12:01 -0700)
BZ: 29375

DRM big mutex has big impact to the video performance and maybe trigger dead lock issue.

Change-Id: I7943f113009ae5d9a6206c4bf23728d06c2831af
Reviewed-on: http://android.intel.com:8080/44098
Reviewed-by: Jiang, Fei <fei.jiang@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Reviewed-by: Ding, Haitao <haitao.ding@intel.com>
Tested-by: Ding, Haitao <haitao.ding@intel.com>
drivers/gpu/drm/ttm/ttm_tt.c
drivers/staging/mrst/drv/psb_drv.c

index 0b6188f..8067600 100644 (file)
@@ -464,10 +464,12 @@ static int alloc_user_pages_ttm(struct ttm_tt *ttm,
         * and map to user space
         */
        if (vma->vm_flags & (VM_IO | VM_PFNMAP)) {
+               down_read(&current->mm->mmap_sem);
                page_nr = get_pfnmap_pages(current, current->mm,
                                           (unsigned long)userptr,
                                           (int)(ttm->num_pages), 1, 0,
                                           ttm->pages, NULL);
+               up_read(&current->mm->mmap_sem);
        } else {
                /*Handle frame buffer allocated in user space*/
                down_read(&current->mm->mmap_sem);
@@ -515,19 +517,20 @@ int ttm_tt_set_user(struct ttm_tt *ttm,
        if (unlikely(ret != 0))
                return ret;
 
-       down_read(&mm->mmap_sem);
-
        /**
         * get_user_pages can only handle the buffer allocated from user space,
         * but we need handle the buffer allocated from other kernel driver
         */
 #if 0
+       down_read(&mm->mmap_sem);
+
        ret = get_user_pages(tsk, mm, start, num_pages,
                             write, 0, ttm->pages, NULL);
+       up_read(&mm->mmap_sem);
 #else
        ret = alloc_user_pages_ttm(ttm, start);
 #endif
-       up_read(&mm->mmap_sem);
+
 
        if (ret != num_pages && write) {
                ttm_tt_free_user_pages(ttm);
index c89dff8..43024ed 100644 (file)
@@ -547,29 +547,29 @@ static struct drm_ioctl_desc psb_ioctls[] = {
                      DRM_AUTH),*/
 
        PSB_IOCTL_DEF(DRM_IOCTL_PSB_TTM_PL_CREATE, psb_pl_create_ioctl,
-       DRM_AUTH),
+       DRM_AUTH | DRM_UNLOCKED),
        PSB_IOCTL_DEF(DRM_IOCTL_PSB_TTM_PL_REFERENCE, psb_pl_reference_ioctl,
-       DRM_AUTH),
+       DRM_AUTH | DRM_UNLOCKED),
        PSB_IOCTL_DEF(DRM_IOCTL_PSB_TTM_PL_UNREF, psb_pl_unref_ioctl,
-       DRM_AUTH),
+       DRM_AUTH | DRM_UNLOCKED),
        PSB_IOCTL_DEF(DRM_IOCTL_PSB_TTM_PL_SYNCCPU, psb_pl_synccpu_ioctl,
        DRM_AUTH | DRM_UNLOCKED),
        PSB_IOCTL_DEF(DRM_IOCTL_PSB_TTM_PL_WAITIDLE, psb_pl_waitidle_ioctl,
        DRM_AUTH | DRM_UNLOCKED),
        PSB_IOCTL_DEF(DRM_IOCTL_PSB_TTM_PL_SETSTATUS, psb_pl_setstatus_ioctl,
-       DRM_AUTH),
+       DRM_AUTH | DRM_UNLOCKED),
        PSB_IOCTL_DEF(DRM_IOCTL_PSB_TTM_PL_CREATE_UB, psb_pl_ub_create_ioctl,
-       DRM_AUTH),
+       DRM_AUTH | DRM_UNLOCKED),
        PSB_IOCTL_DEF(DRM_IOCTL_PSB_TTM_FENCE_SIGNALED,
-       psb_fence_signaled_ioctl, DRM_AUTH),
+       psb_fence_signaled_ioctl, DRM_AUTH | DRM_UNLOCKED),
        PSB_IOCTL_DEF(DRM_IOCTL_PSB_TTM_FENCE_FINISH, psb_fence_finish_ioctl,
-       DRM_AUTH),
+       DRM_AUTH | DRM_UNLOCKED),
        PSB_IOCTL_DEF(DRM_IOCTL_PSB_TTM_FENCE_UNREF, psb_fence_unref_ioctl,
-       DRM_AUTH),
+       DRM_AUTH | DRM_UNLOCKED),
        /*to be removed later */
        /*PSB_IOCTL_DEF(DRM_IOCTL_PSB_FLIP, psb_page_flip, DRM_AUTH),*/
        PSB_IOCTL_DEF(DRM_IOCTL_LNC_VIDEO_GETPARAM,
-       lnc_video_getparam, DRM_AUTH),
+       lnc_video_getparam, DRM_AUTH | DRM_UNLOCKED),
        PSB_IOCTL_DEF(DRM_IOCTL_BUFFER_CLASS_VIDEO,
        BC_Video_Bridge, DRM_AUTH),
 #endif