All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: "Gustavo Padovan" <gustavo@padovan.org>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	"Daniel Stone" <daniels@collabora.com>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Riley Andrews" <riandrews@android.com>,
	"Rob Clark" <robdclark@gmail.com>,
	"Greg Hackmann" <ghackmann@google.com>,
	"John Harrison" <John.C.Harrison@Intel.com>,
	laurent.pinchart@ideasonboard.com, seanpaul@google.com,
	marcheu@google.com, m.chehab@samsung.com,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Gustavo Padovan" <gustavo.padovan@collabora.co.uk>
Subject: Re: [RFC 5/8] drm/fence: add fence to drm_pending_event
Date: Fri, 15 Apr 2016 21:31:33 +0200	[thread overview]
Message-ID: <20160415193133.GA2510@phenom.ffwll.local> (raw)
In-Reply-To: <20160415185900.GD23954@joana>

On Fri, Apr 15, 2016 at 11:59:00AM -0700, Gustavo Padovan wrote:
> 2016-04-15 Daniel Vetter <daniel@ffwll.ch>:
> > On Thu, Apr 14, 2016 at 06:29:38PM -0700, Gustavo Padovan wrote:
> > > diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
> > > index aeef58e..38def49 100644
> > > --- a/drivers/gpu/drm/drm_fops.c
> > > +++ b/drivers/gpu/drm/drm_fops.c
> > > @@ -801,8 +801,9 @@ void drm_send_event_locked(struct drm_device *dev, struct drm_pending_event *e)
> > >  {
> > >  	assert_spin_locked(&dev->event_lock);
> > >  
> > > -	if (!e->file_priv) {
> > > -		e->destroy(e);
> > > +	if (!e->file_priv || !e->event) {
> > 
> > This would be a bug: e->file_priv != NULL iff e->event != NULL. How did
> > this happen?
> 
> Not sure now. But I needed this to prevent a crash, I don't have logs of
> it anymore, I'll check this again.

There was a massive irc discussion with Daniel Stone, so I'll try to
summarize it here. There are 3 possible cases:

e->file_priv == NULL && e->event == NULL:
This is a drm_event without a drm_event. Probably e->fence is set, if not
then it's a completeley useless thing (but not forbidden).

e->file_priv != NULL && e->event != NULL:
drm_event with an event for the given file_priv attached.

e->file_priv == NULL && e->event != NULL:
Above case, but with the file_priv closed and unlinked from the event.

The 4th case, which is the only case things will change with the above
hunk, is not allowed. If you hit it, there's a bug somewhere.

This is all completely idependent of e->fence, which this patch adds.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch>
To: "Gustavo Padovan" <gustavo@padovan.org>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	"Daniel Stone" <daniels@collabora.com>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Riley Andrews" <riandrews@android.com>,
	"Rob Clark" <robdclark@gmail.com>,
	"Greg Hackmann" <ghackmann@google.com>,
	"John Harrison" <John.C.Harrison@Intel.com>,
	laurent.pinchart@ideasonboard.com, seanpaul@google.com,
	marcheu@google.com, m.chehab@samsung.com,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Gustavo Padovan" <gustavo.padovan@collabora.co.uk>
Subject: Re: [RFC 5/8] drm/fence: add fence to drm_pending_event
Date: Fri, 15 Apr 2016 21:31:33 +0200	[thread overview]
Message-ID: <20160415193133.GA2510@phenom.ffwll.local> (raw)
In-Reply-To: <20160415185900.GD23954@joana>

On Fri, Apr 15, 2016 at 11:59:00AM -0700, Gustavo Padovan wrote:
> 2016-04-15 Daniel Vetter <daniel@ffwll.ch>:
> > On Thu, Apr 14, 2016 at 06:29:38PM -0700, Gustavo Padovan wrote:
> > > diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
> > > index aeef58e..38def49 100644
> > > --- a/drivers/gpu/drm/drm_fops.c
> > > +++ b/drivers/gpu/drm/drm_fops.c
> > > @@ -801,8 +801,9 @@ void drm_send_event_locked(struct drm_device *dev, struct drm_pending_event *e)
> > >  {
> > >  	assert_spin_locked(&dev->event_lock);
> > >  
> > > -	if (!e->file_priv) {
> > > -		e->destroy(e);
> > > +	if (!e->file_priv || !e->event) {
> > 
> > This would be a bug: e->file_priv != NULL iff e->event != NULL. How did
> > this happen?
> 
> Not sure now. But I needed this to prevent a crash, I don't have logs of
> it anymore, I'll check this again.

There was a massive irc discussion with Daniel Stone, so I'll try to
summarize it here. There are 3 possible cases:

e->file_priv == NULL && e->event == NULL:
This is a drm_event without a drm_event. Probably e->fence is set, if not
then it's a completeley useless thing (but not forbidden).

e->file_priv != NULL && e->event != NULL:
drm_event with an event for the given file_priv attached.

e->file_priv == NULL && e->event != NULL:
Above case, but with the file_priv closed and unlinked from the event.

The 4th case, which is the only case things will change with the above
hunk, is not allowed. If you hit it, there's a bug somewhere.

This is all completely idependent of e->fence, which this patch adds.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2016-04-15 19:31 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15  1:29 [RFC 0/8] drm: explicit fencing support Gustavo Padovan
2016-04-15  1:29 ` Gustavo Padovan
2016-04-15  1:29 ` [RFC 1/8] dma-buf/fence: add fence_collection fences Gustavo Padovan
2016-04-15  1:29   ` Gustavo Padovan
2016-04-15  8:02   ` Daniel Vetter
2016-04-15  8:02     ` Daniel Vetter
2016-04-15  9:03     ` Christian König
2016-04-15  9:03       ` Christian König
2016-04-15 11:44       ` Daniel Vetter
2016-04-15 11:44         ` Daniel Vetter
2016-04-15 18:29         ` Gustavo Padovan
2016-04-15 18:29           ` Gustavo Padovan
2016-04-15 19:23           ` Daniel Vetter
2016-04-15 19:23             ` Daniel Vetter
2016-04-15 18:27       ` Gustavo Padovan
2016-04-15 18:27         ` Gustavo Padovan
2016-04-15 19:25         ` Daniel Vetter
2016-04-15 19:25           ` Daniel Vetter
2016-05-18  7:07           ` Christian König
2016-05-18  7:07             ` Christian König
2016-05-18 14:30             ` Gustavo Padovan
2016-04-15  1:29 ` [RFC 2/8] dma-buf/sync_file: add sync_file_fences_get() Gustavo Padovan
2016-04-15  1:29   ` Gustavo Padovan
2016-04-15  7:56   ` Daniel Vetter
2016-04-15  7:56     ` Daniel Vetter
2016-04-15  1:29 ` [RFC 3/8] drm/fence: allow fence waiting to be interrupted by userspace Gustavo Padovan
2016-04-15  1:29   ` Gustavo Padovan
2016-04-15  7:47   ` Daniel Vetter
2016-04-15  7:47     ` Daniel Vetter
2016-04-15  1:29 ` [RFC 4/8] drm/fence: add in-fences support Gustavo Padovan
2016-04-15  1:29   ` Gustavo Padovan
2016-04-15  8:05   ` Daniel Vetter
2016-04-15  8:05     ` Daniel Vetter
2016-04-15 18:40     ` Gustavo Padovan
2016-04-15 18:40       ` Gustavo Padovan
2016-04-15  8:11   ` Daniel Vetter
2016-04-15  8:11     ` Daniel Vetter
2016-04-15  1:29 ` [RFC 5/8] drm/fence: add fence to drm_pending_event Gustavo Padovan
2016-04-15  1:29   ` Gustavo Padovan
2016-04-15  8:09   ` Daniel Vetter
2016-04-15  8:09     ` Daniel Vetter
2016-04-15 18:59     ` Gustavo Padovan
2016-04-15 18:59       ` Gustavo Padovan
2016-04-15 19:31       ` Daniel Vetter [this message]
2016-04-15 19:31         ` Daniel Vetter
2016-04-15  1:29 ` [RFC 6/8] drm/fence: create DRM_MODE_ATOMIC_OUT_FENCE flag Gustavo Padovan
2016-04-15  1:29   ` Gustavo Padovan
2016-04-15  1:40   ` Rob Clark
2016-04-15  1:40     ` Rob Clark
2016-04-15 19:05     ` Gustavo Padovan
2016-04-15 19:05       ` Gustavo Padovan
2016-04-15  1:29 ` [RFC 7/8] drm/fence: create per-crtc sync_timeline Gustavo Padovan
2016-04-15  1:29   ` Gustavo Padovan
2016-04-15  1:29 ` [RFC 8/8] drm/fence: add out-fences support Gustavo Padovan
2016-04-15  1:29   ` Gustavo Padovan
2016-04-15  8:18   ` Daniel Vetter
2016-04-15  8:18     ` Daniel Vetter
2016-04-15 19:15     ` Gustavo Padovan
2016-04-15 19:15       ` Gustavo Padovan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160415193133.GA2510@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=John.C.Harrison@Intel.com \
    --cc=arve@android.com \
    --cc=daniels@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ghackmann@google.com \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=gustavo@padovan.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marcheu@google.com \
    --cc=riandrews@android.com \
    --cc=robdclark@gmail.com \
    --cc=seanpaul@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.