From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/panthor: Introduce interrupt coalescing support for job IRQs Date: Tue, 05 May 2026 11:44:54 +1000 Message-ID: In-Reply-To: <20260429-panthor-signal-from-irq-v1-10-4b92ae4142d2@collabora.com> References: <20260429-panthor-signal-from-irq-v1-0-4b92ae4142d2@collabora.com> <20260429-panthor-signal-from-irq-v1-10-4b92ae4142d2@collabora.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review **Verdict: Reasonable as experimental, has some concerns.** Adds interrupt coalescing for job IRQs, controllable via debugfs. When consecutive interrupts arrive within `max_us` microseconds and the count exceeds `inbounds_cnt_threshold`, the raw handler wakes the IRQ thread which then polls with `readl_poll_timeout_atomic` instead. **Concern 1: Data races on coalescing state:** `panthor_irq_coalescing` fields (`inbounds_cnt`, `coalesced_cnt`, `last_ts`) are accessed from hard IRQ context (raw handler) and from debugfs reads without any synchronization. While `inbounds_cnt` and `last_ts` are only written from IRQ context (safe against concurrent IRQs since the IRQ is masked), the debugfs reads can see torn values for `coalesced_cnt` (u64 on 32-bit platforms) and `last_ts` (ktime_t). **Concern 2: `container_of` usage in debugfs:** ```c struct panthor_device *ptdev = container_of(file->private_data, struct panthor_device, base); ``` This assumes `file->private_data` points to the `struct drm_device` (i.e., `minor->dev`), which is how `debugfs_create_file` sets it up with `minor->dev` as the data parameter. This works but is somewhat indirect -- it might be clearer to pass `ptdev` directly and use `file->private_data` without `container_of`. **Concern 3: Typo in struct field documentation:** ```c /** * @poll_perios_us: Rate at which status polling happens. ``` `poll_perios_us` should be `poll_period_us`. **Concern 4: `panthor_irq_coalescing_init` called from debugfs write without synchronization:** ```c panthor_irq_coalescing_init(&ptdev->fw->irq_coalescing, max_us, poll_period_us, inbounds_cnt_threshold); ``` This resets all fields including `inbounds_cnt` and `last_ts` from process context while the IRQ handler could be concurrently reading/writing them. Should disable the IRQ or use some synchronization. **Observation:** The overall approach of falling back to threaded polling when interrupt rates are high is reasonable for an experimental feature. The debugfs interface is appropriate for tuning. --- Generated by Claude Code Patch Reviewer