Skip to contentSkip to conversation

[2.6.18] U4 DART improvements

PATCH In review Olof Johansson 3 participants 4 messages Jun 2, 2006 – Jun 3, 2006 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 [2.6.18] U4 DART improvements

Hi Paul,

I've given this a good beating tonight, since I finally got a pci-e ethernet card for the new g5 to do loopback with. Profiles looked good, I think we're good to go for 2.6.18 with this, especially if it gets in early for extra testing.

-Olof

---

Implement single-entry TLB invalidations in the U4 DART.

Simple benchmarking with loopback flood pings of various sizes show that the previous flush-all code will spend ~5% of the time in flush, while the new selective invalidations will spend about an order of magnitude less in the same code path.

This could possibly mean that invalidations larger than, say, 16 entries would better be handled in bulk, but until we have a workload that actually shows problems or bottlenecks let's keep doing single invalidations at all mapping sizes.

arch/powerpc/sysdev/dart.h +0 -0
index c2d0576..1c8817c 100644
arch/powerpc/sysdev/dart.h +5 -1
Index: 2.6.17-rc5-git8/arch/powerpc/sysdev/dart.h
===================================================================
@@ -47,8 +47,12 @@
 /* U4 registers */
 #define DART_BASE_U4_BASE_MASK	0xffffff
 #define DART_BASE_U4_BASE_SHIFT	0
-#define DART_CNTL_U4_FLUSHTLB	0x20000000
 #define DART_CNTL_U4_ENABLE	0x80000000
+#define DART_CNTL_U4_IONE	0x40000000
+#define DART_CNTL_U4_FLUSHTLB	0x20000000
+#define DART_CNTL_U4_IDLE	0x10000000
+#define DART_CNTL_U4_PAR_EN	0x08000000
+#define DART_CNTL_U4_IONE_MASK	0x07ffffff
 #define DART_SIZE_U4_SIZE_MASK	0x1fff
 #define DART_SIZE_U4_SIZE_SHIFT	0
 
arch/powerpc/sysdev/dart_iommu.c +44 -6

83 lines not on this page · raw message

#1 lore raw

Hi Olof,

Looks good. One request:

arch/powerpc/sysdev/dart_iommu.c retry: · line 122

Quoted 9 lines
arch/powerpc/sysdev/dart_iommu.c +9 -0
+static inline void dart_tlb_invalidate_one(unsigned long bus_rpn)
+{
+	unsigned int reg;
+	unsigned int l, limit;
+
+	reg = DART_CNTL_U4_ENABLE | DART_CNTL_U4_IONE |
+		(bus_rpn & DART_CNTL_U4_IONE_MASK);
+	DART_OUT(DART_CNTL, reg);
+	mb();

Could you please comment the memory barriers, to say exactly _why_ a certain barrier is needed? I can't see why wmb() wouldn't work here, for example (note I'm not saying it would -- I just don't see why it wouldn't).

Same goes for every single memory barrier in the whole kernel source code, but I have to start somewhere, heh.

Segher

#2 lore raw
Quoted 19 lines · Segher Boessenkool

Hi Olof,

Looks good. One request:

arch/powerpc/sysdev/dart_iommu.c retry: · line 122

Quoted 9 lines
arch/powerpc/sysdev/dart_iommu.c +9 -0
+static inline void dart_tlb_invalidate_one(unsigned long bus_rpn)
+{
+	unsigned int reg;
+	unsigned int l, limit;
+
+	reg = DART_CNTL_U4_ENABLE | DART_CNTL_U4_IONE |
+		(bus_rpn & DART_CNTL_U4_IONE_MASK);
+	DART_OUT(DART_CNTL, reg);
+	mb();

Could you please comment the memory barriers, to say exactly _why_ a certain barrier is needed? I can't see why wmb() wouldn't work here, for example (note I'm not saying it would -- I just don't see why it wouldn't).

Quoted 2 lines

Same goes for every single memory barrier in the whole kernel source code, but I have to start somewhere, heh.

In fact I doubt we need a barrier at all...

Ben.

#3 lore raw
Quoted 1 line · Benjamin Herrenschmidt

In fact I doubt we need a barrier at all...

Yeah, I'm not sure what I was thinking. There's need for a barrier before the invalidation to make sure that a stale entry doesn't get re-entered into the TLB, and it's already done before the call. I have no good explanation for why I added that one.

I'll respin, test and repost the patch tomorrow.

-Olof