Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f644e368 authored by Vineet Gupta's avatar Vineet Gupta
Browse files

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: default avatarVineet Gupta <vgupta@synopsys.com>
parent c3005475
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -540,14 +540,6 @@ config ARC_DBG_TLB_PARANOIA
	bool "Paranoia Checks in Low Level TLB Handlers"
	default n

config ARC_DBG_TLB_MISS_COUNT
	bool "Profile TLB Misses"
	default n
	select DEBUG_FS
	help
	  Counts number of I and D TLB Misses and exports them via Debugfs
	  The counters can be cleared via Debugfs as well

endif

config ARC_UBOOT_SUPPORT
+0 −110
Original line number Diff line number Diff line
@@ -237,113 +237,3 @@ void show_kernel_fault_diag(const char *str, struct pt_regs *regs,
	if (!user_mode(regs))
		show_stacktrace(current, regs);
}

#ifdef CONFIG_DEBUG_FS

#include <linux/module.h>
#include <linux/fs.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
#include <linux/init.h>
#include <linux/namei.h>
#include <linux/debugfs.h>

static struct dentry *test_dentry;
static struct dentry *test_dir;
static struct dentry *test_u32_dentry;

static u32 clr_on_read = 1;

#ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT
u32 numitlb, numdtlb, num_pte_not_present;

static int fill_display_data(char *kbuf)
{
	size_t num = 0;
	num += sprintf(kbuf + num, "I-TLB Miss %x\n", numitlb);
	num += sprintf(kbuf + num, "D-TLB Miss %x\n", numdtlb);
	num += sprintf(kbuf + num, "PTE not present %x\n", num_pte_not_present);

	if (clr_on_read)
		numitlb = numdtlb = num_pte_not_present = 0;

	return num;
}

static int tlb_stats_open(struct inode *inode, struct file *file)
{
	file->private_data = (void *)__get_free_page(GFP_KERNEL);
	return 0;
}

/* called on user read(): display the counters */
static ssize_t tlb_stats_output(struct file *file,	/* file descriptor */
				char __user *user_buf,	/* user buffer */
				size_t len,		/* length of buffer */
				loff_t *offset)		/* offset in the file */
{
	size_t num;
	char *kbuf = (char *)file->private_data;

	/* All of the data can he shoved in one iteration */
	if (*offset != 0)
		return 0;

	num = fill_display_data(kbuf);

	/* simple_read_from_buffer() is helper for copy to user space
	   It copies up to @2 (num) bytes from kernel buffer @4 (kbuf) at offset
	   @3 (offset) into the user space address starting at @1 (user_buf).
	   @5 (len) is max size of user buffer
	 */
	return simple_read_from_buffer(user_buf, num, offset, kbuf, len);
}

/* called on user write : clears the counters */
static ssize_t tlb_stats_clear(struct file *file, const char __user *user_buf,
			       size_t length, loff_t *offset)
{
	numitlb = numdtlb = num_pte_not_present = 0;
	return length;
}

static int tlb_stats_close(struct inode *inode, struct file *file)
{
	free_page((unsigned long)(file->private_data));
	return 0;
}

static const struct file_operations tlb_stats_file_ops = {
	.read = tlb_stats_output,
	.write = tlb_stats_clear,
	.open = tlb_stats_open,
	.release = tlb_stats_close
};
#endif

static int __init arc_debugfs_init(void)
{
	test_dir = debugfs_create_dir("arc", NULL);

#ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT
	test_dentry = debugfs_create_file("tlb_stats", 0444, test_dir, NULL,
					  &tlb_stats_file_ops);
#endif

	test_u32_dentry =
	    debugfs_create_u32("clr_on_read", 0444, test_dir, &clr_on_read);

	return 0;
}

module_init(arc_debugfs_init);

static void __exit arc_debugfs_exit(void)
{
	debugfs_remove(test_u32_dentry);
	debugfs_remove(test_dentry);
	debugfs_remove(test_dir);
}
module_exit(arc_debugfs_exit);

#endif
+0 −21
Original line number Diff line number Diff line
@@ -237,15 +237,6 @@ ex_saved_reg1:

2:

#ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT
	and.f 0, r0, _PAGE_PRESENT
	bz   1f
	ld   r3, [num_pte_not_present]
	add  r3, r3, 1
	st   r3, [num_pte_not_present]
1:
#endif

.endm

;-----------------------------------------------------------------
@@ -309,12 +300,6 @@ ENTRY(EV_TLBMissI)

	TLBMISS_FREEUP_REGS

#ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT
	ld  r0, [@numitlb]
	add r0, r0, 1
	st  r0, [@numitlb]
#endif

	;----------------------------------------------------------------
	; Get the PTE corresponding to V-addr accessed, r2 is setup with EFA
	LOAD_FAULT_PTE
@@ -349,12 +334,6 @@ ENTRY(EV_TLBMissD)

	TLBMISS_FREEUP_REGS

#ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT
	ld  r0, [@numdtlb]
	add r0, r0, 1
	st  r0, [@numdtlb]
#endif

	;----------------------------------------------------------------
	; Get the PTE corresponding to V-addr accessed
	; If PTE exists, it will setup, r0 = PTE, r1 = Ptr to PTE, r2 = EFA