Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752294AbdF0Hht (ORCPT ); Tue, 27 Jun 2017 03:37:49 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33904 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751510AbdF0Hho (ORCPT ); Tue, 27 Jun 2017 03:37:44 -0400 Date: Tue, 27 Jun 2017 09:37:40 +0200 From: Daniel Vetter To: Harry Wentland Cc: Andrey Grodzovsky , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, maarten.lankhorst@linux.intel.com, amd-gfx@lists.freedesktop.org, seanpaul@chromium.org, daniel@ffwll.ch Subject: Re: [PATCH v2] drm/core: Fail atomic IOCTL with no CRTC state but with signaling. Message-ID: <20170627073740.wz5xix2ecmvh4rbn@phenom.ffwll.local> Mail-Followup-To: Harry Wentland , Andrey Grodzovsky , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, maarten.lankhorst@linux.intel.com, amd-gfx@lists.freedesktop.org, seanpaul@chromium.org References: <0d603149-3fb0-3d48-89e5-77e3f7686415@amd.com> <1497981426-27203-1-git-send-email-Andrey.Grodzovsky@amd.com> <26571917-afb7-fb53-c002-5869cf8ccdf9@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <26571917-afb7-fb53-c002-5869cf8ccdf9@amd.com> X-Operating-System: Linux phenom 4.9.0-2-amd64 User-Agent: NeoMutt/20170306 (1.8.0) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2234 Lines: 69 On Mon, Jun 26, 2017 at 03:44:07PM -0400, Harry Wentland wrote: > On 2017-06-20 01:57 PM, Andrey Grodzovsky wrote: > > Problem : While running IGT kms_atomic_transition test suite i encountered > > a hang in drmHandleEvent immediately following an atomic_commit. > > After dumping the atomic state I relized that in this case there was > > not even one CRTC attached to the state and only disabled > > planes. This probably due to a commit which hadn't changed any property > > which would require attaching crtc state. This means drmHandleEvent > > will never wake up from read since without CRTC in atomic state > > the event fd will not be signaled. > > > > Fix: Protect against this issue by failing atomic_commit early in > > drm_mode_atomic_commit where such probelm can be identified. > > > > v2: > > Fix typos and extra newlines. > > > > Change-Id: I3ee28ffae35fd1e8bfe553146c44da53da02e6f8 > > Signed-off-by: Andrey Grodzovsky > > Reviewed-by: Harry Wentland Stalling on this hoping for the igt patch. Does it exist already? -Daniel > > Harry > > > --- > > drivers/gpu/drm/drm_atomic.c | 11 ++++++++++- > > 1 file changed, 10 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > > index a567310..48145bf 100644 > > --- a/drivers/gpu/drm/drm_atomic.c > > +++ b/drivers/gpu/drm/drm_atomic.c > > @@ -1933,7 +1933,7 @@ static int prepare_crtc_signaling(struct drm_device *dev, > > { > > struct drm_crtc *crtc; > > struct drm_crtc_state *crtc_state; > > - int i, ret; > > + int i, c = 0, ret; > > > > if (arg->flags & DRM_MODE_ATOMIC_TEST_ONLY) > > return 0; > > @@ -1994,8 +1994,17 @@ static int prepare_crtc_signaling(struct drm_device *dev, > > > > crtc_state->event->base.fence = fence; > > } > > + > > + c++; > > } > > > > + /* > > + * Having this flag means user mode pends on event which will never > > + * reach due to lack of at least one CRTC for signaling > > + */ > > + if (c == 0 && (arg->flags & DRM_MODE_PAGE_FLIP_EVENT)) > > + return -EINVAL; > > + > > return 0; > > } > > > > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch