diff options
Diffstat (limited to 'drivers/misc/sgi-gru/gruprocfs.c')
-rw-r--r-- | drivers/misc/sgi-gru/gruprocfs.c | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/drivers/misc/sgi-gru/gruprocfs.c b/drivers/misc/sgi-gru/gruprocfs.c index 73b0ca061bb5..ee74821b171c 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); |
@@ -120,6 +122,30 @@ static ssize_t statistics_write(struct file *file, const char __user *userbuf, | |||
120 | return count; | 122 | return count; |
121 | } | 123 | } |
122 | 124 | ||
125 | static int mcs_statistics_show(struct seq_file *s, void *p) | ||
126 | { | ||
127 | int op; | ||
128 | unsigned long total, count, max; | ||
129 | static char *id[] = {"cch_allocate", "cch_start", "cch_interrupt", | ||
130 | "cch_interrupt_sync", "cch_deallocate", "tgh_invalidate"}; | ||
131 | |||
132 | for (op = 0; op < mcsop_last; op++) { | ||
133 | count = atomic_long_read(&mcs_op_statistics[op].count); | ||
134 | total = atomic_long_read(&mcs_op_statistics[op].total); | ||
135 | max = mcs_op_statistics[op].max; | ||
136 | seq_printf(s, "%-20s%12ld%12ld%12ld\n", id[op], count, | ||
137 | count ? total / count : 0, max); | ||
138 | } | ||
139 | return 0; | ||
140 | } | ||
141 | |||
142 | static ssize_t mcs_statistics_write(struct file *file, | ||
143 | const char __user *userbuf, size_t count, loff_t *data) | ||
144 | { | ||
145 | memset(mcs_op_statistics, 0, sizeof(mcs_op_statistics)); | ||
146 | return count; | ||
147 | } | ||
148 | |||
123 | static int options_show(struct seq_file *s, void *p) | 149 | static int options_show(struct seq_file *s, void *p) |
124 | { | 150 | { |
125 | seq_printf(s, "0x%lx\n", gru_options); | 151 | seq_printf(s, "0x%lx\n", gru_options); |
@@ -135,6 +161,7 @@ static ssize_t options_write(struct file *file, const char __user *userbuf, | |||
135 | if (copy_from_user | 161 | if (copy_from_user |
136 | (buf, userbuf, count < sizeof(buf) ? count : sizeof(buf))) | 162 | (buf, userbuf, count < sizeof(buf) ? count : sizeof(buf))) |
137 | return -EFAULT; | 163 | return -EFAULT; |
164 | buf[count - 1] = '\0'; | ||
138 | if (!strict_strtoul(buf, 10, &val)) | 165 | if (!strict_strtoul(buf, 10, &val)) |
139 | gru_options = val; | 166 | gru_options = val; |
140 | 167 | ||
@@ -199,7 +226,7 @@ static void seq_stop(struct seq_file *file, void *data) | |||
199 | 226 | ||
200 | static void *seq_start(struct seq_file *file, loff_t *gid) | 227 | static void *seq_start(struct seq_file *file, loff_t *gid) |
201 | { | 228 | { |
202 | if (*gid < GRU_MAX_GRUS) | 229 | if (*gid < gru_max_gids) |
203 | return gid; | 230 | return gid; |
204 | return NULL; | 231 | return NULL; |
205 | } | 232 | } |
@@ -207,7 +234,7 @@ static void *seq_start(struct seq_file *file, loff_t *gid) | |||
207 | static void *seq_next(struct seq_file *file, void *data, loff_t *gid) | 234 | static void *seq_next(struct seq_file *file, void *data, loff_t *gid) |
208 | { | 235 | { |
209 | (*gid)++; | 236 | (*gid)++; |
210 | if (*gid < GRU_MAX_GRUS) | 237 | if (*gid < gru_max_gids) |
211 | return gid; | 238 | return gid; |
212 | return NULL; | 239 | return NULL; |
213 | } | 240 | } |
@@ -231,6 +258,11 @@ static int statistics_open(struct inode *inode, struct file *file) | |||
231 | return single_open(file, statistics_show, NULL); | 258 | return single_open(file, statistics_show, NULL); |
232 | } | 259 | } |
233 | 260 | ||
261 | static int mcs_statistics_open(struct inode *inode, struct file *file) | ||
262 | { | ||
263 | return single_open(file, mcs_statistics_show, NULL); | ||
264 | } | ||
265 | |||
234 | static int options_open(struct inode *inode, struct file *file) | 266 | static int options_open(struct inode *inode, struct file *file) |
235 | { | 267 | { |
236 | return single_open(file, options_show, NULL); | 268 | return single_open(file, options_show, NULL); |
@@ -255,6 +287,14 @@ static const struct file_operations statistics_fops = { | |||
255 | .release = single_release, | 287 | .release = single_release, |
256 | }; | 288 | }; |
257 | 289 | ||
290 | static const struct file_operations mcs_statistics_fops = { | ||
291 | .open = mcs_statistics_open, | ||
292 | .read = seq_read, | ||
293 | .write = mcs_statistics_write, | ||
294 | .llseek = seq_lseek, | ||
295 | .release = single_release, | ||
296 | }; | ||
297 | |||
258 | static const struct file_operations options_fops = { | 298 | static const struct file_operations options_fops = { |
259 | .open = options_open, | 299 | .open = options_open, |
260 | .read = seq_read, | 300 | .read = seq_read, |
@@ -283,6 +323,7 @@ static struct proc_entry { | |||
283 | struct proc_dir_entry *entry; | 323 | struct proc_dir_entry *entry; |
284 | } proc_files[] = { | 324 | } proc_files[] = { |
285 | {"statistics", 0644, &statistics_fops}, | 325 | {"statistics", 0644, &statistics_fops}, |
326 | {"mcs_statistics", 0644, &mcs_statistics_fops}, | ||
286 | {"debug_options", 0644, &options_fops}, | 327 | {"debug_options", 0644, &options_fops}, |
287 | {"cch_status", 0444, &cch_fops}, | 328 | {"cch_status", 0444, &cch_fops}, |
288 | {"gru_status", 0444, &gru_fops}, | 329 | {"gru_status", 0444, &gru_fops}, |