Linux-parisc archive on
 help / color / Atom feed
From: John David Anglin <>
To: linux-parisc <>
Cc: Helge Deller <>,
	James Bottomley <>
Subject: [PATCH] parisc: Use ordered store to release TLB lock
Date: Tue, 21 Jul 2020 07:57:01 -0400
Message-ID: <> (raw)

The LDCW barriers in the tlb_lock and tlb_unlock0 macros can be removed.

In tlb_lock, the barrier isn't needed because there are no prior accesses to be concerned about.

In tlb_unlock0, we replace the LDCW barrier with an ordered store.  This ensures that all prior
accesses are performed before the store is performed.

Signed-off-by: Dave Anglin <>

diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index 4b484ec7c7da..60b966b29d6c 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -454,7 +454,6 @@
 	LDREG		0(\ptp),\pte
 	bb,<,n		\pte,_PAGE_PRESENT_BIT,3f
-	LDCW		0(\tmp),\tmp1
 	b		\fault
 	stw		\spc,0(\tmp)
@@ -464,13 +463,16 @@

-	/* Release pa_tlb_lock lock without reloading lock address. */
+	/* Release pa_tlb_lock lock without reloading lock address.
+	   Note that the values in the register spc are limited to
+	   NR_SPACE_IDS (262144). Thus, the stw instruction always
+	   stores a nonzero value even when register spc is 64 bits.
+	   We use an ordered store to ensure all prior accesses are
+	   performed prior to releasing the lock. */
 	.macro		tlb_unlock0	spc,tmp,tmp1
 #ifdef CONFIG_SMP
 98:	or,COND(=)	%r0,\spc,%r0
-	LDCW		0(\tmp),\tmp1
-	or,COND(=)	%r0,\spc,%r0
-	stw		\spc,0(\tmp)
+	stw,ma		\spc,0(\tmp)

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-parisc archive on

Archives are clonable:
	git clone --mirror linux-parisc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-parisc linux-parisc/ \
	public-inbox-index linux-parisc

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone