Commit 43884604 authored by Jack Steiner's avatar Jack Steiner Committed by Linus Torvalds

sgi-gru: improvements to GRU debug messages & statistics

Improvements to GRU debug messages & statistics.
Signed-off-by: default avatarJack Steiner <steiner@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent fe5bb6b0
...@@ -449,6 +449,7 @@ irqreturn_t gru_intr(int irq, void *dev_id) ...@@ -449,6 +449,7 @@ irqreturn_t gru_intr(int irq, void *dev_id)
up_read(&gts->ts_mm->mmap_sem); up_read(&gts->ts_mm->mmap_sem);
} else { } else {
tfh_user_polling_mode(tfh); tfh_user_polling_mode(tfh);
STAT(intr_mm_lock_failed);
} }
} }
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -508,8 +509,10 @@ int gru_handle_user_call_os(unsigned long cb) ...@@ -508,8 +509,10 @@ int gru_handle_user_call_os(unsigned long cb)
* context. * context.
*/ */
if (gts->ts_tgid_owner == current->tgid && gts->ts_blade >= 0 && if (gts->ts_tgid_owner == current->tgid && gts->ts_blade >= 0 &&
gts->ts_blade != uv_numa_blade_id()) gts->ts_blade != uv_numa_blade_id()) {
STAT(call_os_offnode_reference);
gts->ts_force_unload = 1; gts->ts_force_unload = 1;
}
ret = -EAGAIN; ret = -EAGAIN;
cbrnum = thread_cbr_number(gts, ucbnum); cbrnum = thread_cbr_number(gts, ucbnum);
......
...@@ -275,7 +275,7 @@ static void gru_init_chiplet(struct gru_state *gru, unsigned long paddr, ...@@ -275,7 +275,7 @@ static void gru_init_chiplet(struct gru_state *gru, unsigned long paddr,
gru->gs_cbr_map = (GRU_CBR_AU == 64) ? ~0 : (1UL << GRU_CBR_AU) - 1; gru->gs_cbr_map = (GRU_CBR_AU == 64) ? ~0 : (1UL << GRU_CBR_AU) - 1;
gru->gs_dsr_map = (1UL << GRU_DSR_AU) - 1; gru->gs_dsr_map = (1UL << GRU_DSR_AU) - 1;
gru_tgh_flush_init(gru); gru_tgh_flush_init(gru);
gru_dbg(grudev, "bid %d, nid %d, gru %x, vaddr %p (0x%lx)\n", gru_dbg(grudev, "bid %d, nid %d, gid %d, vaddr %p (0x%lx)\n",
bid, nid, gru->gs_gid, gru->gs_gru_base_vaddr, bid, nid, gru->gs_gid, gru->gs_gru_base_vaddr,
gru->gs_gru_base_paddr); gru->gs_gru_base_paddr);
gru_kservices_init(gru); gru_kservices_init(gru);
......
...@@ -663,12 +663,12 @@ int gru_kservices_init(struct gru_state *gru) ...@@ -663,12 +663,12 @@ int gru_kservices_init(struct gru_state *gru)
err = cch_allocate(cch, 0, cbr_map, dsr_map); err = cch_allocate(cch, 0, cbr_map, dsr_map);
if (err) { if (err) {
gru_dbg(grudev, gru_dbg(grudev,
"Unable to allocate kernel CCH: gru %d, err %d\n", "Unable to allocate kernel CCH: gid %d, err %d\n",
gru->gs_gid, err); gru->gs_gid, err);
BUG(); BUG();
} }
if (cch_start(cch)) { if (cch_start(cch)) {
gru_dbg(grudev, "Unable to start kernel CCH: gru %d, err %d\n", gru_dbg(grudev, "Unable to start kernel CCH: gid %d, err %d\n",
gru->gs_gid, err); gru->gs_gid, err);
BUG(); BUG();
} }
......
...@@ -76,7 +76,7 @@ int gru_cpu_fault_map_id(void) ...@@ -76,7 +76,7 @@ int gru_cpu_fault_map_id(void)
/* Hit the asid limit. Start over */ /* Hit the asid limit. Start over */
static int gru_wrap_asid(struct gru_state *gru) static int gru_wrap_asid(struct gru_state *gru)
{ {
gru_dbg(grudev, "gru %p\n", gru); gru_dbg(grudev, "gid %d\n", gru->gs_gid);
STAT(asid_wrap); STAT(asid_wrap);
gru->gs_asid_gen++; gru->gs_asid_gen++;
gru_flush_all_tlb(gru); gru_flush_all_tlb(gru);
...@@ -88,7 +88,7 @@ static int gru_reset_asid_limit(struct gru_state *gru, int asid) ...@@ -88,7 +88,7 @@ static int gru_reset_asid_limit(struct gru_state *gru, int asid)
{ {
int i, gid, inuse_asid, limit; int i, gid, inuse_asid, limit;
gru_dbg(grudev, "gru %p, asid 0x%x\n", gru, asid); gru_dbg(grudev, "gid %d, asid 0x%x\n", gru->gs_gid, asid);
STAT(asid_next); STAT(asid_next);
limit = MAX_ASID; limit = MAX_ASID;
if (asid >= limit) if (asid >= limit)
...@@ -99,8 +99,9 @@ again: ...@@ -99,8 +99,9 @@ again:
if (!gru->gs_gts[i]) if (!gru->gs_gts[i])
continue; continue;
inuse_asid = gru->gs_gts[i]->ts_gms->ms_asids[gid].mt_asid; inuse_asid = gru->gs_gts[i]->ts_gms->ms_asids[gid].mt_asid;
gru_dbg(grudev, "gru %p, inuse_asid 0x%x, cxtnum %d, gts %p\n", gru_dbg(grudev, "gid %d, gts %p, gms %p, inuse 0x%x, cxt %d\n",
gru, inuse_asid, i, gru->gs_gts[i]); gru->gs_gid, gru->gs_gts[i], gru->gs_gts[i]->ts_gms,
inuse_asid, i);
if (inuse_asid == asid) { if (inuse_asid == asid) {
asid += ASID_INC; asid += ASID_INC;
if (asid >= limit) { if (asid >= limit) {
...@@ -120,8 +121,8 @@ again: ...@@ -120,8 +121,8 @@ again:
} }
gru->gs_asid_limit = limit; gru->gs_asid_limit = limit;
gru->gs_asid = asid; gru->gs_asid = asid;
gru_dbg(grudev, "gru %p, new asid 0x%x, new_limit 0x%x\n", gru, asid, gru_dbg(grudev, "gid %d, new asid 0x%x, new_limit 0x%x\n", gru->gs_gid,
limit); asid, limit);
return asid; return asid;
} }
...@@ -137,7 +138,7 @@ static int gru_assign_asid(struct gru_state *gru) ...@@ -137,7 +138,7 @@ static int gru_assign_asid(struct gru_state *gru)
asid = gru_reset_asid_limit(gru, asid); asid = gru_reset_asid_limit(gru, asid);
spin_unlock(&gru->gs_asid_lock); spin_unlock(&gru->gs_asid_lock);
gru_dbg(grudev, "gru %p, asid 0x%x\n", gru, asid); gru_dbg(grudev, "gid %d, asid 0x%x\n", gru->gs_gid, asid);
return asid; return asid;
} }
...@@ -215,11 +216,12 @@ static int check_gru_resources(struct gru_state *gru, int cbr_au_count, ...@@ -215,11 +216,12 @@ static int check_gru_resources(struct gru_state *gru, int cbr_au_count,
* TLB manangment requires tracking all GRU chiplets that have loaded a GSEG * TLB manangment requires tracking all GRU chiplets that have loaded a GSEG
* context. * context.
*/ */
static int gru_load_mm_tracker(struct gru_state *gru, struct gru_mm_struct *gms, static int gru_load_mm_tracker(struct gru_state *gru,
int ctxnum) struct gru_thread_state *gts)
{ {
struct gru_mm_struct *gms = gts->ts_gms;
struct gru_mm_tracker *asids = &gms->ms_asids[gru->gs_gid]; struct gru_mm_tracker *asids = &gms->ms_asids[gru->gs_gid];
unsigned short ctxbitmap = (1 << ctxnum); unsigned short ctxbitmap = (1 << gts->ts_ctxnum);
int asid; int asid;
spin_lock(&gms->ms_asid_lock); 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,24 +243,26 @@ static int gru_load_mm_tracker(struct gru_state *gru, struct gru_mm_struct *gms,
spin_unlock(&gms->ms_asid_lock); spin_unlock(&gms->ms_asid_lock);
gru_dbg(grudev, gru_dbg(grudev,
"gru %x, gms %p, ctxnum 0x%d, asid 0x%x, asidmap 0x%lx\n", "gid %d, gts %p, gms %p, ctxnum %d, asid 0x%x, asidmap 0x%lx\n",
gru->gs_gid, gms, ctxnum, asid, gms->ms_asidmap[0]); gru->gs_gid, gts, gms, gts->ts_ctxnum, asid,
gms->ms_asidmap[0]);
return asid; return asid;
} }
static void gru_unload_mm_tracker(struct gru_state *gru, static void gru_unload_mm_tracker(struct gru_state *gru,
struct gru_mm_struct *gms, int ctxnum) struct gru_thread_state *gts)
{ {
struct gru_mm_struct *gms = gts->ts_gms;
struct gru_mm_tracker *asids; struct gru_mm_tracker *asids;
unsigned short ctxbitmap; unsigned short ctxbitmap;
asids = &gms->ms_asids[gru->gs_gid]; asids = &gms->ms_asids[gru->gs_gid];
ctxbitmap = (1 << ctxnum); ctxbitmap = (1 << gts->ts_ctxnum);
spin_lock(&gms->ms_asid_lock); spin_lock(&gms->ms_asid_lock);
BUG_ON((asids->mt_ctxbitmap & ctxbitmap) != ctxbitmap); BUG_ON((asids->mt_ctxbitmap & ctxbitmap) != ctxbitmap);
asids->mt_ctxbitmap ^= ctxbitmap; asids->mt_ctxbitmap ^= ctxbitmap;
gru_dbg(grudev, "gru %x, gms %p, ctxnum 0x%d, asidmap 0x%lx\n", gru_dbg(grudev, "gid %d, gts %p, gms %p, ctxnum 0x%d, asidmap 0x%lx\n",
gru->gs_gid, gms, ctxnum, gms->ms_asidmap[0]); gru->gs_gid, gts, gms, gts->ts_ctxnum, gms->ms_asidmap[0]);
spin_unlock(&gms->ms_asid_lock); spin_unlock(&gms->ms_asid_lock);
} }
...@@ -399,7 +403,7 @@ static void gru_free_gru_context(struct gru_thread_state *gts) ...@@ -399,7 +403,7 @@ static void gru_free_gru_context(struct gru_thread_state *gts)
struct gru_state *gru; struct gru_state *gru;
gru = gts->ts_gru; gru = gts->ts_gru;
gru_dbg(grudev, "gts %p, gru %p\n", gts, gru); gru_dbg(grudev, "gts %p, gid %d\n", gts, gru->gs_gid);
spin_lock(&gru->gs_lock); spin_lock(&gru->gs_lock);
gru->gs_gts[gts->ts_ctxnum] = NULL; gru->gs_gts[gts->ts_ctxnum] = NULL;
...@@ -500,12 +504,12 @@ void gru_unload_context(struct gru_thread_state *gts, int savestate) ...@@ -500,12 +504,12 @@ void gru_unload_context(struct gru_thread_state *gts, int savestate)
zap_vma_ptes(gts->ts_vma, UGRUADDR(gts), GRU_GSEG_PAGESIZE); zap_vma_ptes(gts->ts_vma, UGRUADDR(gts), GRU_GSEG_PAGESIZE);
cch = get_cch(gru->gs_gru_base_vaddr, ctxnum); cch = get_cch(gru->gs_gru_base_vaddr, ctxnum);
gru_dbg(grudev, "gts %p\n", gts);
lock_cch_handle(cch); lock_cch_handle(cch);
if (cch_interrupt_sync(cch)) if (cch_interrupt_sync(cch))
BUG(); BUG();
gru_dbg(grudev, "gts %p\n", gts);
gru_unload_mm_tracker(gru, gts->ts_gms, gts->ts_ctxnum); gru_unload_mm_tracker(gru, gts);
if (savestate) if (savestate)
gru_unload_context_data(gts->ts_gdata, gru->gs_gru_base_vaddr, gru_unload_context_data(gts->ts_gdata, gru->gs_gru_base_vaddr,
ctxnum, gts->ts_cbr_map, ctxnum, gts->ts_cbr_map,
...@@ -534,7 +538,7 @@ static void gru_load_context(struct gru_thread_state *gts) ...@@ -534,7 +538,7 @@ static void gru_load_context(struct gru_thread_state *gts)
cch = get_cch(gru->gs_gru_base_vaddr, ctxnum); cch = get_cch(gru->gs_gru_base_vaddr, ctxnum);
lock_cch_handle(cch); lock_cch_handle(cch);
asid = gru_load_mm_tracker(gru, gts->ts_gms, gts->ts_ctxnum); asid = gru_load_mm_tracker(gru, gts);
cch->tfm_fault_bit_enable = cch->tfm_fault_bit_enable =
(gts->ts_user_options == GRU_OPT_MISS_FMM_POLL (gts->ts_user_options == GRU_OPT_MISS_FMM_POLL
|| gts->ts_user_options == GRU_OPT_MISS_FMM_INTR); || gts->ts_user_options == GRU_OPT_MISS_FMM_INTR);
...@@ -688,7 +692,7 @@ static void gru_steal_context(struct gru_thread_state *gts) ...@@ -688,7 +692,7 @@ static void gru_steal_context(struct gru_thread_state *gts)
STAT(steal_context_failed); STAT(steal_context_failed);
} }
gru_dbg(grudev, gru_dbg(grudev,
"stole gru %x, ctxnum %d from gts %p. Need cb %d, ds %d;" "stole gid %d, ctxnum %d from gts %p. Need cb %d, ds %d;"
" avail cb %ld, ds %ld\n", " avail cb %ld, ds %ld\n",
gru->gs_gid, ctxnum, ngts, cbr, dsr, hweight64(gru->gs_cbr_map), gru->gs_gid, ctxnum, ngts, cbr, dsr, hweight64(gru->gs_cbr_map),
hweight64(gru->gs_dsr_map)); hweight64(gru->gs_dsr_map));
...@@ -737,7 +741,7 @@ again: ...@@ -737,7 +741,7 @@ again:
STAT(assign_context); STAT(assign_context);
gru_dbg(grudev, gru_dbg(grudev,
"gseg %p, gts %p, gru %x, ctx %d, cbr %d, dsr %d\n", "gseg %p, gts %p, gid %d, ctx %d, cbr %d, dsr %d\n",
gseg_virtual_address(gts->ts_gru, gts->ts_ctxnum), gts, gseg_virtual_address(gts->ts_gru, gts->ts_ctxnum), gts,
gts->ts_gru->gs_gid, gts->ts_ctxnum, gts->ts_gru->gs_gid, gts->ts_ctxnum,
gts->ts_cbr_au_count, gts->ts_dsr_au_count); gts->ts_cbr_au_count, gts->ts_dsr_au_count);
......
...@@ -62,7 +62,9 @@ static int statistics_show(struct seq_file *s, void *p) ...@@ -62,7 +62,9 @@ static int statistics_show(struct seq_file *s, void *p)
printstat(s, asid_wrap); printstat(s, asid_wrap);
printstat(s, asid_reuse); printstat(s, asid_reuse);
printstat(s, intr); printstat(s, intr);
printstat(s, intr_mm_lock_failed);
printstat(s, call_os); printstat(s, call_os);
printstat(s, call_os_offnode_reference);
printstat(s, call_os_check_for_bug); printstat(s, call_os_check_for_bug);
printstat(s, call_os_wait_queue); printstat(s, call_os_wait_queue);
printstat(s, user_flush_tlb); printstat(s, user_flush_tlb);
......
...@@ -184,7 +184,9 @@ struct gru_stats_s { ...@@ -184,7 +184,9 @@ struct gru_stats_s {
atomic_long_t asid_wrap; atomic_long_t asid_wrap;
atomic_long_t asid_reuse; atomic_long_t asid_reuse;
atomic_long_t intr; atomic_long_t intr;
atomic_long_t intr_mm_lock_failed;
atomic_long_t call_os; atomic_long_t call_os;
atomic_long_t call_os_offnode_reference;
atomic_long_t call_os_check_for_bug; atomic_long_t call_os_check_for_bug;
atomic_long_t call_os_wait_queue; atomic_long_t call_os_wait_queue;
atomic_long_t user_flush_tlb; atomic_long_t user_flush_tlb;
......
...@@ -210,7 +210,7 @@ void gru_flush_all_tlb(struct gru_state *gru) ...@@ -210,7 +210,7 @@ void gru_flush_all_tlb(struct gru_state *gru)
{ {
struct gru_tlb_global_handle *tgh; struct gru_tlb_global_handle *tgh;
gru_dbg(grudev, "gru %p, gid %d\n", gru, gru->gs_gid); gru_dbg(grudev, "gid %d\n", gru->gs_gid);
tgh = get_lock_tgh_handle(gru); tgh = get_lock_tgh_handle(gru);
tgh_invalidate(tgh, 0, ~0, 0, 1, 1, GRUMAXINVAL - 1, 0xffff); tgh_invalidate(tgh, 0, ~0, 0, 1, 1, GRUMAXINVAL - 1, 0xffff);
get_unlock_tgh_handle(tgh); get_unlock_tgh_handle(tgh);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment