lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 18 Aug 2017 15:17:33 +0200
From:   Aleksandar Markovic <aleksandar.markovic@...rk.com>
To:     linux-mips@...ux-mips.org
Cc:     Aleksandar Markovic <aleksandar.markovic@...tec.com>,
        Miodrag Dinic <miodrag.dinic@...tec.com>,
        Goran Ferenc <goran.ferenc@...tec.com>,
        Bo Hu <bohu@...gle.com>,
        Douglas Leung <douglas.leung@...tec.com>,
        James Hogan <james.hogan@...tec.com>,
        Jin Qian <jinqian@...gle.com>, linux-kernel@...r.kernel.org,
        "Maciej W. Rozycki" <macro@...tec.com>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Paul Burton <paul.burton@...tec.com>,
        Petar Jovanovic <petar.jovanovic@...tec.com>,
        Raghu Gandham <raghu.gandham@...tec.com>,
        Ralf Baechle <ralf@...ux-mips.org>
Subject: [PATCH 4/6] MIPS: math-emu: Add FP emu debugfs statistics for branches

From: Aleksandar Markovic <aleksandar.markovic@...tec.com>

Add FP emu debugfs counter for branches.

The new counter is displayed the same way as existing counter, and
its default path is /sys/kernel/debug/mips/fpuemustats/.

The limitation of this counter is that it counts only R6 branch
instructions BC1NEZ and BC1EQZ.

Signed-off-by: Miodrag Dinic <miodrag.dinic@...tec.com>
Signed-off-by: Goran Ferenc <goran.ferenc@...tec.com>
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@...tec.com>
---
 arch/mips/include/asm/fpu_emulator.h | 1 +
 arch/mips/math-emu/cp1emu.c          | 1 +
 arch/mips/math-emu/me-debugfs.c      | 1 +
 3 files changed, 3 insertions(+)

diff --git a/arch/mips/include/asm/fpu_emulator.h b/arch/mips/include/asm/fpu_emulator.h
index c05369e..7f5cf1f 100644
--- a/arch/mips/include/asm/fpu_emulator.h
+++ b/arch/mips/include/asm/fpu_emulator.h
@@ -36,6 +36,7 @@ struct mips_fpu_emulator_stats {
 	unsigned long emulated;
 	unsigned long loads;
 	unsigned long stores;
+	unsigned long branches;
 	unsigned long cp1ops;
 	unsigned long cp1xops;
 	unsigned long errors;
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index 1ad15f8..40c74e1 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -1230,6 +1230,7 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
 				break;
 			}
 branch_common:
+			MIPS_FPU_EMU_INC_STATS(branches);
 			set_delay_slot(xcp);
 			if (cond) {
 				/*
diff --git a/arch/mips/math-emu/me-debugfs.c b/arch/mips/math-emu/me-debugfs.c
index be650ed..78b26c8 100644
--- a/arch/mips/math-emu/me-debugfs.c
+++ b/arch/mips/math-emu/me-debugfs.c
@@ -53,6 +53,7 @@ do {									\
 	FPU_STAT_CREATE(emulated);
 	FPU_STAT_CREATE(loads);
 	FPU_STAT_CREATE(stores);
+	FPU_STAT_CREATE(branches);
 	FPU_STAT_CREATE(cp1ops);
 	FPU_STAT_CREATE(cp1xops);
 	FPU_STAT_CREATE(errors);
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ