26 #include <linux/device.h>
33 #define printstat(s, f) printstat_val(s, &gru_stats.f, #f)
37 unsigned long val = atomic_long_read(v);
42 static int statistics_show(
struct seq_file *
s,
void *
p)
77 printstat(s, check_context_retarget_intr);
84 printstat(s, tlb_dropin_fail_range_active);
87 printstat(s, tlb_dropin_fail_no_exception);
102 printstat(s, mesq_send_unexpected_error);
109 printstat(s, mesq_qf_switch_head_failed);
111 printstat(s, mesq_noop_unexpected_error);
120 static ssize_t statistics_write(
struct file *
file,
const char __user *userbuf,
127 static int mcs_statistics_show(
struct seq_file *
s,
void *
p)
131 static char *
id[] = {
"cch_allocate",
"cch_start",
"cch_interrupt",
132 "cch_interrupt_sync",
"cch_deallocate",
"tfh_write_only",
133 "tfh_write_restart",
"tgh_invalidate"};
135 seq_printf(s,
"%-20s%12s%12s%12s\n",
"#id",
"count",
"aver-clks",
"max-clks");
140 seq_printf(s,
"%-20s%12ld%12ld%12ld\n",
id[op], count,
141 count ? total / count : 0, max);
146 static ssize_t mcs_statistics_write(
struct file *file,
147 const char __user *userbuf,
size_t count, loff_t *data)
153 static int options_show(
struct seq_file *s,
void *p)
155 seq_printf(s,
"#bitmask: 1=trace, 2=statistics\n");
160 static ssize_t options_write(
struct file *file,
const char __user *userbuf,
161 size_t count, loff_t *data)
165 if (count >=
sizeof(buf))
176 static int cch_seq_show(
struct seq_file *file,
void *data)
178 long gid = *(
long *)data;
182 const char *
mode[] = {
"??",
"UPM",
"INTR",
"OS_POLL" };
185 seq_printf(file,
"#%5s%5s%6s%7s%9s%6s%8s%8s\n",
"gid",
"bid",
186 "ctx#",
"asid",
"pid",
"cbrs",
"dsbytes",
"mode");
192 seq_printf(file,
" %5d%5d%6d%7d%9d%6d%8d%8s\n",
194 is_kernel_context(ts) ? 0 : ts->
ts_gms->ms_asids[gid].mt_asid,
205 static int gru_seq_show(
struct seq_file *file,
void *data)
207 long gid = *(
long *)data, ctxfree, cbrfree, dsrfree;
211 seq_printf(file,
"#%5s%5s%7s%6s%6s%8s%6s%6s\n",
"gid",
"nid",
212 "ctx",
"cbr",
"dsr",
"ctx",
"cbr",
"dsr");
213 seq_printf(file,
"#%5s%5s%7s%6s%6s%8s%6s%6s\n",
"",
"",
"busy",
214 "busy",
"busy",
"free",
"free",
"free");
220 seq_printf(file,
" %5d%5d%7ld%6ld%6ld%8ld%6ld%6ld\n",
223 ctxfree, cbrfree, dsrfree);
229 static void seq_stop(
struct seq_file *file,
void *data)
233 static void *seq_start(
struct seq_file *file, loff_t *gid)
235 if (*gid < gru_max_gids)
240 static void *seq_next(
struct seq_file *file,
void *data, loff_t *gid)
243 if (*gid < gru_max_gids)
262 static int statistics_open(
struct inode *
inode,
struct file *file)
267 static int mcs_statistics_open(
struct inode *
inode,
struct file *file)
272 static int options_open(
struct inode *
inode,
struct file *file)
277 static int cch_open(
struct inode *
inode,
struct file *file)
279 return seq_open(file, &cch_seq_ops);
282 static int gru_open(
struct inode *
inode,
struct file *file)
284 return seq_open(file, &gru_seq_ops);
289 .open = statistics_open,
291 .write = statistics_write,
297 .open = mcs_statistics_open,
299 .write = mcs_statistics_write,
305 .open = options_open,
307 .write = options_write,
325 static struct proc_entry {
331 {
"statistics", 0644, &statistics_fops},
332 {
"mcs_statistics", 0644, &mcs_statistics_fops},
333 {
"debug_options", 0644, &options_fops},
334 {
"cch_status", 0444, &cch_fops},
335 {
"gru_status", 0444, &gru_fops},
344 p->entry = proc_create(p->name, p->mode, proc_gru, p->fops);
350 static void delete_proc_files(
void)
352 struct proc_entry *
p;
355 for (p = proc_files; p->name; p++)
364 struct proc_entry *
p;
368 for (p = proc_files; p->name; p++)