From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: gpu: host1x: skip redundant HW state update
Date: Sat, 16 May 2026 11:02:37 +1000 [thread overview]
Message-ID: <review-patch2-20260514103153.766343-3-tanmayp@nvidia.com> (raw)
In-Reply-To: <20260514103153.766343-3-tanmayp@nvidia.com>
Patch Review
**Summary:** In `host1x_intr_handle_interrupt()`, skip the call to `host1x_intr_update_hw_state()` when no fences remain, since the ISR has already disabled and acknowledged the interrupt.
**Analysis:**
Looking at `process_32_syncpts()` in `intr_hw.c:14-26`:
```c
host1x_sync_writel(host, val, HOST1X_SYNC_SYNCPT_THRESH_INT_DISABLE(reg_offset));
host1x_sync_writel(host, val, HOST1X_SYNC_SYNCPT_THRESH_CPU0_INT_STATUS(reg_offset));
for_each_set_bit(id, &val, 32)
host1x_intr_handle_interrupt(host, reg_offset * 32 + id);
```
The ISR writes to `INT_DISABLE` and `INT_STATUS` before calling `host1x_intr_handle_interrupt()`. When the fence list is empty after processing, `host1x_intr_update_hw_state()` would call `host1x_intr_disable_syncpt_intr()` (`intr_hw.c:138-145`), which does exactly the same two writes:
```c
host1x_sync_writel(host, BIT(id % 32), HOST1X_SYNC_SYNCPT_THRESH_INT_DISABLE(id / 32));
host1x_sync_writel(host, BIT(id % 32), HOST1X_SYNC_SYNCPT_THRESH_CPU0_INT_STATUS(id / 32));
```
So the optimization is correct: when the list is empty, `host1x_intr_update_hw_state` would just repeat the disable+ack that already happened. The patch skips this redundant work:
```c
if (!list_empty(&sp->fences.list))
host1x_intr_update_hw_state(host, sp);
```
When fences remain, `host1x_intr_update_hw_state` re-programs the threshold to the next fence's value and re-enables the interrupt — this path is still taken.
**One consideration:** If a new fence is added between the ISR's disable/ack and the `list_empty` check, could we miss the re-enable? No — `host1x_intr_add_fence_locked()` calls `host1x_intr_update_hw_state()` itself, and it takes `sp->fences.lock`, which `host1x_intr_handle_interrupt` holds during this check. So there's no race.
**Verdict: Clean, correct optimization. No issues.**
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-16 1:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-14 10:31 [PATCH 0/2] gpu: host1x: syncpt_wait micro-optimizations Tanmay Patil
2026-05-14 10:31 ` [PATCH 1/2] gpu: host1x: skip redundant syncpoint loads in host1x_syncpt_wait() Tanmay Patil
2026-05-16 1:02 ` Claude review: " Claude Code Review Bot
2026-05-14 10:31 ` [PATCH 2/2] gpu: host1x: skip redundant HW state update Tanmay Patil
2026-05-16 1:02 ` Claude Code Review Bot [this message]
2026-05-16 1:02 ` Claude review: gpu: host1x: syncpt_wait micro-optimizations Claude Code Review Bot
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=review-patch2-20260514103153.766343-3-tanmayp@nvidia.com \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.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