aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/sn/kernel/sn2/sn2_smp.c
diff options
context:
space:
mode:
authorJes Sorensen <jes@sgi.com>2006-02-13 05:29:57 -0500
committerTony Luck <tony.luck@intel.com>2006-02-15 16:24:45 -0500
commit8ed9b2c7a804335004e4bd3b4c6989c5b6bc243f (patch)
treef7420b3fe8ad59ad23707ccbfd7ccaef7abe2a70 /arch/ia64/sn/kernel/sn2/sn2_smp.c
parent50d8e59038703c4da5acaed9afaa37ae416d3153 (diff)
[IA64-SGI] sn2 minor fixes and cleanups
General SN2 code cleanup: - Do not initialize global variables to zero - Use kzalloc instead of kmalloc+memset - Check kmalloc return values - Do not obfuscate spin lock calls - Remove some unused code - Various formatting cleanups Signed-off-by: Jes Sorensen <jes@sgi.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/sn/kernel/sn2/sn2_smp.c')
-rw-r--r--arch/ia64/sn/kernel/sn2/sn2_smp.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c
index f153a4c35c70..24eefb2fc55f 100644
--- a/arch/ia64/sn/kernel/sn2/sn2_smp.c
+++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c
@@ -46,8 +46,14 @@ DECLARE_PER_CPU(struct ptc_stats, ptcstats);
46 46
47static __cacheline_aligned DEFINE_SPINLOCK(sn2_global_ptc_lock); 47static __cacheline_aligned DEFINE_SPINLOCK(sn2_global_ptc_lock);
48 48
49void sn2_ptc_deadlock_recovery(short *, short, short, int, volatile unsigned long *, unsigned long, 49extern unsigned long
50 volatile unsigned long *, unsigned long); 50sn2_ptc_deadlock_recovery_core(volatile unsigned long *, unsigned long,
51 volatile unsigned long *, unsigned long,
52 volatile unsigned long *, unsigned long);
53void
54sn2_ptc_deadlock_recovery(short *, short, short, int,
55 volatile unsigned long *, unsigned long,
56 volatile unsigned long *, unsigned long);
51 57
52/* 58/*
53 * Note: some is the following is captured here to make degugging easier 59 * Note: some is the following is captured here to make degugging easier
@@ -59,16 +65,6 @@ void sn2_ptc_deadlock_recovery(short *, short, short, int, volatile unsigned lon
59#define reset_max_active_on_deadlock() 1 65#define reset_max_active_on_deadlock() 1
60#define PTC_LOCK(sh1) ((sh1) ? &sn2_global_ptc_lock : &sn_nodepda->ptc_lock) 66#define PTC_LOCK(sh1) ((sh1) ? &sn2_global_ptc_lock : &sn_nodepda->ptc_lock)
61 67
62static inline void ptc_lock(int sh1, unsigned long *flagp)
63{
64 spin_lock_irqsave(PTC_LOCK(sh1), *flagp);
65}
66
67static inline void ptc_unlock(int sh1, unsigned long flags)
68{
69 spin_unlock_irqrestore(PTC_LOCK(sh1), flags);
70}
71
72struct ptc_stats { 68struct ptc_stats {
73 unsigned long ptc_l; 69 unsigned long ptc_l;
74 unsigned long change_rid; 70 unsigned long change_rid;
@@ -82,6 +78,8 @@ struct ptc_stats {
82 unsigned long shub_ptc_flushes_not_my_mm; 78 unsigned long shub_ptc_flushes_not_my_mm;
83}; 79};
84 80
81#define sn2_ptctest 0
82
85static inline unsigned long wait_piowc(void) 83static inline unsigned long wait_piowc(void)
86{ 84{
87 volatile unsigned long *piows; 85 volatile unsigned long *piows;
@@ -200,7 +198,7 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
200 max_active = max_active_pio(shub1); 198 max_active = max_active_pio(shub1);
201 199
202 itc = ia64_get_itc(); 200 itc = ia64_get_itc();
203 ptc_lock(shub1, &flags); 201 spin_lock_irqsave(PTC_LOCK(shub1), flags);
204 itc2 = ia64_get_itc(); 202 itc2 = ia64_get_itc();
205 203
206 __get_cpu_var(ptcstats).lock_itc_clocks += itc2 - itc; 204 __get_cpu_var(ptcstats).lock_itc_clocks += itc2 - itc;
@@ -258,7 +256,7 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
258 ia64_srlz_d(); 256 ia64_srlz_d();
259 } 257 }
260 258
261 ptc_unlock(shub1, flags); 259 spin_unlock_irqrestore(PTC_LOCK(shub1), flags);
262 260
263 preempt_enable(); 261 preempt_enable();
264} 262}
@@ -270,11 +268,12 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
270 * TLB flush transaction. The recovery sequence is somewhat tricky & is 268 * TLB flush transaction. The recovery sequence is somewhat tricky & is
271 * coded in assembly language. 269 * coded in assembly language.
272 */ 270 */
273void sn2_ptc_deadlock_recovery(short *nasids, short ib, short ie, int mynasid, volatile unsigned long *ptc0, unsigned long data0, 271
274 volatile unsigned long *ptc1, unsigned long data1) 272void
273sn2_ptc_deadlock_recovery(short *nasids, short ib, short ie, int mynasid,
274 volatile unsigned long *ptc0, unsigned long data0,
275 volatile unsigned long *ptc1, unsigned long data1)
275{ 276{
276 extern unsigned long sn2_ptc_deadlock_recovery_core(volatile unsigned long *, unsigned long,
277 volatile unsigned long *, unsigned long, volatile unsigned long *, unsigned long);
278 short nasid, i; 277 short nasid, i;
279 unsigned long *piows, zeroval, n; 278 unsigned long *piows, zeroval, n;
280 279