[Cbe-oss-dev] [PATCH 4/3] spufs context switch - route spu interrupts to local node

Luke Browning lukebr at linux.vnet.ibm.com
Sun Apr 13 10:30:07 EST 2008


Route spu interrupts to the local cpu node

Use specified cpu if it is on the local node.

Signed-off-by: Luke Brownign <lukebrowning at us.ibm.com>

---

Index: public_git/arch/powerpc/platforms/cell/spu_priv1_mmio.c
===================================================================
--- public_git.orig/arch/powerpc/platforms/cell/spu_priv1_mmio.c
+++ public_git/arch/powerpc/platforms/cell/spu_priv1_mmio.c
@@ -75,8 +75,18 @@ static u64 int_stat_get(struct spu *spu,
 
 static void cpu_affinity_set(struct spu *spu, int cpu)
 {
-	u64 target = iic_get_target_id(cpu);
-	u64 route = target << 48 | target << 32 | target << 16;
+	u64 target;
+	u64 route;
+
+	if (nr_cpus_node(spu->node)) {
+		cpumask_t mask = node_to_cpumask(spu->node);
+
+		if (!cpus_intersects(mask, cpu))
+			cpu = first_cpu(mask);
+	}
+
+	target = iic_get_target_id(cpu);
+	route = target << 48 | target << 32 | target << 16;
 	out_be64(&spu->priv1->int_route_RW, route);
 }
 
Index: public_git/arch/powerpc/platforms/cell/spufs/switch.c
===================================================================
--- public_git.orig/arch/powerpc/platforms/cell/spufs/switch.c
+++ public_git/arch/powerpc/platforms/cell/spufs/switch.c
@@ -1704,12 +1704,8 @@ static inline void restore_mfc_sr1(struc
 
 static inline void set_int_route(struct spu_state *csa, struct spu *spu)
 {
-	/*
-	 * FIX ME: this is wrong with asynchronous spu scheduling.  If the
-	 * caller is the time slicer, all interrupts will be steered to
-	 * the same cpu.  It also needs to be made NUMA aware.
-	 */
 	spu_cpu_affinity_set(spu, raw_smp_processor_id());
+	eieio();
 }
 
 static inline void restore_other_spu_access(struct spu_state *csa,





More information about the cbe-oss-dev mailing list