Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1670551
| Path | csiph.com!news.mixmin.net!weretis.net!feeder4.news.weretis.net!news.szaf.org!feeder.erje.net!1.eu.feeder.erje.net!news.panservice.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Daniel Vetter <daniel@ffwll.ch> |
| Newsgroups | linux.kernel |
| Subject | Re: [Intel-gfx] [PATCH] drm/core: Fail atomic IOCTL with no CRTC state but with signaling. |
| Date | Tue, 20 Jun 2017 11:40:03 +0200 |
| Message-ID | <tUnNF-6PZ-49@gated-at.bofh.it> (permalink) |
| References | <tRvol-1nx-7@gated-at.bofh.it> <tUax8-6Q2-103@gated-at.bofh.it> <tUax8-6Q2-101@gated-at.bofh.it> <tUnNF-6PZ-51@gated-at.bofh.it> |
| X-Original-To | Andrey Grodzovsky <Andrey.Grodzovsky@amd.com> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=gExy1XWzAKs/X/g6P1sccRBkYx2HyBFtcxEe8IP857s=; b=YQ6ANr4l6IUVm9wUPMUeJ7HljkJ3N+/4i63vkbjmS8tg1O02E8bmZqsiJ4WTxv2Xxk Q35xHMnTJ4jPc8c12KZnzoQnk3BeqymlIwczxDpjfazxx4zGyfJV0aUSCFm8NIJUZcaX B3EiZsdygcqc6CZ0RcHqrZVAxU/PbJ1vrDO/M= |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=gExy1XWzAKs/X/g6P1sccRBkYx2HyBFtcxEe8IP857s=; b=WonPbhMbRc/E4rZIE98tG+YQzryTk5zGUuLtI1eX1PJdxCzdaSoO3cuhVd/qwQ0ZwX CCF08YZBmYGrwyz2TIEoNxtxx7GtrMjoLrbAjGsjmNJl4lIAlD1jepYVkj/vN0l64eNj UCafPSQ9z4vw+gpSD0YBRTXvibguA0ncI6W0JX5WBqgD/Fcqz7XB1Sppop6Dw83oTUBU ZF74S5h/aMKMG/eM7lFt9W1pLLNK/nPdg3hkr0P3WUIM+c4OAEPHD2DGZTVwfXf43WhJ OJXajkZdz0j+E/zzKa4BZsvaPPPeF/GVAo+yxwo8pbBqQb/NNoBaz098yM+A/JnWpdAQ wSPA== |
| X-Gm-Message-State | AKS2vOwjXnLSmSv+EvQ2SahwbzHmoNMeswW4QxYCd4AD8p/lKLOsoj/a HVpSdEQjL2N+ag8q |
| X-Received | by 10.80.139.65 with SMTP id l59mr20558975edl.52.1497950974676; Tue, 20 Jun 2017 02:29:34 -0700 (PDT) |
| Mail-Followup-To | Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>, Sean Paul <seanpaul@chromium.org>, Harry Wentland <harry.wentland@amd.com>, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| X-Operating-System | Linux phenom 4.9.0-2-amd64 |
| User-Agent | NeoMutt/20170306 (1.8.0) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 125 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Sean Paul <seanpaul@chromium.org>, Harry Wentland <harry.wentland@amd.com>, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org |
| X-Original-Date | Tue, 20 Jun 2017 11:29:21 +0200 |
| X-Original-Message-ID | <20170620092921.hk5dofw2v52b3s7b@phenom.ffwll.local> |
| X-Original-References | <1497043819-28591-1-git-send-email-Andrey.Grodzovsky@amd.com> <0d603149-3fb0-3d48-89e5-77e3f7686415@amd.com> <20170619192431.tbsntjjdkianx2kc@art_vandelay> <f9bdcba7-1549-75ce-c1bf-39525cc3fb47@amd.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1670551 |
Show key headers only | View raw
On Mon, Jun 19, 2017 at 04:11:35PM -0400, Andrey Grodzovsky wrote:
>
>
> On 06/19/2017 03:24 PM, Sean Paul wrote:
> > On Mon, Jun 19, 2017 at 11:35:28AM -0400, Harry Wentland wrote:
> > > On 2017-06-09 05:30 PM, Andrey Grodzovsky wrote:
> > > > Problem:
> > > > While running IGT kms_atomic_transition test suite i encountered
> > > > a hang in drmHandleEvent immidietly follwoing an atomic_commit.
> > > s/immidietly/immediately/g
> > > s/follwoing/following/g
> > >
> > > > 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 singnaled.
> > > s/singnaled/signaled/g
> > >
> > > > This point to a bug in IGT but also DRM should gracefully
> > > > fail such scenario so no hang on user side will happen.
> > > >
> > > Can we create an IGT fix for this to make sure this won't happen?
> > >
> > > > Fix:
> > > > Explicitly fail by failing atomic_commit early in
> > > > drm_mode_atomic_commit where such problem can be identified.
> > > >
> > > The change seems reasonable to me but I would like to see some input
> > > from someone who's more familiar with the usermode side of things.
> > I wonder if there's ever a case where it might be desirable to generate an event
> > from a commit without a crtc. I don't know if anyone has explicitly said that an
> > event can only be generated from state with crtc.
> For a generic event i agree, bit seems to me without active CRTC no way you
> can expect PAGE_FLIP_EVENT to fire.
> >
> > I usually don't mind letting userspace shoot itself in the foot, so keep that in
> > mind :)
> >
> > Sean
>
> Seems to me you still would try to avoid a bad configuration, returning
> error
> will help debugging for user who made a mistake. I also see something
> similar
> in drm_mode_atomic_ioctl around line 2122 -
>
> /* can't test and expect an event at the same time. */
> if ((arg->flags & DRM_MODE_ATOMIC_TEST_ONLY) &&
> (arg->flags & DRM_MODE_PAGE_FLIP_EVENT))
> return -EINVAL;
Asking for an event without anything changed is a bug imo. We need to fix
the testcases, and even better would be to have an explicit testcase which
does such a no-op atomic ioctl + event and checks that we get the -EINVAL.
Same applies for asking for events when the crtc is off and stays off btw,
but I think we catch that already somewhere. But again would be good to
make sure we have an igt for it.
Thanks, Daniel
>
> Thanks,
> Andrey
> > > > Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
> > > > ---
> > > > drivers/gpu/drm/drm_atomic.c | 13 ++++++++++++-
> > > > 1 file changed, 12 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> > > > index a567310..32eae1c 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++;
> > > Not sure if intentional, but I like it.
> > >
> > > > }
> > > > + /*
> > > > + * 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;
> > > > }
> > > > @@ -2179,6 +2188,8 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
> > > > drm_mode_object_unreference(obj);
> > > > }
> > > > +
> > > > +
> > > Remove these extraneous newlines.
> > >
> > > Harry
> > >
> > > > ret = prepare_crtc_signaling(dev, state, arg, file_priv, &fence_state,
> > > > &num_fences);
> > > > if (ret)
> > > >
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [Intel-gfx] [PATCH] drm/core: Fail atomic IOCTL with no CRTC state but with signaling. Daniel Vetter <daniel@ffwll.ch> - 2017-06-20 11:40 +0200
csiph-web