From patchwork Thu Jun 9 01:46:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhinakaran Pandiyan X-Patchwork-Id: 9166109 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C4D7760467 for ; Thu, 9 Jun 2016 01:33:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B722326E1A for ; Thu, 9 Jun 2016 01:33:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABF852824F; Thu, 9 Jun 2016 01:33:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65C6D26E1A for ; Thu, 9 Jun 2016 01:33:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 66BC56E305; Thu, 9 Jun 2016 01:33:52 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 82AC66E305 for ; Thu, 9 Jun 2016 01:33:50 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 08 Jun 2016 18:33:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,442,1459839600"; d="scan'208";a="716193748" Received: from skylake.jf.intel.com ([10.54.75.142]) by FMSMGA003.fm.intel.com with ESMTP; 08 Jun 2016 18:33:50 -0700 From: Dhinakaran Pandiyan To: intel-gfx@lists.freedesktop.org Date: Wed, 8 Jun 2016 18:46:03 -0700 Message-Id: <1465436764-29950-3-git-send-email-dhinakaran.pandiyan@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1465436764-29950-1-git-send-email-dhinakaran.pandiyan@intel.com> References: <1465436764-29950-1-git-send-email-dhinakaran.pandiyan@intel.com> Cc: Rodrigo Vivi Subject: [Intel-gfx] [PATCH 2/3] drm/i915: Move drm_crtc_vblank_get out of disabled pre-emption area. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Rodrigo Vivi drm_crtc_vblank_get call the drm_vblank_prepare that will be used soon to control power saving states or anything else that needs a mutex before the vblank happens. local_irq_disable disables kernel preemption so we won't be able to use mutex inside drm_crtc_vblank_get. For this reason we need to move the drm_crtc_vblank_get a little up before disabling the interruptions. Another option would be to use local_irq_enable + local_irq_disable around the drm_crtc_vblank_get, but let's avoid touching the kernel states if we can call the vblank_get a bit earlier. Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/i915/intel_sprite.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 97b1a54..3351c7e 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -94,13 +94,15 @@ void intel_pipe_update_start(struct intel_crtc *crtc) min = vblank_start - usecs_to_scanlines(adjusted_mode, 100); max = vblank_start - 1; - local_irq_disable(); - - if (min <= 0 || max <= 0) + if (WARN_ON(drm_crtc_vblank_get(&crtc->base))) return; - if (WARN_ON(drm_crtc_vblank_get(&crtc->base))) + local_irq_disable(); + + if (min <= 0 || max <= 0) { + drm_crtc_vblank_put(&crtc->base); return; + } crtc->debug.min_vbl = min; crtc->debug.max_vbl = max;