Skip to content

Commit 8769177

Browse files
committed
ARM: vfp: Record VFP bounces as perf emulation faults
VFP 'bouncing' occurs when the VFP unit cannot complete the execution of a VFP instruction, either because it is not implemented at all, or because the values of the arguments are out of range for the hardware implementation, and the software needs to step in to complete the operation. To give some insight in how much certain programs rely on this bouncing, record the emulation of a VFP instruction in perf's emulation-faults counter. This can be used like so perf stat -e emulation-faults ./testfloat -all2 and the output will be something like Performance counter stats for './testfloat -all2': 259,277 emulation-faults:u 6.846432176 seconds time elapsed Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent f1fcbaa commit 8769177

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/arm/vfp/vfpmodule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/uaccess.h>
1919
#include <linux/user.h>
2020
#include <linux/export.h>
21+
#include <linux/perf_event.h>
2122

2223
#include <asm/cp15.h>
2324
#include <asm/cputype.h>
@@ -313,6 +314,7 @@ static u32 vfp_emulate_instruction(u32 inst, u32 fpscr, struct pt_regs *regs)
313314
* emulate it.
314315
*/
315316
}
317+
perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, regs->ARM_pc);
316318
return exceptions & ~VFP_NAN_FLAG;
317319
}
318320

0 commit comments

Comments
 (0)