aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDeng-Cheng Zhu <dengcheng.zhu@imgtec.com>2014-05-29 15:26:45 -0400
committerRalf Baechle <ralf@linux-mips.org>2014-05-30 05:55:23 -0400
commitc410352699e2a1adc77969f19eb63030e610d048 (patch)
treea74a55f775366665562b9cddcd39d34163af3229 /arch
parent96a8123e5f965825a61a74617b8da1199646d392 (diff)
MIPS: math-emu: Add IEEE754 exception statistics to debugfs
Sometimes it's useful to let the user, while doing performance research, know what in the IEEE754 exceptions has caused many times of FP emulation when running a specific application. This patch adds 5 more files to /sys/kernel/debug/mips/fpuemustats/, whose filenames begin with "ieee754". These stats are in addition to the existing cp1ops, cp1xops, errors, loads and stores, which may not be useful in understanding the reasons of ieee754 exceptions. [ralf@linux-mips.org: Fixed reject due to other changes to the kernel FP assist software.] Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com> Cc: linux-mips@linux-mips.org Cc: Steven.Hill@imgtec.com Cc: james.hogan@imgtec.com Patchwork: http://patchwork.linux-mips.org/patch/7044/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/include/asm/fpu_emulator.h5
-rw-r--r--arch/mips/math-emu/cp1emu.c36
-rw-r--r--arch/mips/math-emu/me-debugfs.c5
3 files changed, 37 insertions, 9 deletions
diff --git a/arch/mips/include/asm/fpu_emulator.h b/arch/mips/include/asm/fpu_emulator.h
index f761719eab65..0195745b4b1b 100644
--- a/arch/mips/include/asm/fpu_emulator.h
+++ b/arch/mips/include/asm/fpu_emulator.h
@@ -39,6 +39,11 @@ struct mips_fpu_emulator_stats {
39 local_t cp1ops; 39 local_t cp1ops;
40 local_t cp1xops; 40 local_t cp1xops;
41 local_t errors; 41 local_t errors;
42 local_t ieee754_inexact;
43 local_t ieee754_underflow;
44 local_t ieee754_overflow;
45 local_t ieee754_zerodiv;
46 local_t ieee754_invalidop;
42}; 47};
43 48
44DECLARE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats); 49DECLARE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats);
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index 08e6a74fbc95..cdfed285c244 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -1234,14 +1234,22 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
1234 SPTOREG(fd, MIPSInst_FD(ir)); 1234 SPTOREG(fd, MIPSInst_FD(ir));
1235 1235
1236 copcsr: 1236 copcsr:
1237 if (ieee754_cxtest(IEEE754_INEXACT)) 1237 if (ieee754_cxtest(IEEE754_INEXACT)) {
1238 MIPS_FPU_EMU_INC_STATS(ieee754_inexact);
1238 rcsr |= FPU_CSR_INE_X | FPU_CSR_INE_S; 1239 rcsr |= FPU_CSR_INE_X | FPU_CSR_INE_S;
1239 if (ieee754_cxtest(IEEE754_UNDERFLOW)) 1240 }
1241 if (ieee754_cxtest(IEEE754_UNDERFLOW)) {
1242 MIPS_FPU_EMU_INC_STATS(ieee754_underflow);
1240 rcsr |= FPU_CSR_UDF_X | FPU_CSR_UDF_S; 1243 rcsr |= FPU_CSR_UDF_X | FPU_CSR_UDF_S;
1241 if (ieee754_cxtest(IEEE754_OVERFLOW)) 1244 }
1245 if (ieee754_cxtest(IEEE754_OVERFLOW)) {
1246 MIPS_FPU_EMU_INC_STATS(ieee754_overflow);
1242 rcsr |= FPU_CSR_OVF_X | FPU_CSR_OVF_S; 1247 rcsr |= FPU_CSR_OVF_X | FPU_CSR_OVF_S;
1243 if (ieee754_cxtest(IEEE754_INVALID_OPERATION)) 1248 }
1249 if (ieee754_cxtest(IEEE754_INVALID_OPERATION)) {
1250 MIPS_FPU_EMU_INC_STATS(ieee754_invalidop);
1244 rcsr |= FPU_CSR_INV_X | FPU_CSR_INV_S; 1251 rcsr |= FPU_CSR_INV_X | FPU_CSR_INV_S;
1252 }
1245 1253
1246 ctx->fcr31 = (ctx->fcr31 & ~FPU_CSR_ALL_X) | rcsr; 1254 ctx->fcr31 = (ctx->fcr31 & ~FPU_CSR_ALL_X) | rcsr;
1247 if ((ctx->fcr31 >> 5) & ctx->fcr31 & FPU_CSR_ALL_E) { 1255 if ((ctx->fcr31 >> 5) & ctx->fcr31 & FPU_CSR_ALL_E) {
@@ -1468,16 +1476,26 @@ scopuop:
1468 rv.s = (*handler.u) (fs); 1476 rv.s = (*handler.u) (fs);
1469 goto copcsr; 1477 goto copcsr;
1470copcsr: 1478copcsr:
1471 if (ieee754_cxtest(IEEE754_INEXACT)) 1479 if (ieee754_cxtest(IEEE754_INEXACT)) {
1480 MIPS_FPU_EMU_INC_STATS(ieee754_inexact);
1472 rcsr |= FPU_CSR_INE_X | FPU_CSR_INE_S; 1481 rcsr |= FPU_CSR_INE_X | FPU_CSR_INE_S;
1473 if (ieee754_cxtest(IEEE754_UNDERFLOW)) 1482 }
1483 if (ieee754_cxtest(IEEE754_UNDERFLOW)) {
1484 MIPS_FPU_EMU_INC_STATS(ieee754_underflow);
1474 rcsr |= FPU_CSR_UDF_X | FPU_CSR_UDF_S; 1485 rcsr |= FPU_CSR_UDF_X | FPU_CSR_UDF_S;
1475 if (ieee754_cxtest(IEEE754_OVERFLOW)) 1486 }
1487 if (ieee754_cxtest(IEEE754_OVERFLOW)) {
1488 MIPS_FPU_EMU_INC_STATS(ieee754_overflow);
1476 rcsr |= FPU_CSR_OVF_X | FPU_CSR_OVF_S; 1489 rcsr |= FPU_CSR_OVF_X | FPU_CSR_OVF_S;
1477 if (ieee754_cxtest(IEEE754_ZERO_DIVIDE)) 1490 }
1491 if (ieee754_cxtest(IEEE754_ZERO_DIVIDE)) {
1492 MIPS_FPU_EMU_INC_STATS(ieee754_zerodiv);
1478 rcsr |= FPU_CSR_DIV_X | FPU_CSR_DIV_S; 1493 rcsr |= FPU_CSR_DIV_X | FPU_CSR_DIV_S;
1479 if (ieee754_cxtest(IEEE754_INVALID_OPERATION)) 1494 }
1495 if (ieee754_cxtest(IEEE754_INVALID_OPERATION)) {
1496 MIPS_FPU_EMU_INC_STATS(ieee754_invalidop);
1480 rcsr |= FPU_CSR_INV_X | FPU_CSR_INV_S; 1497 rcsr |= FPU_CSR_INV_X | FPU_CSR_INV_S;
1498 }
1481 break; 1499 break;
1482 1500
1483 /* unary conv ops */ 1501 /* unary conv ops */
diff --git a/arch/mips/math-emu/me-debugfs.c b/arch/mips/math-emu/me-debugfs.c
index 95ed9f9bd2b0..becdd63e14a9 100644
--- a/arch/mips/math-emu/me-debugfs.c
+++ b/arch/mips/math-emu/me-debugfs.c
@@ -56,6 +56,11 @@ do { \
56 FPU_STAT_CREATE(cp1ops); 56 FPU_STAT_CREATE(cp1ops);
57 FPU_STAT_CREATE(cp1xops); 57 FPU_STAT_CREATE(cp1xops);
58 FPU_STAT_CREATE(errors); 58 FPU_STAT_CREATE(errors);
59 FPU_STAT_CREATE(ieee754_inexact);
60 FPU_STAT_CREATE(ieee754_underflow);
61 FPU_STAT_CREATE(ieee754_overflow);
62 FPU_STAT_CREATE(ieee754_zerodiv);
63 FPU_STAT_CREATE(ieee754_invalidop);
59 64
60 return 0; 65 return 0;
61} 66}