aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-gru
diff options
context:
space:
mode:
authorJack Steiner <steiner@sgi.com>2009-04-02 19:59:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-02 22:05:05 -0400
commit438846043af39fef286f68b197d42bd75f49898e (patch)
treee73bd2e6cdbc2e2ca8a1daac2651f6efb5fc84fd /drivers/misc/sgi-gru
parentfe5bb6b00c3a9374841d651e01694fe4190a677e (diff)
sgi-gru: improvements to GRU debug messages & statistics
Improvements to GRU debug messages & statistics. Signed-off-by: Jack Steiner <steiner@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc/sgi-gru')
-rw-r--r--drivers/misc/sgi-gru/grufault.c5
-rw-r--r--drivers/misc/sgi-gru/grufile.c2
-rw-r--r--drivers/misc/sgi-gru/grukservices.c4
-rw-r--r--drivers/misc/sgi-gru/grumain.c48
-rw-r--r--drivers/misc/sgi-gru/gruprocfs.c2
-rw-r--r--drivers/misc/sgi-gru/grutables.h2
-rw-r--r--drivers/misc/sgi-gru/grutlbpurge.c2
7 files changed, 38 insertions, 27 deletions
diff --git a/drivers/misc/sgi-gru/grufault.c b/drivers/misc/sgi-gru/grufault.c
index f85d27306789..61aa80a8411b 100644
--- a/drivers/misc/sgi-gru/grufault.c
+++ b/drivers/misc/sgi-gru/grufault.c
@@ -449,6 +449,7 @@ irqreturn_t gru_intr(int irq, void *dev_id)
449 up_read(&gts->ts_mm->mmap_sem); 449 up_read(&gts->ts_mm->mmap_sem);
450 } else { 450 } else {
451 tfh_user_polling_mode(tfh); 451 tfh_user_polling_mode(tfh);
452 STAT(intr_mm_lock_failed);
452 } 453 }
453 } 454 }
454 return IRQ_HANDLED; 455 return IRQ_HANDLED;
@@ -508,8 +509,10 @@ int gru_handle_user_call_os(unsigned long cb)
508 * context. 509 * context.
509 */ 510 */
510 if (gts->ts_tgid_owner == current->tgid && gts->ts_blade >= 0 && 511 if (gts->ts_tgid_owner == current->tgid && gts->ts_blade >= 0 &&
511 gts->ts_blade != uv_numa_blade_id()) 512 gts->ts_blade != uv_numa_blade_id()) {
513 STAT(call_os_offnode_reference);
512 gts->ts_force_unload = 1; 514 gts->ts_force_unload = 1;
515 }
513 516
514 ret = -EAGAIN; 517 ret = -EAGAIN;
515 cbrnum = thread_cbr_number(gts, ucbnum); 518 cbrnum = thread_cbr_number(gts, ucbnum);
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c
index 15292e5f74a1..812678d8b47d 100644
--- a/drivers/misc/sgi-gru/grufile.c
+++ b/drivers/misc/sgi-gru/grufile.c
@@ -275,7 +275,7 @@ static void gru_init_chiplet(struct gru_state *gru, unsigned long paddr,
275 gru->gs_cbr_map = (GRU_CBR_AU == 64) ? ~0 : (1UL << GRU_CBR_AU) - 1; 275 gru->gs_cbr_map = (GRU_CBR_AU == 64) ? ~0 : (1UL << GRU_CBR_AU) - 1;
276 gru->gs_dsr_map = (1UL << GRU_DSR_AU) - 1; 276 gru->gs_dsr_map = (1UL << GRU_DSR_AU) - 1;
277 gru_tgh_flush_init(gru); 277 gru_tgh_flush_init(gru);
278 gru_dbg(grudev, "bid %d, nid %d, gru %x, vaddr %p (0x%lx)\n", 278 gru_dbg(grudev, "bid %d, nid %d, gid %d, vaddr %p (0x%lx)\n",
279 bid, nid, gru->gs_gid, gru->gs_gru_base_vaddr, 279 bid, nid, gru->gs_gid, gru->gs_gru_base_vaddr,
280 gru->gs_gru_base_paddr); 280 gru->gs_gru_base_paddr);
281 gru_kservices_init(gru); 281 gru_kservices_init(gru);
diff --git a/drivers/misc/sgi-gru/grukservices.c b/drivers/misc/sgi-gru/grukservices.c
index 3e36b7b6e1c8..247635d6d6e0 100644
--- a/drivers/misc/sgi-gru/grukservices.c
+++ b/drivers/misc/sgi-gru/grukservices.c
@@ -663,12 +663,12 @@ int gru_kservices_init(struct gru_state *gru)
663 err = cch_allocate(cch, 0, cbr_map, dsr_map); 663 err = cch_allocate(cch, 0, cbr_map, dsr_map);
664 if (err) { 664 if (err) {
665 gru_dbg(grudev, 665 gru_dbg(grudev,
666 "Unable to allocate kernel CCH: gru %d, err %d\n", 666 "Unable to allocate kernel CCH: gid %d, err %d\n",
667 gru->gs_gid, err); 667 gru->gs_gid, err);
668 BUG(); 668 BUG();
669 } 669 }
670 if (cch_start(cch)) { 670 if (cch_start(cch)) {
671 gru_dbg(grudev, "Unable to start kernel CCH: gru %d, err %d\n", 671 gru_dbg(grudev, "Unable to start kernel CCH: gid %d, err %d\n",
672 gru->gs_gid, err); 672 gru->gs_gid, err);
673 BUG(); 673 BUG();
674 } 674 }
diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c
index 1ce32bcd0259..de60458f6d1e 100644
--- a/drivers/misc/sgi-gru/grumain.c
+++ b/drivers/misc/sgi-gru/grumain.c
@@ -76,7 +76,7 @@ int gru_cpu_fault_map_id(void)
76/* Hit the asid limit. Start over */ 76/* Hit the asid limit. Start over */
77static int gru_wrap_asid(struct gru_state *gru) 77static int gru_wrap_asid(struct gru_state *gru)
78{ 78{
79 gru_dbg(grudev, "gru %p\n", gru); 79 gru_dbg(grudev, "gid %d\n", gru->gs_gid);
80 STAT(asid_wrap); 80 STAT(asid_wrap);
81 gru->gs_asid_gen++; 81 gru->gs_asid_gen++;
82 gru_flush_all_tlb(gru); 82 gru_flush_all_tlb(gru);
@@ -88,7 +88,7 @@ static int gru_reset_asid_limit(struct gru_state *gru, int asid)
88{ 88{
89 int i, gid, inuse_asid, limit; 89 int i, gid, inuse_asid, limit;
90 90
91 gru_dbg(grudev, "gru %p, asid 0x%x\n", gru, asid); 91 gru_dbg(grudev, "gid %d, asid 0x%x\n", gru->gs_gid, asid);
92 STAT(asid_next); 92 STAT(asid_next);
93 limit = MAX_ASID; 93 limit = MAX_ASID;
94 if (asid >= limit) 94 if (asid >= limit)
@@ -99,8 +99,9 @@ again:
99 if (!gru->gs_gts[i]) 99 if (!gru->gs_gts[i])
100 continue; 100 continue;
101 inuse_asid = gru->gs_gts[i]->ts_gms->ms_asids[gid].mt_asid; 101 inuse_asid = gru->gs_gts[i]->ts_gms->ms_asids[gid].mt_asid;
102 gru_dbg(grudev, "gru %p, inuse_asid 0x%x, cxtnum %d, gts %p\n", 102 gru_dbg(grudev, "gid %d, gts %p, gms %p, inuse 0x%x, cxt %d\n",
103 gru, inuse_asid, i, gru->gs_gts[i]); 103 gru->gs_gid, gru->gs_gts[i], gru->gs_gts[i]->ts_gms,
104 inuse_asid, i);
104 if (inuse_asid == asid) { 105 if (inuse_asid == asid) {
105 asid += ASID_INC; 106 asid += ASID_INC;
106 if (asid >= limit) { 107 if (asid >= limit) {
@@ -120,8 +121,8 @@ again:
120 } 121 }
121 gru->gs_asid_limit = limit; 122 gru->gs_asid_limit = limit;
122 gru->gs_asid = asid; 123 gru->gs_asid = asid;
123 gru_dbg(grudev, "gru %p, new asid 0x%x, new_limit 0x%x\n", gru, asid, 124 gru_dbg(grudev, "gid %d, new asid 0x%x, new_limit 0x%x\n", gru->gs_gid,
124 limit); 125 asid, limit);
125 return asid; 126 return asid;
126} 127}
127 128
@@ -137,7 +138,7 @@ static int gru_assign_asid(struct gru_state *gru)
137 asid = gru_reset_asid_limit(gru, asid); 138 asid = gru_reset_asid_limit(gru, asid);
138 spin_unlock(&gru->gs_asid_lock); 139 spin_unlock(&gru->gs_asid_lock);
139 140
140 gru_dbg(grudev, "gru %p, asid 0x%x\n", gru, asid); 141 gru_dbg(grudev, "gid %d, asid 0x%x\n", gru->gs_gid, asid);
141 return asid; 142 return asid;
142} 143}
143 144
@@ -215,11 +216,12 @@ static int check_gru_resources(struct gru_state *gru, int cbr_au_count,
215 * TLB manangment requires tracking all GRU chiplets that have loaded a GSEG 216 * TLB manangment requires tracking all GRU chiplets that have loaded a GSEG
216 * context. 217 * context.
217 */ 218 */
218static int gru_load_mm_tracker(struct gru_state *gru, struct gru_mm_struct *gms, 219static int gru_load_mm_tracker(struct gru_state *gru,
219 int ctxnum) 220 struct gru_thread_state *gts)
220{ 221{
222 struct gru_mm_struct *gms = gts->ts_gms;
221 struct gru_mm_tracker *asids = &gms->ms_asids[gru->gs_gid]; 223 struct gru_mm_tracker *asids = &gms->ms_asids[gru->gs_gid];
222 unsigned short ctxbitmap = (1 << ctxnum); 224 unsigned short ctxbitmap = (1 << gts->ts_ctxnum);
223 int asid; 225 int asid;
224 226
225 spin_lock(&gms->ms_asid_lock); 227 spin_lock(&gms->ms_asid_lock);
@@ -241,24 +243,26 @@ static int gru_load_mm_tracker(struct gru_state *gru, struct gru_mm_struct *gms,
241 spin_unlock(&gms->ms_asid_lock); 243 spin_unlock(&gms->ms_asid_lock);
242 244
243 gru_dbg(grudev, 245 gru_dbg(grudev,
244 "gru %x, gms %p, ctxnum 0x%d, asid 0x%x, asidmap 0x%lx\n", 246 "gid %d, gts %p, gms %p, ctxnum %d, asid 0x%x, asidmap 0x%lx\n",
245 gru->gs_gid, gms, ctxnum, asid, gms->ms_asidmap[0]); 247 gru->gs_gid, gts, gms, gts->ts_ctxnum, asid,
248 gms->ms_asidmap[0]);
246 return asid; 249 return asid;
247} 250}
248 251
249static void gru_unload_mm_tracker(struct gru_state *gru, 252static void gru_unload_mm_tracker(struct gru_state *gru,
250 struct gru_mm_struct *gms, int ctxnum) 253 struct gru_thread_state *gts)
251{ 254{
255 struct gru_mm_struct *gms = gts->ts_gms;
252 struct gru_mm_tracker *asids; 256 struct gru_mm_tracker *asids;
253 unsigned short ctxbitmap; 257 unsigned short ctxbitmap;
254 258
255 asids = &gms->ms_asids[gru->gs_gid]; 259 asids = &gms->ms_asids[gru->gs_gid];
256 ctxbitmap = (1 << ctxnum); 260 ctxbitmap = (1 << gts->ts_ctxnum);
257 spin_lock(&gms->ms_asid_lock); 261 spin_lock(&gms->ms_asid_lock);
258 BUG_ON((asids->mt_ctxbitmap & ctxbitmap) != ctxbitmap); 262 BUG_ON((asids->mt_ctxbitmap & ctxbitmap) != ctxbitmap);
259 asids->mt_ctxbitmap ^= ctxbitmap; 263 asids->mt_ctxbitmap ^= ctxbitmap;
260 gru_dbg(grudev, "gru %x, gms %p, ctxnum 0x%d, asidmap 0x%lx\n", 264 gru_dbg(grudev, "gid %d, gts %p, gms %p, ctxnum 0x%d, asidmap 0x%lx\n",
261 gru->gs_gid, gms, ctxnum, gms->ms_asidmap[0]); 265 gru->gs_gid, gts, gms, gts->ts_ctxnum, gms->ms_asidmap[0]);
262 spin_unlock(&gms->ms_asid_lock); 266 spin_unlock(&gms->ms_asid_lock);
263} 267}
264 268
@@ -399,7 +403,7 @@ static void gru_free_gru_context(struct gru_thread_state *gts)
399 struct gru_state *gru; 403 struct gru_state *gru;
400 404
401 gru = gts->ts_gru; 405 gru = gts->ts_gru;
402 gru_dbg(grudev, "gts %p, gru %p\n", gts, gru); 406 gru_dbg(grudev, "gts %p, gid %d\n", gts, gru->gs_gid);
403 407
404 spin_lock(&gru->gs_lock); 408 spin_lock(&gru->gs_lock);
405 gru->gs_gts[gts->ts_ctxnum] = NULL; 409 gru->gs_gts[gts->ts_ctxnum] = NULL;
@@ -500,12 +504,12 @@ void gru_unload_context(struct gru_thread_state *gts, int savestate)
500 zap_vma_ptes(gts->ts_vma, UGRUADDR(gts), GRU_GSEG_PAGESIZE); 504 zap_vma_ptes(gts->ts_vma, UGRUADDR(gts), GRU_GSEG_PAGESIZE);
501 cch = get_cch(gru->gs_gru_base_vaddr, ctxnum); 505 cch = get_cch(gru->gs_gru_base_vaddr, ctxnum);
502 506
507 gru_dbg(grudev, "gts %p\n", gts);
503 lock_cch_handle(cch); 508 lock_cch_handle(cch);
504 if (cch_interrupt_sync(cch)) 509 if (cch_interrupt_sync(cch))
505 BUG(); 510 BUG();
506 gru_dbg(grudev, "gts %p\n", gts);
507 511
508 gru_unload_mm_tracker(gru, gts->ts_gms, gts->ts_ctxnum); 512 gru_unload_mm_tracker(gru, gts);
509 if (savestate) 513 if (savestate)
510 gru_unload_context_data(gts->ts_gdata, gru->gs_gru_base_vaddr, 514 gru_unload_context_data(gts->ts_gdata, gru->gs_gru_base_vaddr,
511 ctxnum, gts->ts_cbr_map, 515 ctxnum, gts->ts_cbr_map,
@@ -534,7 +538,7 @@ static void gru_load_context(struct gru_thread_state *gts)
534 cch = get_cch(gru->gs_gru_base_vaddr, ctxnum); 538 cch = get_cch(gru->gs_gru_base_vaddr, ctxnum);
535 539
536 lock_cch_handle(cch); 540 lock_cch_handle(cch);
537 asid = gru_load_mm_tracker(gru, gts->ts_gms, gts->ts_ctxnum); 541 asid = gru_load_mm_tracker(gru, gts);
538 cch->tfm_fault_bit_enable = 542 cch->tfm_fault_bit_enable =
539 (gts->ts_user_options == GRU_OPT_MISS_FMM_POLL 543 (gts->ts_user_options == GRU_OPT_MISS_FMM_POLL
540 || gts->ts_user_options == GRU_OPT_MISS_FMM_INTR); 544 || gts->ts_user_options == GRU_OPT_MISS_FMM_INTR);
@@ -688,7 +692,7 @@ static void gru_steal_context(struct gru_thread_state *gts)
688 STAT(steal_context_failed); 692 STAT(steal_context_failed);
689 } 693 }
690 gru_dbg(grudev, 694 gru_dbg(grudev,
691 "stole gru %x, ctxnum %d from gts %p. Need cb %d, ds %d;" 695 "stole gid %d, ctxnum %d from gts %p. Need cb %d, ds %d;"
692 " avail cb %ld, ds %ld\n", 696 " avail cb %ld, ds %ld\n",
693 gru->gs_gid, ctxnum, ngts, cbr, dsr, hweight64(gru->gs_cbr_map), 697 gru->gs_gid, ctxnum, ngts, cbr, dsr, hweight64(gru->gs_cbr_map),
694 hweight64(gru->gs_dsr_map)); 698 hweight64(gru->gs_dsr_map));
@@ -737,7 +741,7 @@ again:
737 741
738 STAT(assign_context); 742 STAT(assign_context);
739 gru_dbg(grudev, 743 gru_dbg(grudev,
740 "gseg %p, gts %p, gru %x, ctx %d, cbr %d, dsr %d\n", 744 "gseg %p, gts %p, gid %d, ctx %d, cbr %d, dsr %d\n",
741 gseg_virtual_address(gts->ts_gru, gts->ts_ctxnum), gts, 745 gseg_virtual_address(gts->ts_gru, gts->ts_ctxnum), gts,
742 gts->ts_gru->gs_gid, gts->ts_ctxnum, 746 gts->ts_gru->gs_gid, gts->ts_ctxnum,
743 gts->ts_cbr_au_count, gts->ts_dsr_au_count); 747 gts->ts_cbr_au_count, gts->ts_dsr_au_count);
diff --git a/drivers/misc/sgi-gru/gruprocfs.c b/drivers/misc/sgi-gru/gruprocfs.c
index 73b0ca061bb5..6d63a8d70f86 100644
--- a/drivers/misc/sgi-gru/gruprocfs.c
+++ b/drivers/misc/sgi-gru/gruprocfs.c
@@ -62,7 +62,9 @@ static int statistics_show(struct seq_file *s, void *p)
62 printstat(s, asid_wrap); 62 printstat(s, asid_wrap);
63 printstat(s, asid_reuse); 63 printstat(s, asid_reuse);
64 printstat(s, intr); 64 printstat(s, intr);
65 printstat(s, intr_mm_lock_failed);
65 printstat(s, call_os); 66 printstat(s, call_os);
67 printstat(s, call_os_offnode_reference);
66 printstat(s, call_os_check_for_bug); 68 printstat(s, call_os_check_for_bug);
67 printstat(s, call_os_wait_queue); 69 printstat(s, call_os_wait_queue);
68 printstat(s, user_flush_tlb); 70 printstat(s, user_flush_tlb);
diff --git a/drivers/misc/sgi-gru/grutables.h b/drivers/misc/sgi-gru/grutables.h
index db3fe08bf79e..cc0fc734405e 100644
--- a/drivers/misc/sgi-gru/grutables.h
+++ b/drivers/misc/sgi-gru/grutables.h
@@ -184,7 +184,9 @@ struct gru_stats_s {
184 atomic_long_t asid_wrap; 184 atomic_long_t asid_wrap;
185 atomic_long_t asid_reuse; 185 atomic_long_t asid_reuse;
186 atomic_long_t intr; 186 atomic_long_t intr;
187 atomic_long_t intr_mm_lock_failed;
187 atomic_long_t call_os; 188 atomic_long_t call_os;
189 atomic_long_t call_os_offnode_reference;
188 atomic_long_t call_os_check_for_bug; 190 atomic_long_t call_os_check_for_bug;
189 atomic_long_t call_os_wait_queue; 191 atomic_long_t call_os_wait_queue;
190 atomic_long_t user_flush_tlb; 192 atomic_long_t user_flush_tlb;
diff --git a/drivers/misc/sgi-gru/grutlbpurge.c b/drivers/misc/sgi-gru/grutlbpurge.c
index 4e438e4dd2a8..1d125091f5e7 100644
--- a/drivers/misc/sgi-gru/grutlbpurge.c
+++ b/drivers/misc/sgi-gru/grutlbpurge.c
@@ -210,7 +210,7 @@ void gru_flush_all_tlb(struct gru_state *gru)
210{ 210{
211 struct gru_tlb_global_handle *tgh; 211 struct gru_tlb_global_handle *tgh;
212 212
213 gru_dbg(grudev, "gru %p, gid %d\n", gru, gru->gs_gid); 213 gru_dbg(grudev, "gid %d\n", gru->gs_gid);
214 tgh = get_lock_tgh_handle(gru); 214 tgh = get_lock_tgh_handle(gru);
215 tgh_invalidate(tgh, 0, ~0, 0, 1, 1, GRUMAXINVAL - 1, 0xffff); 215 tgh_invalidate(tgh, 0, ~0, 0, 1, 1, GRUMAXINVAL - 1, 0xffff);
216 get_unlock_tgh_handle(tgh); 216 get_unlock_tgh_handle(tgh);