diff options
Diffstat (limited to 'arch/arc/kernel/troubleshoot.c')
-rw-r--r-- | arch/arc/kernel/troubleshoot.c | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c index 934150e7ac48..82f9bc819f4a 100644 --- a/arch/arc/kernel/troubleshoot.c +++ b/arch/arc/kernel/troubleshoot.c | |||
@@ -237,113 +237,3 @@ void show_kernel_fault_diag(const char *str, struct pt_regs *regs, | |||
237 | if (!user_mode(regs)) | 237 | if (!user_mode(regs)) |
238 | show_stacktrace(current, regs); | 238 | show_stacktrace(current, regs); |
239 | } | 239 | } |
240 | |||
241 | #ifdef CONFIG_DEBUG_FS | ||
242 | |||
243 | #include <linux/module.h> | ||
244 | #include <linux/fs.h> | ||
245 | #include <linux/mount.h> | ||
246 | #include <linux/pagemap.h> | ||
247 | #include <linux/init.h> | ||
248 | #include <linux/namei.h> | ||
249 | #include <linux/debugfs.h> | ||
250 | |||
251 | static struct dentry *test_dentry; | ||
252 | static struct dentry *test_dir; | ||
253 | static struct dentry *test_u32_dentry; | ||
254 | |||
255 | static u32 clr_on_read = 1; | ||
256 | |||
257 | #ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT | ||
258 | u32 numitlb, numdtlb, num_pte_not_present; | ||
259 | |||
260 | static int fill_display_data(char *kbuf) | ||
261 | { | ||
262 | size_t num = 0; | ||
263 | num += sprintf(kbuf + num, "I-TLB Miss %x\n", numitlb); | ||
264 | num += sprintf(kbuf + num, "D-TLB Miss %x\n", numdtlb); | ||
265 | num += sprintf(kbuf + num, "PTE not present %x\n", num_pte_not_present); | ||
266 | |||
267 | if (clr_on_read) | ||
268 | numitlb = numdtlb = num_pte_not_present = 0; | ||
269 | |||
270 | return num; | ||
271 | } | ||
272 | |||
273 | static int tlb_stats_open(struct inode *inode, struct file *file) | ||
274 | { | ||
275 | file->private_data = (void *)__get_free_page(GFP_KERNEL); | ||
276 | return 0; | ||
277 | } | ||
278 | |||
279 | /* called on user read(): display the counters */ | ||
280 | static ssize_t tlb_stats_output(struct file *file, /* file descriptor */ | ||
281 | char __user *user_buf, /* user buffer */ | ||
282 | size_t len, /* length of buffer */ | ||
283 | loff_t *offset) /* offset in the file */ | ||
284 | { | ||
285 | size_t num; | ||
286 | char *kbuf = (char *)file->private_data; | ||
287 | |||
288 | /* All of the data can he shoved in one iteration */ | ||
289 | if (*offset != 0) | ||
290 | return 0; | ||
291 | |||
292 | num = fill_display_data(kbuf); | ||
293 | |||
294 | /* simple_read_from_buffer() is helper for copy to user space | ||
295 | It copies up to @2 (num) bytes from kernel buffer @4 (kbuf) at offset | ||
296 | @3 (offset) into the user space address starting at @1 (user_buf). | ||
297 | @5 (len) is max size of user buffer | ||
298 | */ | ||
299 | return simple_read_from_buffer(user_buf, num, offset, kbuf, len); | ||
300 | } | ||
301 | |||
302 | /* called on user write : clears the counters */ | ||
303 | static ssize_t tlb_stats_clear(struct file *file, const char __user *user_buf, | ||
304 | size_t length, loff_t *offset) | ||
305 | { | ||
306 | numitlb = numdtlb = num_pte_not_present = 0; | ||
307 | return length; | ||
308 | } | ||
309 | |||
310 | static int tlb_stats_close(struct inode *inode, struct file *file) | ||
311 | { | ||
312 | free_page((unsigned long)(file->private_data)); | ||
313 | return 0; | ||
314 | } | ||
315 | |||
316 | static const struct file_operations tlb_stats_file_ops = { | ||
317 | .read = tlb_stats_output, | ||
318 | .write = tlb_stats_clear, | ||
319 | .open = tlb_stats_open, | ||
320 | .release = tlb_stats_close | ||
321 | }; | ||
322 | #endif | ||
323 | |||
324 | static int __init arc_debugfs_init(void) | ||
325 | { | ||
326 | test_dir = debugfs_create_dir("arc", NULL); | ||
327 | |||
328 | #ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT | ||
329 | test_dentry = debugfs_create_file("tlb_stats", 0444, test_dir, NULL, | ||
330 | &tlb_stats_file_ops); | ||
331 | #endif | ||
332 | |||
333 | test_u32_dentry = | ||
334 | debugfs_create_u32("clr_on_read", 0444, test_dir, &clr_on_read); | ||
335 | |||
336 | return 0; | ||
337 | } | ||
338 | |||
339 | module_init(arc_debugfs_init); | ||
340 | |||
341 | static void __exit arc_debugfs_exit(void) | ||
342 | { | ||
343 | debugfs_remove(test_u32_dentry); | ||
344 | debugfs_remove(test_dentry); | ||
345 | debugfs_remove(test_dir); | ||
346 | } | ||
347 | module_exit(arc_debugfs_exit); | ||
348 | |||
349 | #endif | ||