From patchwork Fri Nov 2 11:30:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 1688111 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id BD11BDF2A2 for ; Fri, 2 Nov 2012 11:34:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A17DF9F083 for ; Fri, 2 Nov 2012 04:34:56 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by gabe.freedesktop.org (Postfix) with ESMTP id A962A9E77C; Fri, 2 Nov 2012 04:31:02 -0700 (PDT) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 02 Nov 2012 04:31:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,699,1344236400"; d="scan'208";a="212661841" Received: from ideak-desk.fi.intel.com (HELO localhost) ([10.237.72.98]) by azsmga001.ch.intel.com with ESMTP; 02 Nov 2012 04:31:00 -0700 From: Imre Deak To: Inki Dae , Rob Clark , Daniel Vetter Subject: [PATCH v2 3/4] drm/exynos: fix lockdep for event_lock wrt. vbl_time_lock Date: Fri, 2 Nov 2012 13:30:49 +0200 Message-Id: <1351855850-6577-4-git-send-email-imre.deak@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1351855850-6577-1-git-send-email-imre.deak@intel.com> References: <1351855850-6577-1-git-send-email-imre.deak@intel.com> In-Reply-To: <1351721019-8040-1-git-send-email-imre.deak@intel.com> References: <1351721019-8040-1-git-send-email-imre.deak@intel.com> Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Currently the exynos driver calls drm_vblank_off() with the event_lock held, while drm_vblank_off() will lock vbl_time and vblank_time_lock. This lock dependency chain conflicts with the one in drm_handle_vblank() where we first lock vblank_time_lock and then the event_lock. Fix this by removing the above drm_vblank_off() calls which are in fact never executed: drm_dev->vblank_disable_allowed is only ever non-zero during driver init, until it's set in {fimd,vidi}_subdrv_probe. Both the driver init and open code is protected by drm_global_mutex, so the earliest page flip ioctl can happen only after vblank_disable_allowed is set to 1. Thus {fimd,vidi}_finish_pageflip - with pending flip events - will always get called with vblank_disable_allowed being 1. Signed-off-by: Imre Deak --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 12 ------------ drivers/gpu/drm/exynos/exynos_drm_vidi.c | 12 ------------ 2 files changed, 24 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index e69b7c4..2eb131c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -623,7 +623,6 @@ static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) struct drm_pending_vblank_event *e, *t; struct timeval now; unsigned long flags; - bool is_checked = false; spin_lock_irqsave(&drm_dev->event_lock, flags); @@ -633,8 +632,6 @@ static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) if (crtc != e->pipe) continue; - is_checked = true; - do_gettimeofday(&now); e->event.sequence = 0; e->event.tv_sec = now.tv_sec; @@ -645,15 +642,6 @@ static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) drm_vblank_put(drm_dev, crtc); } - if (is_checked) { - /* - * don't off vblank if vblank_disable_allowed is 1, - * because vblank would be off by timer handler. - */ - if (!drm_dev->vblank_disable_allowed) - drm_vblank_off(drm_dev, crtc); - } - spin_unlock_irqrestore(&drm_dev->event_lock, flags); } diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index e26d455..4b0c16b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -382,7 +382,6 @@ static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc) struct drm_pending_vblank_event *e, *t; struct timeval now; unsigned long flags; - bool is_checked = false; spin_lock_irqsave(&drm_dev->event_lock, flags); @@ -392,8 +391,6 @@ static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc) if (crtc != e->pipe) continue; - is_checked = true; - do_gettimeofday(&now); e->event.sequence = 0; e->event.tv_sec = now.tv_sec; @@ -404,15 +401,6 @@ static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc) drm_vblank_put(drm_dev, crtc); } - if (is_checked) { - /* - * don't off vblank if vblank_disable_allowed is 1, - * because vblank would be off by timer handler. - */ - if (!drm_dev->vblank_disable_allowed) - drm_vblank_off(drm_dev, crtc); - } - spin_unlock_irqrestore(&drm_dev->event_lock, flags); }