[PATCH v2 2/3] drm/panthor: Fix ordering in _irq_suspend()
Liviu Dudau
liviu.dudau at arm.com
Mon Mar 25 17:16:16 UTC 2024
On Mon, Mar 25, 2024 at 02:57:04PM +0100, Boris Brezillon wrote:
> Make sure we set suspended=true last to avoid generating an irq storm
> in the unlikely case where an IRQ happens between the suspended=true
> assignment and the _INT_MASK update.
>
> v2:
> - New patch
>
> Reported-by: Steven Price <steven.price at arm.com>
> Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
> ---
> drivers/gpu/drm/panthor/panthor_device.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_device.h
> index 7ee4987a3796..3a930a368ae1 100644
> --- a/drivers/gpu/drm/panthor/panthor_device.h
> +++ b/drivers/gpu/drm/panthor/panthor_device.h
> @@ -325,7 +325,7 @@ static inline void panthor_ ## __name ## _irq_suspend(struct panthor_irq *pirq)
> { \
> int cookie; \
> \
> - atomic_set(&pirq->suspended, true); \
> + pirq->mask = 0; \
I think you might still have a race between _irq_suspend() and _irq_threaded_handler() where the
status will be zero due to pirq->mask being zero, so no interrupt will be cleared but they will
be masked (kind of the opposite problem to patch 3/3).
I'm starting to think that pirq->mask should be local to _irq_threaded_handler() and not be messed
with in the other functions.
> \
> if (drm_dev_enter(&pirq->ptdev->base, &cookie)) { \
> gpu_write(pirq->ptdev, __reg_prefix ## _INT_MASK, 0); \
If you move the line above before the if condition, do you still need patch 3/3?
Best regards,
Liviu
> @@ -333,7 +333,7 @@ static inline void panthor_ ## __name ## _irq_suspend(struct panthor_irq *pirq)
> drm_dev_exit(cookie); \
> } \
> \
> - pirq->mask = 0; \
> + atomic_set(&pirq->suspended, true); \
> } \
> \
> static inline void panthor_ ## __name ## _irq_resume(struct panthor_irq *pirq, u32 mask) \
> --
> 2.44.0
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
More information about the dri-devel
mailing list