aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2016-10-25 11:58:17 -0400
committerVineet Gupta <vgupta@synopsys.com>2016-10-28 13:10:28 -0400
commitf644e3688855902ad11549029098a62cbbc8f558 (patch)
treefcdc46e5566274d22e06ec99bb331bef9a79cfa4 /arch/arc
parentc3005475889c7c730638f95d13be3360f0b33e98 (diff)
ARC: mm: retire ARC_DBG_TLB_MISS_COUNT...
... given that we have perf counters abel to do the same thing non intrusively Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc')
-rw-r--r--arch/arc/Kconfig8
-rw-r--r--arch/arc/kernel/troubleshoot.c110
-rw-r--r--arch/arc/mm/tlbex.S21
3 files changed, 0 insertions, 139 deletions
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index ac0b309aced5..bd204bfa29ed 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -540,14 +540,6 @@ config ARC_DBG_TLB_PARANOIA
540 bool "Paranoia Checks in Low Level TLB Handlers" 540 bool "Paranoia Checks in Low Level TLB Handlers"
541 default n 541 default n
542 542
543config ARC_DBG_TLB_MISS_COUNT
544 bool "Profile TLB Misses"
545 default n
546 select DEBUG_FS
547 help
548 Counts number of I and D TLB Misses and exports them via Debugfs
549 The counters can be cleared via Debugfs as well
550
551endif 543endif
552 544
553config ARC_UBOOT_SUPPORT 545config ARC_UBOOT_SUPPORT
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
251static struct dentry *test_dentry;
252static struct dentry *test_dir;
253static struct dentry *test_u32_dentry;
254
255static u32 clr_on_read = 1;
256
257#ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT
258u32 numitlb, numdtlb, num_pte_not_present;
259
260static 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
273static 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 */
280static 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 */
303static 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
310static int tlb_stats_close(struct inode *inode, struct file *file)
311{
312 free_page((unsigned long)(file->private_data));
313 return 0;
314}
315
316static 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
324static 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
339module_init(arc_debugfs_init);
340
341static void __exit arc_debugfs_exit(void)
342{
343 debugfs_remove(test_u32_dentry);
344 debugfs_remove(test_dentry);
345 debugfs_remove(test_dir);
346}
347module_exit(arc_debugfs_exit);
348
349#endif
diff --git a/arch/arc/mm/tlbex.S b/arch/arc/mm/tlbex.S
index f1967eeb32e7..b30e4e36bb00 100644
--- a/arch/arc/mm/tlbex.S
+++ b/arch/arc/mm/tlbex.S
@@ -237,15 +237,6 @@ ex_saved_reg1:
237 237
2382: 2382:
239 239
240#ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT
241 and.f 0, r0, _PAGE_PRESENT
242 bz 1f
243 ld r3, [num_pte_not_present]
244 add r3, r3, 1
245 st r3, [num_pte_not_present]
2461:
247#endif
248
249.endm 240.endm
250 241
251;----------------------------------------------------------------- 242;-----------------------------------------------------------------
@@ -309,12 +300,6 @@ ENTRY(EV_TLBMissI)
309 300
310 TLBMISS_FREEUP_REGS 301 TLBMISS_FREEUP_REGS
311 302
312#ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT
313 ld r0, [@numitlb]
314 add r0, r0, 1
315 st r0, [@numitlb]
316#endif
317
318 ;---------------------------------------------------------------- 303 ;----------------------------------------------------------------
319 ; Get the PTE corresponding to V-addr accessed, r2 is setup with EFA 304 ; Get the PTE corresponding to V-addr accessed, r2 is setup with EFA
320 LOAD_FAULT_PTE 305 LOAD_FAULT_PTE
@@ -349,12 +334,6 @@ ENTRY(EV_TLBMissD)
349 334
350 TLBMISS_FREEUP_REGS 335 TLBMISS_FREEUP_REGS
351 336
352#ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT
353 ld r0, [@numdtlb]
354 add r0, r0, 1
355 st r0, [@numdtlb]
356#endif
357
358 ;---------------------------------------------------------------- 337 ;----------------------------------------------------------------
359 ; Get the PTE corresponding to V-addr accessed 338 ; Get the PTE corresponding to V-addr accessed
360 ; If PTE exists, it will setup, r0 = PTE, r1 = Ptr to PTE, r2 = EFA 339 ; If PTE exists, it will setup, r0 = PTE, r1 = Ptr to PTE, r2 = EFA