dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Archit Taneja <archit@ti.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 6/6] drm/omap: protect omap_crtc's event with event_lock spinlock
Date: Wed, 16 Apr 2014 12:36:46 +0530	[thread overview]
Message-ID: <534E2C06.7020303@ti.com> (raw)
In-Reply-To: <534BD63C.5050708@ti.com>

Hi,

On Monday 14 April 2014 06:06 PM, Tomi Valkeinen wrote:
> On 11/04/14 10:23, Archit Taneja wrote:
>> The vblank_cb callback and the page_flip ioctl can occur together in different
>> CPU contexts. vblank_cb uses takes tje drm device's event_lock spinlock when
>> sending the vblank event and updating omap_crtc->event and omap_crtc->od_fb.
>>
>> Use the same spinlock in page_flip, to make sure the above omap_crtc parameters
>> are configured sequentially.
>>
>> Signed-off-by: Archit Taneja <archit@ti.com>
>> ---
>>   drivers/gpu/drm/omapdrm/omap_crtc.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
>> index d74c72c..9c7af42 100644
>> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
>> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
>> @@ -350,6 +350,7 @@ static int omap_crtc_page_flip_locked(struct drm_crtc *crtc,
>>   	struct drm_device *dev = crtc->dev;
>>   	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
>>   	struct drm_gem_object *bo;
>> +	unsigned long flags;
>>
>>   	DBG("%d -> %d (event=%p)", crtc->fb ? crtc->fb->base.id : -1,
>>   			fb->base.id, event);
>> @@ -359,9 +360,12 @@ static int omap_crtc_page_flip_locked(struct drm_crtc *crtc,
>>   		return -EINVAL;
>>   	}
>>
>> +	spin_lock_irqsave(&dev->event_lock, flags);
>> +
>>   	omap_crtc->event = event;
>>   	omap_crtc->old_fb = crtc->fb = fb;
>>
>> +	spin_unlock_irqrestore(&dev->event_lock, flags);
>
> There's
>
> if (omap_crtc->old_fb)
>
> just above the code you changed. Shouldn't that also be inside the spinlock?

Yes, that should come within the spinlock too.

On a related note, the mdp5_crtc->event in mdp5_crtc_page_flip(and for 
mdp4 crtc) should also be inside the spinlock.

>
> Also, the description contains a few typos.

I'll fix these.

Thanks,
Archit

  reply	other threads:[~2014-04-16  7:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-11  7:23 [PATCH 0/6] drm/omap: Misc fixes Archit Taneja
2014-04-11  7:23 ` [PATCH 1/6] drm/omap: Fix memory leak in omap_gem_op_async Archit Taneja
2014-04-11  7:23 ` [PATCH 2/6] drm/omap: gem sync: wait on correct events Archit Taneja
2014-04-11  7:23 ` [PATCH 3/6] drm/omap: Fix crash when using LCD3 overlay manager Archit Taneja
2014-04-11  7:23 ` [PATCH 4/6] drm/omap: Allow allocation of larger buffers Archit Taneja
2014-04-14  9:25   ` Tomi Valkeinen
2014-04-14 10:18     ` Archit Taneja
2014-04-14 10:30       ` Tomi Valkeinen
2014-04-14 11:07         ` Archit Taneja
2014-04-14 10:43   ` Rob Clark
2014-04-11  7:23 ` [PATCH 5/6] drm/omap: Use old_fb to synchronize between successive page flips Archit Taneja
2014-04-11  7:23 ` [PATCH 6/6] drm/omap: protect omap_crtc's event with event_lock spinlock Archit Taneja
2014-04-14 12:36   ` Tomi Valkeinen
2014-04-16  7:06     ` Archit Taneja [this message]
2014-04-15  9:42 ` [PATCH 0/6] drm/omap: Misc fixes Tomi Valkeinen

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=534E2C06.7020303@ti.com \
    --to=archit@ti.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=tomi.valkeinen@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox