diff options
author | Jack Steiner <steiner@sgi.com> | 2009-06-17 19:28:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-18 16:04:03 -0400 |
commit | 7e796a72a2691d7094fd62da61097294d0d59ce4 (patch) | |
tree | 9e8d4e1eae9a2d23f604f0af5d101979dc7afec7 /drivers/misc | |
parent | d6e2fbce0d70c2072a1c478dbd37b34d27129d74 (diff) |
gru: collect per-context user statistics
Collect GRU statistics for each user GRU context. Statistics are kept for
TLB misses & content resource contention. Add user request for retrieving
the 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')
-rw-r--r-- | drivers/misc/sgi-gru/grufault.c | 27 | ||||
-rw-r--r-- | drivers/misc/sgi-gru/grufile.c | 3 | ||||
-rw-r--r-- | drivers/misc/sgi-gru/grulib.h | 18 | ||||
-rw-r--r-- | drivers/misc/sgi-gru/grumain.c | 1 | ||||
-rw-r--r-- | drivers/misc/sgi-gru/grutables.h | 3 |
5 files changed, 52 insertions, 0 deletions
diff --git a/drivers/misc/sgi-gru/grufault.c b/drivers/misc/sgi-gru/grufault.c index 6d0681236db5..cdd151b30dc7 100644 --- a/drivers/misc/sgi-gru/grufault.c +++ b/drivers/misc/sgi-gru/grufault.c | |||
@@ -498,6 +498,7 @@ irqreturn_t gru_intr(int irq, void *dev_id) | |||
498 | */ | 498 | */ |
499 | if (!gts->ts_force_cch_reload && | 499 | if (!gts->ts_force_cch_reload && |
500 | down_read_trylock(>s->ts_mm->mmap_sem)) { | 500 | down_read_trylock(>s->ts_mm->mmap_sem)) { |
501 | gts->ustats.fmm_tlbdropin++; | ||
501 | gru_try_dropin(gts, tfh, NULL); | 502 | gru_try_dropin(gts, tfh, NULL); |
502 | up_read(>s->ts_mm->mmap_sem); | 503 | up_read(>s->ts_mm->mmap_sem); |
503 | } else { | 504 | } else { |
@@ -516,6 +517,7 @@ static int gru_user_dropin(struct gru_thread_state *gts, | |||
516 | struct gru_mm_struct *gms = gts->ts_gms; | 517 | struct gru_mm_struct *gms = gts->ts_gms; |
517 | int ret; | 518 | int ret; |
518 | 519 | ||
520 | gts->ustats.upm_tlbdropin++; | ||
519 | while (1) { | 521 | while (1) { |
520 | wait_event(gms->ms_wait_queue, | 522 | wait_event(gms->ms_wait_queue, |
521 | atomic_read(&gms->ms_range_active) == 0); | 523 | atomic_read(&gms->ms_range_active) == 0); |
@@ -719,6 +721,31 @@ int gru_user_flush_tlb(unsigned long arg) | |||
719 | } | 721 | } |
720 | 722 | ||
721 | /* | 723 | /* |
724 | * Fetch GSEG statisticss | ||
725 | */ | ||
726 | long gru_get_gseg_statistics(unsigned long arg) | ||
727 | { | ||
728 | struct gru_thread_state *gts; | ||
729 | struct gru_get_gseg_statistics_req req; | ||
730 | |||
731 | if (copy_from_user(&req, (void __user *)arg, sizeof(req))) | ||
732 | return -EFAULT; | ||
733 | |||
734 | gts = gru_find_lock_gts(req.gseg); | ||
735 | if (gts) { | ||
736 | memcpy(&req.stats, >s->ustats, sizeof(gts->ustats)); | ||
737 | gru_unlock_gts(gts); | ||
738 | } else { | ||
739 | memset(&req.stats, 0, sizeof(gts->ustats)); | ||
740 | } | ||
741 | |||
742 | if (copy_to_user((void __user *)arg, &req, sizeof(req))) | ||
743 | return -EFAULT; | ||
744 | |||
745 | return 0; | ||
746 | } | ||
747 | |||
748 | /* | ||
722 | * Register the current task as the user of the GSEG slice. | 749 | * Register the current task as the user of the GSEG slice. |
723 | * Needed for TLB fault interrupt targeting. | 750 | * Needed for TLB fault interrupt targeting. |
724 | */ | 751 | */ |
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c index e22012db239e..0d1c8b8c1c12 100644 --- a/drivers/misc/sgi-gru/grufile.c +++ b/drivers/misc/sgi-gru/grufile.c | |||
@@ -251,6 +251,9 @@ static long gru_file_unlocked_ioctl(struct file *file, unsigned int req, | |||
251 | case GRU_USER_CALL_OS: | 251 | case GRU_USER_CALL_OS: |
252 | err = gru_handle_user_call_os(arg); | 252 | err = gru_handle_user_call_os(arg); |
253 | break; | 253 | break; |
254 | case GRU_GET_GSEG_STATISTICS: | ||
255 | err = gru_get_gseg_statistics(arg); | ||
256 | break; | ||
254 | case GRU_KTEST: | 257 | case GRU_KTEST: |
255 | err = gru_ktest(arg); | 258 | err = gru_ktest(arg); |
256 | break; | 259 | break; |
diff --git a/drivers/misc/sgi-gru/grulib.h b/drivers/misc/sgi-gru/grulib.h index 87586551d16f..c5865dd19eec 100644 --- a/drivers/misc/sgi-gru/grulib.h +++ b/drivers/misc/sgi-gru/grulib.h | |||
@@ -50,6 +50,9 @@ | |||
50 | /* For dumpping GRU chiplet state */ | 50 | /* For dumpping GRU chiplet state */ |
51 | #define GRU_DUMP_CHIPLET_STATE _IOWR(GRU_IOCTL_NUM, 11, void *) | 51 | #define GRU_DUMP_CHIPLET_STATE _IOWR(GRU_IOCTL_NUM, 11, void *) |
52 | 52 | ||
53 | /* For getting gseg statistics */ | ||
54 | #define GRU_GET_GSEG_STATISTICS _IOWR(GRU_IOCTL_NUM, 12, void *) | ||
55 | |||
53 | /* For user TLB flushing (primarily for tests) */ | 56 | /* For user TLB flushing (primarily for tests) */ |
54 | #define GRU_USER_FLUSH_TLB _IOWR(GRU_IOCTL_NUM, 50, void *) | 57 | #define GRU_USER_FLUSH_TLB _IOWR(GRU_IOCTL_NUM, 50, void *) |
55 | 58 | ||
@@ -61,6 +64,21 @@ | |||
61 | 64 | ||
62 | #define CONTEXT_WINDOW_BYTES(th) (GRU_GSEG_PAGESIZE * (th)) | 65 | #define CONTEXT_WINDOW_BYTES(th) (GRU_GSEG_PAGESIZE * (th)) |
63 | #define THREAD_POINTER(p, th) (p + GRU_GSEG_PAGESIZE * (th)) | 66 | #define THREAD_POINTER(p, th) (p + GRU_GSEG_PAGESIZE * (th)) |
67 | #define GSEG_START(cb) ((void *)((unsigned long)(cb) & ~(GRU_GSEG_PAGESIZE - 1))) | ||
68 | |||
69 | /* | ||
70 | * Statictics kept on a per-GTS basis. | ||
71 | */ | ||
72 | struct gts_statistics { | ||
73 | unsigned long fmm_tlbdropin; | ||
74 | unsigned long upm_tlbdropin; | ||
75 | unsigned long context_stolen; | ||
76 | }; | ||
77 | |||
78 | struct gru_get_gseg_statistics_req { | ||
79 | unsigned long gseg; | ||
80 | struct gts_statistics stats; | ||
81 | }; | ||
64 | 82 | ||
65 | /* | 83 | /* |
66 | * Structure used to pass TLB flush parameters to the driver | 84 | * Structure used to pass TLB flush parameters to the driver |
diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c index e38a0f1775ff..347004e4f591 100644 --- a/drivers/misc/sgi-gru/grumain.c +++ b/drivers/misc/sgi-gru/grumain.c | |||
@@ -744,6 +744,7 @@ void gru_steal_context(struct gru_thread_state *gts, int blade_id) | |||
744 | spin_unlock(&blade->bs_lock); | 744 | spin_unlock(&blade->bs_lock); |
745 | 745 | ||
746 | if (ngts) { | 746 | if (ngts) { |
747 | gts->ustats.context_stolen++; | ||
747 | ngts->ts_steal_jiffies = jiffies; | 748 | ngts->ts_steal_jiffies = jiffies; |
748 | gru_unload_context(ngts, is_kernel_context(ngts) ? 0 : 1); | 749 | gru_unload_context(ngts, is_kernel_context(ngts) ? 0 : 1); |
749 | gts_stolen(ngts, blade); | 750 | gts_stolen(ngts, blade); |
diff --git a/drivers/misc/sgi-gru/grutables.h b/drivers/misc/sgi-gru/grutables.h index 9761bfee8669..63b76e2732ff 100644 --- a/drivers/misc/sgi-gru/grutables.h +++ b/drivers/misc/sgi-gru/grutables.h | |||
@@ -148,6 +148,7 @@ | |||
148 | #include <linux/wait.h> | 148 | #include <linux/wait.h> |
149 | #include <linux/mmu_notifier.h> | 149 | #include <linux/mmu_notifier.h> |
150 | #include "gru.h" | 150 | #include "gru.h" |
151 | #include "grulib.h" | ||
151 | #include "gruhandles.h" | 152 | #include "gruhandles.h" |
152 | 153 | ||
153 | extern struct gru_stats_s gru_stats; | 154 | extern struct gru_stats_s gru_stats; |
@@ -388,6 +389,7 @@ struct gru_thread_state { | |||
388 | allocated CB */ | 389 | allocated CB */ |
389 | int ts_data_valid; /* Indicates if ts_gdata has | 390 | int ts_data_valid; /* Indicates if ts_gdata has |
390 | valid data */ | 391 | valid data */ |
392 | struct gts_statistics ustats; /* User statistics */ | ||
391 | unsigned long ts_gdata[0]; /* save area for GRU data (CB, | 393 | unsigned long ts_gdata[0]; /* save area for GRU data (CB, |
392 | DS, CBE) */ | 394 | DS, CBE) */ |
393 | }; | 395 | }; |
@@ -641,6 +643,7 @@ extern void gru_tgh_flush_init(struct gru_state *gru); | |||
641 | extern int gru_kservices_init(void); | 643 | extern int gru_kservices_init(void); |
642 | extern void gru_kservices_exit(void); | 644 | extern void gru_kservices_exit(void); |
643 | extern int gru_dump_chiplet_request(unsigned long arg); | 645 | extern int gru_dump_chiplet_request(unsigned long arg); |
646 | extern long gru_get_gseg_statistics(unsigned long arg); | ||
644 | extern irqreturn_t gru_intr(int irq, void *dev_id); | 647 | extern irqreturn_t gru_intr(int irq, void *dev_id); |
645 | extern int gru_handle_user_call_os(unsigned long address); | 648 | extern int gru_handle_user_call_os(unsigned long address); |
646 | extern int gru_user_flush_tlb(unsigned long arg); | 649 | extern int gru_user_flush_tlb(unsigned long arg); |