Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1716408
| From | Aleksandar Markovic <aleksandar.markovic@rt-rk.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 5/6] MIPS: math-emu: Add FP emu debugfs clear functionality |
| Date | 2017-08-21 14:40 +0200 |
| Message-ID | <ugU9Q-4ml-33@gated-at.bofh.it> (permalink) |
| References | <ugU0a-4jm-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
Add capability for the user to clear all FP emu debugfs counters.
This is achieved by having a special debugfs file "fpuemustats_clear"
(under default location "/sys/kernel/debug/mips"). Each access to the
file results in setting all counters to zero (it is enough, let's say,
to issue a "cat /sys/kernel/debug/mips/fpuemustats_clear").
This functionality already exists for R2 emulation statistics,
but was missing for FP emulation statistics. The implementation in
this patch is consistent with its R2 emulation counterpart.
Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com>
Signed-off-by: Goran Ferenc <goran.ferenc@imgtec.com>
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
arch/mips/math-emu/me-debugfs.c | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/arch/mips/math-emu/me-debugfs.c b/arch/mips/math-emu/me-debugfs.c
index 78b26c8..f080493 100644
--- a/arch/mips/math-emu/me-debugfs.c
+++ b/arch/mips/math-emu/me-debugfs.c
@@ -28,15 +28,51 @@ static int fpuemu_stat_get(void *data, u64 *val)
}
DEFINE_SIMPLE_ATTRIBUTE(fops_fpuemu_stat, fpuemu_stat_get, NULL, "%llu\n");
+static int fpuemustats_clear_show(struct seq_file *s, void *unused)
+{
+ __this_cpu_write((fpuemustats).emulated, 0);
+ __this_cpu_write((fpuemustats).loads, 0);
+ __this_cpu_write((fpuemustats).stores, 0);
+ __this_cpu_write((fpuemustats).branches, 0);
+ __this_cpu_write((fpuemustats).cp1ops, 0);
+ __this_cpu_write((fpuemustats).cp1xops, 0);
+ __this_cpu_write((fpuemustats).errors, 0);
+ __this_cpu_write((fpuemustats).ieee754_inexact, 0);
+ __this_cpu_write((fpuemustats).ieee754_underflow, 0);
+ __this_cpu_write((fpuemustats).ieee754_overflow, 0);
+ __this_cpu_write((fpuemustats).ieee754_zerodiv, 0);
+ __this_cpu_write((fpuemustats).ieee754_invalidop, 0);
+ __this_cpu_write((fpuemustats).ds_emul, 0);
+
+ return 0;
+}
+
+static int fpuemustats_clear_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, fpuemustats_clear_show, inode->i_private);
+}
+
+static const struct file_operations fpuemustats_clear_fops = {
+ .open = fpuemustats_clear_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
static int __init debugfs_fpuemu(void)
{
- struct dentry *d, *dir;
+ struct dentry *d, *dir, *reset_file;
if (!mips_debugfs_dir)
return -ENODEV;
dir = debugfs_create_dir("fpuemustats", mips_debugfs_dir);
if (!dir)
return -ENOMEM;
+ reset_file = debugfs_create_file("fpuemustats_clear", 0444,
+ mips_debugfs_dir, NULL,
+ &fpuemustats_clear_fops);
+ if (!reset_file)
+ return -ENOMEM;
#define FPU_EMU_STAT_OFFSET(m) \
offsetof(struct mips_fpu_emulator_stats, m)
--
2.9.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/6] MIPS: math-emu: FP emulation fixes and improvements Aleksandar Markovic <aleksandar.markovic@rt-rk.com> - 2017-08-21 14:30 +0200 [PATCH v2 2/6] MIPS: math-emu: RINT.<D|S>: Fix several problems by reimplementation Aleksandar Markovic <aleksandar.markovic@rt-rk.com> - 2017-08-21 14:30 +0200 [PATCH v2 1/6] MIPS: math-emu: CMP.Sxxx.<D|S>: Prevent occurrences of SIGILL crashes Aleksandar Markovic <aleksandar.markovic@rt-rk.com> - 2017-08-21 14:30 +0200 [PATCH v2 3/6] MIPS: math-emu: CLASS.D: Zero bits 32-63 of the result Aleksandar Markovic <aleksandar.markovic@rt-rk.com> - 2017-08-21 14:40 +0200 [PATCH v2 4/6] MIPS: math-emu: Add FP emu debugfs statistics for branches Aleksandar Markovic <aleksandar.markovic@rt-rk.com> - 2017-08-21 14:40 +0200 [PATCH v2 5/6] MIPS: math-emu: Add FP emu debugfs clear functionality Aleksandar Markovic <aleksandar.markovic@rt-rk.com> - 2017-08-21 14:40 +0200 [PATCH v2 6/6] MIPS: math-emu: Add FP emu debugfs stats for individual instructions Aleksandar Markovic <aleksandar.markovic@rt-rk.com> - 2017-08-21 14:40 +0200
csiph-web