Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755885AbcDDPoV (ORCPT ); Mon, 4 Apr 2016 11:44:21 -0400 Received: from mail-lf0-f46.google.com ([209.85.215.46]:33473 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752590AbcDDPoT (ORCPT ); Mon, 4 Apr 2016 11:44:19 -0400 MIME-Version: 1.0 In-Reply-To: <1459778134-30693-1-git-send-email-tomeu.vizoso@collabora.com> References: <1459778134-30693-1-git-send-email-tomeu.vizoso@collabora.com> Date: Mon, 4 Apr 2016 16:44:17 +0100 Message-ID: Subject: Re: [PATCH] drm/rockchip: Return -EBUSY if there's already a pending flip event v3 From: Daniel Stone To: Tomeu Vizoso Cc: Linux Kernel Mailing List , dri-devel , linux-rockchip , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1430 Lines: 38 Hi Tomeu, On 4 April 2016 at 14:55, Tomeu Vizoso wrote: > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c > index 3b8f652698f8..8305bbd2a4d7 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c > @@ -280,7 +280,18 @@ int rockchip_drm_atomic_commit(struct drm_device *dev, > { > struct rockchip_drm_private *private = dev->dev_private; > struct rockchip_atomic_commit *commit = &private->commit; > - int ret; > + struct drm_crtc_state *crtc_state; > + struct drm_crtc *crtc; > + int i, ret; > + > + if (async) { > + for_each_crtc_in_state(state, crtc, crtc_state, i) { > + if (crtc->state->event || > + rockchip_drm_crtc_has_pending_event(crtc)) { > + return -EBUSY; > + } > + } > + } Hmmm ... Doesn't this trigger before the VOP atomic_begin() helper, meaning that anything with an event set will trigger the check? Seems like it should be && rather than ||. Also, I know rockchip_drm_vop.c isn't holding dev->event_lock when it checks vop->event, but it really should be ... and so should this check. Otherwise you can race with the IRQ handler, which isn't required to hold the CRTC lock. Cheers, Daniel