remove naca->slb_size

Anton Blanchard anton at samba.org
Mon Apr 26 17:16:00 EST 2004


Hi,

The performance guys have pointed out how slow our userspace segment
SLB replacement code is. At the moment naca->slb_size isnt very useful,
we just hardcode it at boot. On top of that, do_slb_bolted doesnt even
use it.

So heres a patch to get rid of it. Looking at make_slbe before and after:

@@ -628,10 +628,6 @@
        bdnz .L102
        b .L93
        .size   .flush_stab,.-.flush_stab
-       .section        ".toc","aw"
-.LC14:
-       .tc naca[TC],naca
-       .section        ".text"
        .align 2
        .section        ".opd","aw"
        .align 3
@@ -641,21 +637,18 @@
        .size   make_slbe,24
        .type   .make_slbe, at function
 .make_slbe:
-       ld 11,.LC14 at toc(2)
-       ld 10,72(13)
-       ld 9,0(11)
-       ld 8,72(9)
+       ld 9,72(13)

As you can see we reduce it by 3 instructions all of which were
dependent loads.

Anton

---

 ameslab-2.5-anton/arch/ppc64/kdb/kdba_bp.c          |    4 ----
 ameslab-2.5-anton/arch/ppc64/kernel/asm-offsets.c   |    1 -
 ameslab-2.5-anton/arch/ppc64/kernel/eeh.c           |    1 -
 ameslab-2.5-anton/arch/ppc64/kernel/head.S          |    2 --
 ameslab-2.5-anton/arch/ppc64/kernel/iSeries_pci.c   |    1 -
 ameslab-2.5-anton/arch/ppc64/kernel/iSeries_proc.c  |    1 -
 ameslab-2.5-anton/arch/ppc64/kernel/iSeries_setup.c |    5 -----
 ameslab-2.5-anton/arch/ppc64/kernel/pci.c           |    1 -
 ameslab-2.5-anton/arch/ppc64/kernel/pci_dn.c        |    1 -
 ameslab-2.5-anton/arch/ppc64/kernel/prom.c          |    7 -------
 ameslab-2.5-anton/arch/ppc64/kernel/stab.c          |    2 +-
 ameslab-2.5-anton/arch/ppc64/mm/init.c              |    1 -
 ameslab-2.5-anton/include/asm-ppc64/naca.h          |    2 +-
 ameslab-2.5-anton/include/asm-ppc64/processor.h     |    6 ++++++
 14 files changed, 8 insertions(+), 27 deletions(-)

diff -puN arch/ppc64/kdb/kdba_bp.c~naca_no_slbsize arch/ppc64/kdb/kdba_bp.c
--- ameslab-2.5/arch/ppc64/kdb/kdba_bp.c~naca_no_slbsize	2004-04-25 18:18:19.741049712 +1000
+++ ameslab-2.5-anton/arch/ppc64/kdb/kdba_bp.c	2004-04-25 18:18:19.788049130 +1000
@@ -756,10 +756,6 @@ kdba_removebp(kdb_bp_t *bp)
 return 0;
 }

-#if 0
-#define systemcfg naca
-#endif
-
 /* install data breakpoint */
 void
 kdba_installdbreg(kdb_bp_t *bp) {
diff -puN arch/ppc64/kernel/asm-offsets.c~naca_no_slbsize arch/ppc64/kernel/asm-offsets.c
--- ameslab-2.5/arch/ppc64/kernel/asm-offsets.c~naca_no_slbsize	2004-04-25 18:18:19.744049675 +1000
+++ ameslab-2.5-anton/arch/ppc64/kernel/asm-offsets.c	2004-04-25 18:18:19.816048782 +1000
@@ -73,7 +73,6 @@ int main(void)
         DEFINE(ICACHEL1LINESIZE, offsetof(struct systemcfg, iCacheL1LineSize));
         DEFINE(ICACHEL1LOGLINESIZE, offsetof(struct naca_struct, iCacheL1LogLineSize));
         DEFINE(ICACHEL1LINESPERPAGE, offsetof(struct naca_struct, iCacheL1LinesPerPage));
-	DEFINE(SLBSIZE, offsetof(struct naca_struct, slb_size));
 	DEFINE(PLATFORM, offsetof(struct systemcfg, platform));

 	/* paca */
diff -puN arch/ppc64/kernel/eeh.c~naca_no_slbsize arch/ppc64/kernel/eeh.c
--- ameslab-2.5/arch/ppc64/kernel/eeh.c~naca_no_slbsize	2004-04-25 18:18:19.748049625 +1000
+++ ameslab-2.5-anton/arch/ppc64/kernel/eeh.c	2004-04-25 18:18:19.790049105 +1000
@@ -27,7 +27,6 @@
 #include <linux/seq_file.h>
 #include <asm/paca.h>
 #include <asm/processor.h>
-#include <asm/naca.h>
 #include <asm/io.h>
 #include <asm/machdep.h>
 #include <asm/pgtable.h>
diff -puN arch/ppc64/kernel/head.S~naca_no_slbsize arch/ppc64/kernel/head.S
--- ameslab-2.5/arch/ppc64/kernel/head.S~naca_no_slbsize	2004-04-25 18:18:19.751049588 +1000
+++ ameslab-2.5-anton/arch/ppc64/kernel/head.S	2004-04-25 18:18:19.805048919 +1000
@@ -1120,8 +1120,6 @@ _GLOBAL(do_slb_bolted)
 	 */

 	/* r20 = paca */
-	/* use a cpu feature mask if we ever change our slb size */
-SLB_NUM_ENTRIES = 64
 1:	ld	r22,PACASTABRR(r20)
 	addi	r21,r22,1
 	cmpdi	r21,SLB_NUM_ENTRIES
diff -puN arch/ppc64/kernel/iSeries_pci.c~naca_no_slbsize arch/ppc64/kernel/iSeries_pci.c
--- ameslab-2.5/arch/ppc64/kernel/iSeries_pci.c~naca_no_slbsize	2004-04-25 18:18:19.755049539 +1000
+++ ameslab-2.5-anton/arch/ppc64/kernel/iSeries_pci.c	2004-04-25 18:18:19.793049068 +1000
@@ -36,7 +36,6 @@
 #include <asm/machdep.h>
 #include <asm/pci-bridge.h>
 #include <asm/ppcdebug.h>
-#include <asm/naca.h>
 #include <asm/iommu.h>

 #include <asm/iSeries/HvCallPci.h>
diff -puN arch/ppc64/kernel/iSeries_proc.c~naca_no_slbsize arch/ppc64/kernel/iSeries_proc.c
--- ameslab-2.5/arch/ppc64/kernel/iSeries_proc.c~naca_no_slbsize	2004-04-25 18:18:19.758049501 +1000
+++ ameslab-2.5-anton/arch/ppc64/kernel/iSeries_proc.c	2004-04-25 18:18:19.794049055 +1000
@@ -23,7 +23,6 @@
 #include <asm/paca.h>
 #include <asm/processor.h>
 #include <asm/time.h>
-#include <asm/naca.h>
 #include <asm/iSeries/ItLpPaca.h>
 #include <asm/iSeries/ItLpQueue.h>
 #include <asm/iSeries/HvCallXm.h>
diff -puN arch/ppc64/kernel/pci.c~naca_no_slbsize arch/ppc64/kernel/pci.c
--- ameslab-2.5/arch/ppc64/kernel/pci.c~naca_no_slbsize	2004-04-25 18:18:19.761049464 +1000
+++ ameslab-2.5-anton/arch/ppc64/kernel/pci.c	2004-04-25 18:18:19.796049030 +1000
@@ -32,7 +32,6 @@
 #include <asm/irq.h>
 #include <asm/uaccess.h>
 #include <asm/ppcdebug.h>
-#include <asm/naca.h>
 #include <asm/iommu.h>
 #include <asm/machdep.h>

diff -puN arch/ppc64/kernel/pci_dn.c~naca_no_slbsize arch/ppc64/kernel/pci_dn.c
--- ameslab-2.5/arch/ppc64/kernel/pci_dn.c~naca_no_slbsize	2004-04-25 18:18:19.765049415 +1000
+++ ameslab-2.5-anton/arch/ppc64/kernel/pci_dn.c	2004-04-25 18:18:19.797049018 +1000
@@ -35,7 +35,6 @@
 #include <asm/machdep.h>
 #include <asm/pci-bridge.h>
 #include <asm/ppcdebug.h>
-#include <asm/naca.h>
 #include <asm/iommu.h>

 #include "pci.h"
diff -puN arch/ppc64/kernel/prom.c~naca_no_slbsize arch/ppc64/kernel/prom.c
--- ameslab-2.5/arch/ppc64/kernel/prom.c~naca_no_slbsize	2004-04-25 18:18:19.769049365 +1000
+++ ameslab-2.5-anton/arch/ppc64/kernel/prom.c	2004-04-25 18:18:19.814048807 +1000
@@ -473,13 +473,6 @@ prom_initialize_naca(unsigned long mem)
 		PROM_BUG();
 	}

-	/*
-	 * Hardcode to GP size.  I am not sure where to get this info
-	 * in general, as there does not appear to be a slb-size OF
-	 * entry.  At least in Condor and earlier.  DRENG
-	 */
-	_naca->slb_size = 64;
-
 	/* Add an eye catcher and the systemcfg layout version number */
 	strcpy(_systemcfg->eye_catcher, RELOC("SYSTEMCFG:PPC64"));
 	_systemcfg->version.major = SYSTEMCFG_MAJOR;
diff -puN arch/ppc64/kernel/stab.c~naca_no_slbsize arch/ppc64/kernel/stab.c
--- ameslab-2.5/arch/ppc64/kernel/stab.c~naca_no_slbsize	2004-04-25 18:18:19.772049328 +1000
+++ ameslab-2.5-anton/arch/ppc64/kernel/stab.c	2004-04-25 18:18:19.807048894 +1000
@@ -335,7 +335,7 @@ static void make_slbe(unsigned long esid
 	do {
 		entry = castout_entry;
 		castout_entry++;
-		if (castout_entry >= naca->slb_size)
+		if (castout_entry >= SLB_NUM_ENTRIES)
 			castout_entry = 1;
 		asm volatile("slbmfee  %0,%1" : "=r" (esid_data) : "r" (entry));
 	} while (esid_data.data.v &&
diff -puN arch/ppc64/mm/init.c~naca_no_slbsize arch/ppc64/mm/init.c
--- ameslab-2.5/arch/ppc64/mm/init.c~naca_no_slbsize	2004-04-25 18:18:19.776049278 +1000
+++ ameslab-2.5-anton/arch/ppc64/mm/init.c	2004-04-25 18:18:19.799048993 +1000
@@ -51,7 +51,6 @@
 #include <asm/smp.h>
 #include <asm/machdep.h>
 #include <asm/tlb.h>
-#include <asm/naca.h>
 #include <asm/eeh.h>
 #include <asm/processor.h>
 #include <asm/mmzone.h>
diff -puN include/asm-ppc64/naca.h~naca_no_slbsize include/asm-ppc64/naca.h
--- ameslab-2.5/include/asm-ppc64/naca.h~naca_no_slbsize	2004-04-25 18:18:19.779049241 +1000
+++ ameslab-2.5-anton/include/asm-ppc64/naca.h	2004-04-25 18:18:19.808048882 +1000
@@ -30,7 +30,7 @@ struct naca_struct {
 	u64 log;                        /* Ptr to log buffer         0x30 */
 	u64 serialPortAddr;		/* Phy addr of serial port   0x38 */
 	u64 interrupt_controller;	/* Type of int controller    0x40 */
-	u64 slb_size;			/* SLB size in entries       0x48 */
+	u64 unused1;			/* was SLB size in entries   0x48 */
 	u64 pftSize;			/* Log 2 of page table size  0x50 */
 	void *systemcfg;		/* Pointer to systemcfg data 0x58 */
 	u32 dCacheL1LogLineSize;	/* L1 d-cache line size Log2 0x60 */
diff -puN include/asm-ppc64/processor.h~naca_no_slbsize include/asm-ppc64/processor.h
--- ameslab-2.5/include/asm-ppc64/processor.h~naca_no_slbsize	2004-04-25 18:18:19.782049204 +1000
+++ ameslab-2.5-anton/include/asm-ppc64/processor.h	2004-04-25 18:18:19.818048758 +1000
@@ -625,4 +625,10 @@ static inline void prefetchw(const void

 #endif /* ASSEMBLY */

+/*
+ * Number of entries in the SLB. If this ever changes we should handle
+ * it with a use a cpu feature fixup.
+ */
+#define SLB_NUM_ENTRIES 64
+
 #endif /* __ASM_PPC64_PROCESSOR_H */
diff -puN arch/ppc64/kernel/iSeries_setup.c~naca_no_slbsize arch/ppc64/kernel/iSeries_setup.c
--- ameslab-2.5/arch/ppc64/kernel/iSeries_setup.c~naca_no_slbsize	2004-04-25 18:19:08.896440446 +1000
+++ ameslab-2.5-anton/arch/ppc64/kernel/iSeries_setup.c	2004-04-25 18:19:20.203300302 +1000
@@ -562,11 +562,6 @@ static void __init build_iSeries_Memory_
 	lmb_add(0, systemcfg->physicalMemorySize);
 	lmb_analyze();	/* ?? */
 	lmb_reserve(0, __pa(klimit));
-
-	/*
-	 * Hardcode to GP size.  I am not sure where to get this info. DRENG
-	 */
-	naca->slb_size = 64;
 }

 /*

_

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list