All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/rockchip: Don't use spin_lock_irqsave in interrupt context
@ 2018-02-10 14:35 ` Marc Zyngier
  0 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2018-02-10 14:35 UTC (permalink / raw)
  To: Mark Yao, David Airlie, Heiko Stuebner
  Cc: linux-rockchip, linux-arm-kernel, dri-devel

The rockchip DRM driver is quite careful to disable interrupts
when taking a lock that is also taken in interrupt context,
which is a good thing.

What is a bit over the top is to use spin_lock_irqsave when
already in interrupt context, as you cannot take another
interrupt again, and disabling interrupt is just pure
overhead.

Switching to the non _irqsave version in interrupt context is
more logical, and less heavy handed.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 72554f404b7e..e23877e72c43 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1159,15 +1159,14 @@ static void vop_handle_vblank(struct vop *vop)
 {
 	struct drm_device *drm = vop->drm_dev;
 	struct drm_crtc *crtc = &vop->crtc;
-	unsigned long flags;
 
-	spin_lock_irqsave(&drm->event_lock, flags);
+	spin_lock(&drm->event_lock);
 	if (vop->event) {
 		drm_crtc_send_vblank_event(crtc, vop->event);
 		drm_crtc_vblank_put(crtc);
 		vop->event = NULL;
 	}
-	spin_unlock_irqrestore(&drm->event_lock, flags);
+	spin_unlock(&drm->event_lock);
 
 	if (test_and_clear_bit(VOP_PENDING_FB_UNREF, &vop->pending))
 		drm_flip_work_commit(&vop->fb_unref_work, system_unbound_wq);
@@ -1178,21 +1177,20 @@ static irqreturn_t vop_isr(int irq, void *data)
 	struct vop *vop = data;
 	struct drm_crtc *crtc = &vop->crtc;
 	uint32_t active_irqs;
-	unsigned long flags;
 	int ret = IRQ_NONE;
 
 	/*
 	 * interrupt register has interrupt status, enable and clear bits, we
 	 * must hold irq_lock to avoid a race with enable/disable_vblank().
 	*/
-	spin_lock_irqsave(&vop->irq_lock, flags);
+	spin_lock(&vop->irq_lock);
 
 	active_irqs = VOP_INTR_GET_TYPE(vop, status, INTR_MASK);
 	/* Clear all active interrupt sources */
 	if (active_irqs)
 		VOP_INTR_SET_TYPE(vop, clear, active_irqs, 1);
 
-	spin_unlock_irqrestore(&vop->irq_lock, flags);
+	spin_unlock(&vop->irq_lock);
 
 	/* This is expected for vop iommu irqs, since the irq is shared */
 	if (!active_irqs)
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] drm/rockchip: Don't use spin_lock_irqsave in interrupt context
@ 2018-02-10 14:35 ` Marc Zyngier
  0 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2018-02-10 14:35 UTC (permalink / raw)
  To: linux-arm-kernel

The rockchip DRM driver is quite careful to disable interrupts
when taking a lock that is also taken in interrupt context,
which is a good thing.

What is a bit over the top is to use spin_lock_irqsave when
already in interrupt context, as you cannot take another
interrupt again, and disabling interrupt is just pure
overhead.

Switching to the non _irqsave version in interrupt context is
more logical, and less heavy handed.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 72554f404b7e..e23877e72c43 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1159,15 +1159,14 @@ static void vop_handle_vblank(struct vop *vop)
 {
 	struct drm_device *drm = vop->drm_dev;
 	struct drm_crtc *crtc = &vop->crtc;
-	unsigned long flags;
 
-	spin_lock_irqsave(&drm->event_lock, flags);
+	spin_lock(&drm->event_lock);
 	if (vop->event) {
 		drm_crtc_send_vblank_event(crtc, vop->event);
 		drm_crtc_vblank_put(crtc);
 		vop->event = NULL;
 	}
-	spin_unlock_irqrestore(&drm->event_lock, flags);
+	spin_unlock(&drm->event_lock);
 
 	if (test_and_clear_bit(VOP_PENDING_FB_UNREF, &vop->pending))
 		drm_flip_work_commit(&vop->fb_unref_work, system_unbound_wq);
@@ -1178,21 +1177,20 @@ static irqreturn_t vop_isr(int irq, void *data)
 	struct vop *vop = data;
 	struct drm_crtc *crtc = &vop->crtc;
 	uint32_t active_irqs;
-	unsigned long flags;
 	int ret = IRQ_NONE;
 
 	/*
 	 * interrupt register has interrupt status, enable and clear bits, we
 	 * must hold irq_lock to avoid a race with enable/disable_vblank().
 	*/
-	spin_lock_irqsave(&vop->irq_lock, flags);
+	spin_lock(&vop->irq_lock);
 
 	active_irqs = VOP_INTR_GET_TYPE(vop, status, INTR_MASK);
 	/* Clear all active interrupt sources */
 	if (active_irqs)
 		VOP_INTR_SET_TYPE(vop, clear, active_irqs, 1);
 
-	spin_unlock_irqrestore(&vop->irq_lock, flags);
+	spin_unlock(&vop->irq_lock);
 
 	/* This is expected for vop iommu irqs, since the irq is shared */
 	if (!active_irqs)
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/rockchip: Don't use spin_lock_irqsave in interrupt context
  2018-02-10 14:35 ` Marc Zyngier
@ 2018-02-10 16:23   ` Heiko Stuebner
  -1 siblings, 0 replies; 6+ messages in thread
From: Heiko Stuebner @ 2018-02-10 16:23 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: David Airlie, linux-rockchip, Mark Yao, dri-devel, linux-arm-kernel

Hi Marc,

Am Samstag, 10. Februar 2018, 15:35:01 CET schrieb Marc Zyngier:
> The rockchip DRM driver is quite careful to disable interrupts
> when taking a lock that is also taken in interrupt context,
> which is a good thing.
> 
> What is a bit over the top is to use spin_lock_irqsave when
> already in interrupt context, as you cannot take another
> interrupt again, and disabling interrupt is just pure
> overhead.
> 
> Switching to the non _irqsave version in interrupt context is
> more logical, and less heavy handed.
> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

please note, that we had a maintainer swap for the Rockchip drm-component,
where Sandy replaced Mark [0] ... with me acting as sort-of (and not yet
up to speed) backup.

So I guess Rockchip drm patches should also include
	Sandy Huang <hjc@rock-chips.com>


Heiko

[0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b415b79529391abd29b6a30b93697821f01e082f


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] drm/rockchip: Don't use spin_lock_irqsave in interrupt context
@ 2018-02-10 16:23   ` Heiko Stuebner
  0 siblings, 0 replies; 6+ messages in thread
From: Heiko Stuebner @ 2018-02-10 16:23 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Marc,

Am Samstag, 10. Februar 2018, 15:35:01 CET schrieb Marc Zyngier:
> The rockchip DRM driver is quite careful to disable interrupts
> when taking a lock that is also taken in interrupt context,
> which is a good thing.
> 
> What is a bit over the top is to use spin_lock_irqsave when
> already in interrupt context, as you cannot take another
> interrupt again, and disabling interrupt is just pure
> overhead.
> 
> Switching to the non _irqsave version in interrupt context is
> more logical, and less heavy handed.
> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

please note, that we had a maintainer swap for the Rockchip drm-component,
where Sandy replaced Mark [0] ... with me acting as sort-of (and not yet
up to speed) backup.

So I guess Rockchip drm patches should also include
	Sandy Huang <hjc@rock-chips.com>


Heiko

[0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b415b79529391abd29b6a30b93697821f01e082f

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/rockchip: Don't use spin_lock_irqsave in interrupt context
  2018-02-10 16:23   ` Heiko Stuebner
@ 2018-02-12  9:28     ` Marc Zyngier
  -1 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2018-02-12  9:28 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: David Airlie, linux-rockchip, Mark Yao, dri-devel, linux-arm-kernel

Hi Heiko,

On 10/02/18 16:23, Heiko Stuebner wrote:
> Hi Marc,
> 
> Am Samstag, 10. Februar 2018, 15:35:01 CET schrieb Marc Zyngier:
>> The rockchip DRM driver is quite careful to disable interrupts
>> when taking a lock that is also taken in interrupt context,
>> which is a good thing.
>>
>> What is a bit over the top is to use spin_lock_irqsave when
>> already in interrupt context, as you cannot take another
>> interrupt again, and disabling interrupt is just pure
>> overhead.
>>
>> Switching to the non _irqsave version in interrupt context is
>> more logical, and less heavy handed.
>>
>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> 
> please note, that we had a maintainer swap for the Rockchip drm-component,
> where Sandy replaced Mark [0] ... with me acting as sort-of (and not yet
> up to speed) backup.
> 
> So I guess Rockchip drm patches should also include
> 	Sandy Huang <hjc@rock-chips.com>

I guess that update didn't make it into 4.15, which is why I didn't spot
it. I'll repost the patches shortly including Sandy on Cc.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] drm/rockchip: Don't use spin_lock_irqsave in interrupt context
@ 2018-02-12  9:28     ` Marc Zyngier
  0 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2018-02-12  9:28 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Heiko,

On 10/02/18 16:23, Heiko Stuebner wrote:
> Hi Marc,
> 
> Am Samstag, 10. Februar 2018, 15:35:01 CET schrieb Marc Zyngier:
>> The rockchip DRM driver is quite careful to disable interrupts
>> when taking a lock that is also taken in interrupt context,
>> which is a good thing.
>>
>> What is a bit over the top is to use spin_lock_irqsave when
>> already in interrupt context, as you cannot take another
>> interrupt again, and disabling interrupt is just pure
>> overhead.
>>
>> Switching to the non _irqsave version in interrupt context is
>> more logical, and less heavy handed.
>>
>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> 
> please note, that we had a maintainer swap for the Rockchip drm-component,
> where Sandy replaced Mark [0] ... with me acting as sort-of (and not yet
> up to speed) backup.
> 
> So I guess Rockchip drm patches should also include
> 	Sandy Huang <hjc@rock-chips.com>

I guess that update didn't make it into 4.15, which is why I didn't spot
it. I'll repost the patches shortly including Sandy on Cc.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-02-12  9:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-10 14:35 [PATCH] drm/rockchip: Don't use spin_lock_irqsave in interrupt context Marc Zyngier
2018-02-10 14:35 ` Marc Zyngier
2018-02-10 16:23 ` Heiko Stuebner
2018-02-10 16:23   ` Heiko Stuebner
2018-02-12  9:28   ` Marc Zyngier
2018-02-12  9:28     ` Marc Zyngier

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.