diff options
author | Jack Steiner <steiner@sgi.com> | 2009-04-02 19:59:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-02 22:05:05 -0400 |
commit | 438846043af39fef286f68b197d42bd75f49898e (patch) | |
tree | e73bd2e6cdbc2e2ca8a1daac2651f6efb5fc84fd /drivers/misc/sgi-gru/grumain.c | |
parent | fe5bb6b00c3a9374841d651e01694fe4190a677e (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/grumain.c')
-rw-r--r-- | drivers/misc/sgi-gru/grumain.c | 48 |
1 files changed, 26 insertions, 22 deletions
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 */ |
77 | static int gru_wrap_asid(struct gru_state *gru) | 77 | static 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 | */ |
218 | static int gru_load_mm_tracker(struct gru_state *gru, struct gru_mm_struct *gms, | 219 | static 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 | ||
249 | static void gru_unload_mm_tracker(struct gru_state *gru, | 252 | static 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); |