mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <usama.anjum@arm.com>
To: Dimitri Sivanich <dimitri.sivanich@hpe.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Cc: Muhammad Usama Anjum <usama.anjum@arm.com>
Subject: [PATCH 3/3] misc: sgi-gru: inline the user CBR status update
Date: Thu, 30 Jul 2026 12:12:52 +0100	[thread overview]
Message-ID: <20260730111316.3672672-4-usama.anjum@arm.com> (raw)
In-Reply-To: <20260730111316.3672672-1-usama.anjum@arm.com>

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@arm.com>
---
 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


  parent reply	other threads:[~2026-07-30 11:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30 11:12 [PATCH 0/3] misc: sgi-gru: Remove broken page-table walks Muhammad Usama Anjum
2026-07-30 11:12 ` [PATCH 1/3] misc: sgi-gru: remove interrupt-context " Muhammad Usama Anjum
2026-07-30 11:12 ` [PATCH 2/3] misc: sgi-gru: remove obsolete atomic fault-handling state Muhammad Usama Anjum
2026-07-30 11:12 ` Muhammad Usama Anjum [this message]
2026-07-30 12:22 ` [PATCH 0/3] misc: sgi-gru: Remove broken page-table walks Dimitri Sivanich
2026-07-30 12:53   ` Muhammad Usama Anjum
2026-07-30 14:08   ` Arnd Bergmann
2026-07-31 11:32   ` Greg Kroah-Hartman
2026-07-31 13:29     ` Dimitri Sivanich
2026-07-31 13:34       ` Muhammad Usama Anjum

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=20260730111316.3672672-4-usama.anjum@arm.com \
    --to=usama.anjum@arm.com \
    --cc=arnd@arndb.de \
    --cc=dimitri.sivanich@hpe.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®