All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Arun Iyengar" <aiyengar1990@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 15/17] drm/panfrost: Keep the job interrupts masked during a reset
Date: Thu, 26 Nov 2026 11:38:54 +0000	[thread overview]
Message-ID: <sashiko-outbox-235394@kernel.org> (raw)
In-Reply-To: <20261126-panfrost-long-jobs-v4-15-23579629ceca@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/panfrost: level-triggered IRQ storm in
  panfrost_jm_suspend_irq()
--

commit f6cf958c59f482f84481acc7413188e321156153
Author: Arun Iyengar <aiyengar1990@gmail.com>

drm/panfrost: Keep the job interrupts masked during a reset

This commit replaces the open-coded JOB_INT_MASK masking and
synchronize_irq() in panfrost_reset() with panfrost_jm_suspend_irq(), and
adds a second write to JOB_INT_MASK after synchronize_irq().

> diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c
> index 74cc3dd025336..7a2503f4e5a40 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_job.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_job.c
> @@ -459,6 +459,7 @@ void panfrost_jm_suspend_irq(struct panfrost_device *pfdev)
>  
>  	job_write(pfdev, JOB_INT_MASK, 0);
>  	synchronize_irq(pfdev->js->irq);
> +	job_write(pfdev, JOB_INT_MASK, 0);
>  }
>  
>  static void panfrost_job_handle_err(struct panfrost_device *pfdev,
> @@ -696,8 +697,7 @@ panfrost_reset(struct panfrost_device *pfdev,
>  	/* Mask job interrupts and synchronize to make sure we won't be
>  	 * interrupted during our reset.
>  	 */
> -	job_write(pfdev, JOB_INT_MASK, 0);
> -	synchronize_irq(pfdev->js->irq);
> +	panfrost_jm_suspend_irq(pfdev);

[Severity: High]
Can calling panfrost_jm_suspend_irq() while GPU jobs are still active
trigger a level-triggered hardirq storm on pfdev->js->irq?

Unlike runtime suspend, panfrost_reset() calls panfrost_jm_suspend_irq()
before issuing JS_COMMAND_SOFT_STOP, so running jobs can still complete or
fault and assert JOB_INT_RAWSTAT.  When PANFROST_COMP_BIT_JOB is set,
panfrost_jm_irq_handler() returns IRQ_NONE without masking JOB_INT_MASK:

drivers/gpu/drm/panfrost/panfrost_job.c:panfrost_jm_irq_handler() {
	if (test_bit(PANFROST_COMP_BIT_JOB, pfdev->is_suspended))
		return IRQ_NONE;
    ...
	job_write(pfdev, JOB_INT_MASK, 0);
	return IRQ_WAKE_THREAD;
}

In the race that the second job_write(pfdev, JOB_INT_MASK, 0) is meant to
handle, JOB_INT_MASK is re-enabled while PANFROST_COMP_BIT_JOB is already
set:

CPU0                              CPU1
panfrost_jm_irq_handler_thread()  panfrost_reset()
  panfrost_jm_handle_irqs()         panfrost_jm_suspend_irq()
  if (!test_bit(COMP_BIT_JOB, ...))
                                      set_bit(COMP_BIT_JOB, ...)
                                      job_write(pfdev, JOB_INT_MASK, 0)
                                      synchronize_irq(pfdev->js->irq)
    job_write(pfdev, JOB_INT_MASK,
              ALL_JS_INT_MASK)
    <hardirq: job completes>
      panfrost_jm_irq_handler()
        if (test_bit(COMP_BIT_JOB))
          return IRQ_NONE;        <-- level-triggered IRQ storm

The same window exists in panfrost_jm_suspend_irq() between set_bit() and
the first job_write(pfdev, JOB_INT_MASK, 0).  Because the Mali job IRQ is
level-triggered, returning IRQ_NONE with JOB_INT_MASK unmasked causes the
interrupt to immediately re-fire, starving the interrupted CPU (including
CPU0 before the IRQ thread can finish and release synchronize_irq(), or
CPU1 before the second mask write) until note_interrupt() disables the IRQ
line.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126-panfrost-long-jobs-v4-0-23579629ceca@gmail.com?part=15

  reply	other threads:[~2026-11-26 11:39 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  9:36 [PATCH v4 00/17] drm/panfrost: Resume long jobs instead of resetting, and mapping error path fixes Arun Iyengar via B4 Relay
2026-11-26  9:36 ` Arun Iyengar
2026-11-26  9:36 ` [PATCH v4 01/17] drm/panfrost: Freeze the reset workqueue during system sleep Arun Iyengar via B4 Relay
2026-11-26  9:36   ` Arun Iyengar
2026-11-26  9:36 ` [PATCH v4 02/17] drm/panfrost: Power the GPU up for a reset queued from the MMU code Arun Iyengar
2026-11-26  9:36   ` Arun Iyengar via B4 Relay
2026-11-26  9:36 ` [PATCH v4 03/17] drm/panfrost: Refuse to sync the CPU caches of a heap BO Arun Iyengar via B4 Relay
2026-11-26  9:36   ` Arun Iyengar
2026-11-26  9:36 ` [PATCH v4 04/17] drm/panfrost: Don't take a reference on a mapping that is being freed Arun Iyengar
2026-11-26  9:36   ` Arun Iyengar via B4 Relay
2026-11-26  9:36 ` [PATCH v4 05/17] drm/panfrost: Don't WARN when a GEM mapping cannot get its pages Arun Iyengar via B4 Relay
2026-11-26  9:36   ` Arun Iyengar
2026-11-26  9:36 ` [PATCH v4 06/17] drm/panfrost: Unwind a failed GPU mapping without dropping " Arun Iyengar via B4 Relay
2026-11-26  9:36   ` Arun Iyengar
2026-11-26  9:36 ` [PATCH v4 07/17] drm/panfrost: Give back the pages of a heap chunk that failed to map Arun Iyengar
2026-11-26  9:36   ` Arun Iyengar via B4 Relay
2026-11-26  9:36 ` [PATCH v4 08/17] drm/panfrost: Don't WARN for a heap folio a neighbouring chunk filled Arun Iyengar
2026-11-26  9:36   ` Arun Iyengar via B4 Relay
2026-11-26  9:36 ` [PATCH v4 09/17] drm/panfrost: Don't signal a job cancelled from _NEXT at a reset as done Arun Iyengar
2026-11-26  9:36   ` Arun Iyengar via B4 Relay
2026-11-26  9:36 ` [PATCH v4 10/17] drm/panfrost: Don't cancel a job that completed during a reset Arun Iyengar
2026-11-26  9:36   ` Arun Iyengar via B4 Relay
2026-11-26  9:36 ` [PATCH v4 11/17] drm/panfrost: Drop the cycle counter only for a job that holds it Arun Iyengar
2026-11-26  9:36   ` Arun Iyengar via B4 Relay
2026-11-26  9:36 ` [PATCH v4 12/17] drm/panfrost: Don't take a job that was never started for done Arun Iyengar
2026-11-26  9:36   ` Arun Iyengar via B4 Relay
2026-11-26  9:36 ` [PATCH v4 13/17] drm/panfrost: Wait for the soft-stopped slots with the live slot status Arun Iyengar
2026-11-26  9:36   ` Arun Iyengar via B4 Relay
2026-11-26  9:36 ` [PATCH v4 14/17] drm/panfrost: Keep the GPU powered in the job timeout handler Arun Iyengar
2026-11-26  9:36   ` Arun Iyengar via B4 Relay
2026-11-26  9:36 ` [PATCH v4 15/17] drm/panfrost: Keep the job interrupts masked during a reset Arun Iyengar
2026-11-26  9:36   ` Arun Iyengar via B4 Relay
2026-11-26 11:38   ` sashiko-bot [this message]
2026-11-26  9:36 ` [PATCH v4 16/17] drm/panfrost: Soft-stop and resume a job that outlives the timeout Arun Iyengar
2026-11-26  9:36   ` Arun Iyengar via B4 Relay
2026-11-26  9:37 ` [PATCH v4 17/17] drm/panfrost: Name the BOs around an unhandled page fault Arun Iyengar
2026-11-26  9:37   ` Arun Iyengar via B4 Relay

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=sashiko-outbox-235394@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=aiyengar1990@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.