Linux-MIPS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] MIPS: SGI-IP27: fix exception handler replication
@ 2019-10-30 23:10 Thomas Bogendoerfer
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2019-10-30 23:10 UTC (permalink / raw)
  To: Ralf Baechle, Paul Burton, James Hogan, linux-mips, linux-kernel

Commit 775b089aeffa ("MIPS: tlbex: Remove cpu_has_local_ebase") removed
generating tlb refill handlers for every CPU, which was needed for
generating per node exception handlers on IP27. Instead of resurrecting
(and fixing) refill handler generation, we simply copy all exception
vectors from the boot node to the other nodes. Also remove the config
option since the memory tradeoff for expection handler replication
is just 8k per node.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 arch/mips/sgi-ip27/Kconfig       |  7 -------
 arch/mips/sgi-ip27/ip27-init.c   | 23 +++++++----------------
 arch/mips/sgi-ip27/ip27-memory.c |  4 ----
 3 files changed, 7 insertions(+), 27 deletions(-)

diff --git a/arch/mips/sgi-ip27/Kconfig b/arch/mips/sgi-ip27/Kconfig
index ef3847e7aee0..e5b6cadbec85 100644
--- a/arch/mips/sgi-ip27/Kconfig
+++ b/arch/mips/sgi-ip27/Kconfig
@@ -38,10 +38,3 @@ config REPLICATE_KTEXT
 	  Say Y here to enable replicating the kernel text across multiple
 	  nodes in a NUMA cluster.  This trades memory for speed.
 
-config REPLICATE_EXHANDLERS
-	bool "Exception handler replication support"
-	depends on SGI_IP27
-	help
-	  Say Y here to enable replicating the kernel exception handlers
-	  across multiple nodes in a NUMA cluster. This trades memory for
-	  speed.
diff --git a/arch/mips/sgi-ip27/ip27-init.c b/arch/mips/sgi-ip27/ip27-init.c
index 8fd3505e2b9c..7a269a088be9 100644
--- a/arch/mips/sgi-ip27/ip27-init.c
+++ b/arch/mips/sgi-ip27/ip27-init.c
@@ -64,23 +64,14 @@ static void per_hub_init(nasid_t nasid)
 
 	hub_rtc_init(nasid);
 
-#ifdef CONFIG_REPLICATE_EXHANDLERS
-	/*
-	 * If this is not a headless node initialization,
-	 * copy over the caliased exception handlers.
-	 */
-	if (get_nasid() == nasid) {
-		extern char except_vec2_generic, except_vec3_generic;
-		extern void build_tlb_refill_handler(void);
-
-		memcpy((void *)(CKSEG0 + 0x100), &except_vec2_generic, 0x80);
-		memcpy((void *)(CKSEG0 + 0x180), &except_vec3_generic, 0x80);
-		build_tlb_refill_handler();
-		memcpy((void *)(CKSEG0 + 0x100), (void *) CKSEG0, 0x80);
-		memcpy((void *)(CKSEG0 + 0x180), &except_vec3_generic, 0x100);
-		__flush_cache_all();
+	if (nasid) {
+		/* copy exception handlers from first node to current node */
+		memcpy((void *)NODE_OFFSET_TO_K0(nasid, 0),
+		       (void *)CKSEG0, 0x200);
+		/* switch to node local exception handlers */
+		REMOTE_HUB_S(nasid, PI_CALIAS_SIZE, PI_CALIAS_SIZE_8K);
+		local_flush_icache_range(CKSEG0, CKSEG0 + 0x200);
 	}
-#endif
 }
 
 void per_cpu_init(void)
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index f610fff592a6..563aad5e6398 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -311,11 +311,7 @@ static void __init mlreset(void)
 		 * thinks it is a node 0 address.
 		 */
 		REMOTE_HUB_S(nasid, PI_REGION_PRESENT, (region_mask | 1));
-#ifdef CONFIG_REPLICATE_EXHANDLERS
-		REMOTE_HUB_S(nasid, PI_CALIAS_SIZE, PI_CALIAS_SIZE_8K);
-#else
 		REMOTE_HUB_S(nasid, PI_CALIAS_SIZE, PI_CALIAS_SIZE_0);
-#endif
 
 #ifdef LATER
 		/*
-- 
2.16.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: SGI-IP27: fix exception handler replication
  2019-10-30 21:26 ` Christoph Hellwig
@ 2019-10-30 22:02   ` Thomas Bogendoerfer
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2019-10-30 22:02 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Ralf Baechle, Paul Burton, James Hogan, linux-mips, linux-kernel

On Wed, 30 Oct 2019 14:26:06 -0700
Christoph Hellwig <hch@infradead.org> wrote:

> On Wed, Oct 30, 2019 at 11:58:19AM +0100, Thomas Bogendoerfer wrote:
> > Commit b3ffcd0d800c ("mips/sgi-ip35: Initial rough-in of minimal platform
> > definition.")
> 
> I can't actually find that commit anywhere.

d'oh, no wonder, it's one of my work in progress commits on a local branch
I wanted to reference 775b089aeffa ("MIPS: tlbex: Remove cpu_has_local_ebase").
I'll resent with correct commit.

Thomas.

-- 
SUSE Software Solutions Germany GmbH
HRB 36809 (AG Nürnberg)
Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: SGI-IP27: fix exception handler replication
  2019-10-30 10:58 Thomas Bogendoerfer
@ 2019-10-30 21:26 ` Christoph Hellwig
  2019-10-30 22:02   ` Thomas Bogendoerfer
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2019-10-30 21:26 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Ralf Baechle, Paul Burton, James Hogan, linux-mips, linux-kernel

On Wed, Oct 30, 2019 at 11:58:19AM +0100, Thomas Bogendoerfer wrote:
> Commit b3ffcd0d800c ("mips/sgi-ip35: Initial rough-in of minimal platform
> definition.")

I can't actually find that commit anywhere.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] MIPS: SGI-IP27: fix exception handler replication
@ 2019-10-30 10:58 Thomas Bogendoerfer
  2019-10-30 21:26 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Bogendoerfer @ 2019-10-30 10:58 UTC (permalink / raw)
  To: Ralf Baechle, Paul Burton, James Hogan, linux-mips, linux-kernel

Commit b3ffcd0d800c ("mips/sgi-ip35: Initial rough-in of minimal platform
definition.") removed generating tlb refill handlers for every CPU, which
was needed for generating per node exception handlers on IP27. Instead
of resurrecting (and fixing) refill handler generation, we simply copy
all exception vectors from the boot node to the other nodes. Also
remove the config option since the memory tradeoff for exception handler
replication is just 8k per node.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 arch/mips/sgi-ip27/Kconfig       |  7 -------
 arch/mips/sgi-ip27/ip27-init.c   | 23 +++++++----------------
 arch/mips/sgi-ip27/ip27-memory.c |  4 ----
 3 files changed, 7 insertions(+), 27 deletions(-)

diff --git a/arch/mips/sgi-ip27/Kconfig b/arch/mips/sgi-ip27/Kconfig
index ef3847e7aee0..e5b6cadbec85 100644
--- a/arch/mips/sgi-ip27/Kconfig
+++ b/arch/mips/sgi-ip27/Kconfig
@@ -38,10 +38,3 @@ config REPLICATE_KTEXT
 	  Say Y here to enable replicating the kernel text across multiple
 	  nodes in a NUMA cluster.  This trades memory for speed.
 
-config REPLICATE_EXHANDLERS
-	bool "Exception handler replication support"
-	depends on SGI_IP27
-	help
-	  Say Y here to enable replicating the kernel exception handlers
-	  across multiple nodes in a NUMA cluster. This trades memory for
-	  speed.
diff --git a/arch/mips/sgi-ip27/ip27-init.c b/arch/mips/sgi-ip27/ip27-init.c
index 8fd3505e2b9c..7a269a088be9 100644
--- a/arch/mips/sgi-ip27/ip27-init.c
+++ b/arch/mips/sgi-ip27/ip27-init.c
@@ -64,23 +64,14 @@ static void per_hub_init(nasid_t nasid)
 
 	hub_rtc_init(nasid);
 
-#ifdef CONFIG_REPLICATE_EXHANDLERS
-	/*
-	 * If this is not a headless node initialization,
-	 * copy over the caliased exception handlers.
-	 */
-	if (get_nasid() == nasid) {
-		extern char except_vec2_generic, except_vec3_generic;
-		extern void build_tlb_refill_handler(void);
-
-		memcpy((void *)(CKSEG0 + 0x100), &except_vec2_generic, 0x80);
-		memcpy((void *)(CKSEG0 + 0x180), &except_vec3_generic, 0x80);
-		build_tlb_refill_handler();
-		memcpy((void *)(CKSEG0 + 0x100), (void *) CKSEG0, 0x80);
-		memcpy((void *)(CKSEG0 + 0x180), &except_vec3_generic, 0x100);
-		__flush_cache_all();
+	if (nasid) {
+		/* copy exception handlers from first node to current node */
+		memcpy((void *)NODE_OFFSET_TO_K0(nasid, 0),
+		       (void *)CKSEG0, 0x200);
+		/* switch to node local exception handlers */
+		REMOTE_HUB_S(nasid, PI_CALIAS_SIZE, PI_CALIAS_SIZE_8K);
+		local_flush_icache_range(CKSEG0, CKSEG0 + 0x200);
 	}
-#endif
 }
 
 void per_cpu_init(void)
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index f610fff592a6..563aad5e6398 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -311,11 +311,7 @@ static void __init mlreset(void)
 		 * thinks it is a node 0 address.
 		 */
 		REMOTE_HUB_S(nasid, PI_REGION_PRESENT, (region_mask | 1));
-#ifdef CONFIG_REPLICATE_EXHANDLERS
-		REMOTE_HUB_S(nasid, PI_CALIAS_SIZE, PI_CALIAS_SIZE_8K);
-#else
 		REMOTE_HUB_S(nasid, PI_CALIAS_SIZE, PI_CALIAS_SIZE_0);
-#endif
 
 #ifdef LATER
 		/*
-- 
2.16.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-30 23:10 [PATCH] MIPS: SGI-IP27: fix exception handler replication Thomas Bogendoerfer
  -- strict thread matches above, loose matches on Subject: below --
2019-10-30 10:58 Thomas Bogendoerfer
2019-10-30 21:26 ` Christoph Hellwig
2019-10-30 22:02   ` Thomas Bogendoerfer

Linux-MIPS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mips/0 linux-mips/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-mips linux-mips/ https://lore.kernel.org/linux-mips \
		linux-mips@vger.kernel.org
	public-inbox-index linux-mips

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-mips


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git