[PATCH 3/3] misc: sgi-gru: inline the user CBR status update

From: Muhammad Usama Anjum

Date: Thu Jul 30 2026 - 07:25:30 EST


The process-context fault path always has a valid user CBR pointer. Inline
the one-use status helper and remove its obsolete NULL check.

No functional change.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@xxxxxxx>
---
drivers/misc/sgi-gru/grufault.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/misc/sgi-gru/grufault.c b/drivers/misc/sgi-gru/grufault.c
index e43fdea01cb6f..6b7e7dc37eacd 100644
--- a/drivers/misc/sgi-gru/grufault.c
+++ b/drivers/misc/sgi-gru/grufault.c
@@ -111,21 +111,6 @@ static void gru_unlock_gts(struct gru_thread_state *gts)
mmap_read_unlock(current->mm);
}

-/*
- * Set a CB.istatus to active using a user virtual address. This must be done
- * just prior to a TFH RESTART. The new cb.istatus is an in-cache status ONLY.
- * If the line is evicted, the status may be lost. The in-cache update
- * is necessary to prevent the user from seeing a stale cb.istatus that will
- * change as soon as the TFH restart is complete. Races may cause an
- * occasional failure to clear the cb.istatus, but that is ok.
- */
-static void gru_cb_set_istatus_active(struct gru_instruction_bits *cbk)
-{
- if (cbk) {
- cbk->istatus = CBS_ACTIVE;
- }
-}
-
/*
* Read & clear a TFM
*
@@ -354,7 +339,12 @@ static int gru_try_dropin(struct gru_state *gru,
gru_flush_cache_cbe(cbe);
}

- gru_cb_set_istatus_active(cbk);
+ /*
+ * Set CB.istatus active in cache before restarting the TFH to avoid
+ * exposing stale pre-restart status. Cacheline eviction may lose the
+ * update, but an occasional stale status is harmless.
+ */
+ cbk->istatus = CBS_ACTIVE;
gts->ustats.tlbdropin++;
tfh_write_restart(tfh, gpa, GAA_RAM, vaddr, asid, write,
GRU_PAGESIZE(pageshift));
--
2.47.3