Skip to contentSkip to conversation

x86: clean up after uv_flush_tlb_others() cpumask conversion

PATCH New Tejun Heo 1 participant 1 message Jan 28, 2009

Subsystems (2)
lore
Share & tools
lore

Tejun Heo

author
#0 lore raw

PATCH 1/1 x86: clean up after uv_flush_tlb_others() cpumask conversion

Impact: cleanup

cpus4096 of uv_flush_tlb_others() conversion left percpu variable definition and copying for uv in generic native_flush_tlb_others(), which makes later conditionalization of uv difficult. This patch converts uv_flush_tlb_others() interface such that it returns pointer to the modified cpumask instead of modifying the argument in place.

As the returned pointer points to a percpu variable uv_flush_tlb_others() now should be called with preemption disabled and the returned value is valid only till preemption is re-enabled.

---
 arch/x86/include/asm/uv/uv_bau.h |    5 +-
 arch/x86/kernel/tlb_64.c         |   15 +++-----
 arch/x86/kernel/tlb_uv.c         |   67 ++++++++++++++++++++++-----------------
 3 files changed, 48 insertions(+), 39 deletions(-)
arch/x86/include/asm/uv/uv_bau.h +3 -2
index 74e6393..201ab61 100644
@@ -325,8 +325,9 @@ static inline void bau_cpubits_clear(struct bau_local_cpumask *dstp, int nbits)
 #define cpubit_isset(cpu, bau_local_cpumask) \
 	test_bit((cpu), (bau_local_cpumask).bits)
 
-extern int uv_flush_tlb_others(struct cpumask *,
-			       struct mm_struct *, unsigned long);
+extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
+					struct mm_struct *mm, unsigned long va,
+					unsigned int cpu);
 extern void uv_bau_message_intr1(void);
 extern void uv_bau_timeout_intr1(void);
 
arch/x86/kernel/tlb_64.c +6 -9
index 7f4141d..9919576 100644
@@ -203,16 +203,13 @@ void native_flush_tlb_others(const struct cpumask *cpumask,
 			     struct mm_struct *mm, unsigned long va)
 {
 	if (is_uv_system()) {
-		/* FIXME: could be an percpu_alloc'd thing */
-		static DEFINE_PER_CPU(cpumask_t, flush_tlb_mask);
-		struct cpumask *after_uv_flush = &get_cpu_var(flush_tlb_mask);
+		unsigned int cpu;
 
-		cpumask_andnot(after_uv_flush, cpumask,
-			       cpumask_of(smp_processor_id()));
-		if (!uv_flush_tlb_others(after_uv_flush, mm, va))
-			flush_tlb_others_ipi(after_uv_flush, mm, va);
-
-		put_cpu_var(flush_tlb_uv_cpumask);
+		cpu = get_cpu();
+		cpumask = uv_flush_tlb_others(cpumask, mm, va, cpu);
+		if (cpumask)
+			flush_tlb_others_ipi(cpumask, mm, va);
+		put_cpu();
 		return;
 	}
 	flush_tlb_others_ipi(cpumask, mm, va);
arch/x86/kernel/tlb_uv.c +39 -28

129 lines not on this page · raw message