aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-gru/gruprocfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/sgi-gru/gruprocfs.c')
-rw-r--r--drivers/misc/sgi-gru/gruprocfs.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/misc/sgi-gru/gruprocfs.c b/drivers/misc/sgi-gru/gruprocfs.c
index 6d63a8d70f86..8724551aa55e 100644
--- a/drivers/misc/sgi-gru/gruprocfs.c
+++ b/drivers/misc/sgi-gru/gruprocfs.c
@@ -122,6 +122,30 @@ static ssize_t statistics_write(struct file *file, const char __user *userbuf,
122 return count; 122 return count;
123} 123}
124 124
125static 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
142static 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
125static int options_show(struct seq_file *s, void *p) 149static int options_show(struct seq_file *s, void *p)
126{ 150{
127 seq_printf(s, "0x%lx\n", gru_options); 151 seq_printf(s, "0x%lx\n", gru_options);
@@ -137,6 +161,7 @@ static ssize_t options_write(struct file *file, const char __user *userbuf,
137 if (copy_from_user 161 if (copy_from_user
138 (buf, userbuf, count < sizeof(buf) ? count : sizeof(buf))) 162 (buf, userbuf, count < sizeof(buf) ? count : sizeof(buf)))
139 return -EFAULT; 163 return -EFAULT;
164 buf[count - 1] = '\0';
140 if (!strict_strtoul(buf, 10, &val)) 165 if (!strict_strtoul(buf, 10, &val))
141 gru_options = val; 166 gru_options = val;
142 167
@@ -233,6 +258,11 @@ static int statistics_open(struct inode *inode, struct file *file)
233 return single_open(file, statistics_show, NULL); 258 return single_open(file, statistics_show, NULL);
234} 259}
235 260
261static int mcs_statistics_open(struct inode *inode, struct file *file)
262{
263 return single_open(file, mcs_statistics_show, NULL);
264}
265
236static int options_open(struct inode *inode, struct file *file) 266static int options_open(struct inode *inode, struct file *file)
237{ 267{
238 return single_open(file, options_show, NULL); 268 return single_open(file, options_show, NULL);
@@ -257,6 +287,14 @@ static const struct file_operations statistics_fops = {
257 .release = single_release, 287 .release = single_release,
258}; 288};
259 289
290static 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
260static const struct file_operations options_fops = { 298static const struct file_operations options_fops = {
261 .open = options_open, 299 .open = options_open,
262 .read = seq_read, 300 .read = seq_read,
@@ -285,6 +323,7 @@ static struct proc_entry {
285 struct proc_dir_entry *entry; 323 struct proc_dir_entry *entry;
286} proc_files[] = { 324} proc_files[] = {
287 {"statistics", 0644, &statistics_fops}, 325 {"statistics", 0644, &statistics_fops},
326 {"mcs_statistics", 0644, &mcs_statistics_fops},
288 {"debug_options", 0644, &options_fops}, 327 {"debug_options", 0644, &options_fops},
289 {"cch_status", 0444, &cch_fops}, 328 {"cch_status", 0444, &cch_fops},
290 {"gru_status", 0444, &gru_fops}, 329 {"gru_status", 0444, &gru_fops},