MIPS: perf: Add hardware perf events support for new Loongson-3
Subsystems (3)
PATCH v2 1/1 MIPS: perf: Add hardware perf events support for new Loongson-3
New Loongson-3 means Loongson-3A R2 (Loongson-3A2000) and newer CPUs. Loongson-3 processors have three types of PMU types (so there are three event maps): Loongson-3A1000/Loonngson-3B1000/Loongson-3B1500 is Type-1, Loongson-3A2000/Loongson-3A3000 is Type-2, Loongson-3A4000+ is Type-3.
--- .../asm/mach-loongson64/cpu-feature-overrides.h | 1 + arch/mips/kernel/perf_event_mipsxx.c | 358 +++++++++++++++++++-- 2 files changed, 330 insertions(+), 29 deletions(-)
arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h +1 -0
@@ -48,5 +48,6 @@#define cpu_hwrena_impl_bits 0xc0000000#define cpu_has_mac2008_only 1#define cpu_has_mips_r2_exec_hazard 0 +#define cpu_has_perf_cntr_intr_bit 0#endif /* __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H */
arch/mips/kernel/perf_event_mipsxx.c +329 -29
503 lines not on this page · raw message
Signature · 1 line
2.7.0
Thomas Bogendoerfer
maintainerQuoted 9 lines · Huacai Chen
New Loongson-3 means Loongson-3A R2 (Loongson-3A2000) and newer CPUs. Loongson-3 processors have three types of PMU types (so there are three event maps): Loongson-3A1000/Loonngson-3B1000/Loongson-3B1500 is Type-1, Loongson-3A2000/Loongson-3A3000 is Type-2, Loongson-3A4000+ is Type-3.
Signed-off-by Huacai Chen <[email protected]>--- .../asm/mach-loongson64/cpu-feature-overrides.h | 1 + arch/mips/kernel/perf_event_mipsxx.c | 358 +++++++++++++++++++--
checkpatch warns about missing break/fallthrough statement and indention problems, could please look at this ? And as all the new code is only usefull for loongsoon CPUs could you try to only compile it in, if it's enabled for the image ?
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]
Hi, Thomas,
Quoted 12 lines · Thomas Bogendoerfer
Quoted 9 lines · Huacai Chen
New Loongson-3 means Loongson-3A R2 (Loongson-3A2000) and newer CPUs. Loongson-3 processors have three types of PMU types (so there are three event maps): Loongson-3A1000/Loonngson-3B1000/Loongson-3B1500 is Type-1, Loongson-3A2000/Loongson-3A3000 is Type-2, Loongson-3A4000+ is Type-3.
Signed-off-by Huacai Chen <[email protected]>--- .../asm/mach-loongson64/cpu-feature-overrides.h | 1 + arch/mips/kernel/perf_event_mipsxx.c | 358 +++++++++++++++++++--
Quoted 4 lines
checkpatch warns about missing break/fallthrough statement and indention problems, could please look at this ? And as all the new code is only usefull for loongsoon CPUs could you try to only compile it in, if it's enabled for the image ?
OK, I will solve the "fallthrough" warnings and indention warnings. But the other problem is I should use #ifdef CONFIG_CPU_LOONGSON64 to guard all new code in this file? I remember that Paul Burton suggest us to avoid use #ifdef and use runtime detection instead.
Quoted 6 lines
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
Regards,
Huacai
Thomas Bogendoerfer
maintainerQuoted 16 lines · Huacai Chen
Hi, Thomas,
Quoted 12 lines · Thomas Bogendoerfer
Quoted 9 lines · Huacai Chen
New Loongson-3 means Loongson-3A R2 (Loongson-3A2000) and newer CPUs. Loongson-3 processors have three types of PMU types (so there are three event maps): Loongson-3A1000/Loonngson-3B1000/Loongson-3B1500 is Type-1, Loongson-3A2000/Loongson-3A3000 is Type-2, Loongson-3A4000+ is Type-3.
Signed-off-by Huacai Chen <[email protected]>--- .../asm/mach-loongson64/cpu-feature-overrides.h | 1 + arch/mips/kernel/perf_event_mipsxx.c | 358 +++++++++++++++++++--
Quoted 8 lines
Quoted 4 lines
checkpatch warns about missing break/fallthrough statement and indention problems, could please look at this ? And as all the new code is only usefull for loongsoon CPUs could you try to only compile it in, if it's enabled for the image ?
OK, I will solve the "fallthrough" warnings and indention warnings. But the other problem is I should use #ifdef
CONFIG_CPU_LOONGSON64to guard all new code in this file? I remember that Paul Burton suggest us to avoid use #ifdef and use runtime detection instead.
if you do the cpu checks for current_cpu_type() == CPU_LOONGSON64 the compiler will eliminate not needed cpu code. Looks like most of the new code is done inside case CPU_LOONGSON64 blocks, so that is fine. Could you check how much size increase you get for a non loongson64 target with your patch ?
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]
Hi, Thomas,
Quoted 27 lines · Thomas Bogendoerfer
Quoted 16 lines · Huacai Chen
Hi, Thomas,
Quoted 12 lines · Thomas Bogendoerfer
Quoted 9 lines · Huacai Chen
New Loongson-3 means Loongson-3A R2 (Loongson-3A2000) and newer CPUs. Loongson-3 processors have three types of PMU types (so there are three event maps): Loongson-3A1000/Loonngson-3B1000/Loongson-3B1500 is Type-1, Loongson-3A2000/Loongson-3A3000 is Type-2, Loongson-3A4000+ is Type-3.
Signed-off-by Huacai Chen <[email protected]>--- .../asm/mach-loongson64/cpu-feature-overrides.h | 1 + arch/mips/kernel/perf_event_mipsxx.c | 358 +++++++++++++++++++--Quoted 8 lines
Quoted 4 lines
checkpatch warns about missing break/fallthrough statement and indention problems, could please look at this ? And as all the new code is only usefull for loongsoon CPUs could you try to only compile it in, if it's enabled for the image ?
OK, I will solve the "fallthrough" warnings and indention warnings. But the other problem is I should use #ifdef
CONFIG_CPU_LOONGSON64to guard all new code in this file? I remember that Paul Burton suggest us to avoid use #ifdef and use runtime detection instead.
Quoted 5 lines
if you do the cpu checks for
current_cpu_type()==CPU_LOONGSON64the compiler will eliminate not needed cpu code. Looks like most of the new code is done inside caseCPU_LOONGSON64blocks, so that is fine. Could you check how much size increase you get for a non loongson64 target with your patch ?
I have build an IP28 kernel (ip28_defconfig+perf):
size of vmlinux with this perf patch: 10913440
size of vmlinux without this perf patch:10913296
readelf -a vmlinux with this perf patch:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000001000 0xa800000020004000 0xa800000020004000
0x0000000000800c0c 0x0000000000830dc0 RWE 0x1000
NOTE 0x000000000070d020 0xa800000020710020 0xa800000020710020
0x000000000000003c 0x000000000000003c R 0x4readelf -a vmlinux without this perf patch:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000001000 0xa800000020004000 0xa800000020004000
0x0000000000800c0c 0x0000000000830dc0 RWE 0x1000
NOTE 0x000000000070cff0 0xa80000002070fff0 0xa80000002070fff0
0x000000000000003c 0x000000000000003c R 0x4Quoted 7 lines
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
Thomas Bogendoerfer
maintainerQuoted 17 lines · Huacai Chen
Quoted 2 lines · Thomas Bogendoerfer
that is fine. Could you check how much size increase you get for a non loongson64 target with your patch ?
I have build an IP28 kernel (ip28_defconfig+perf):
size of vmlinux with this perf patch: 10913440
size of vmlinux without this perf patch:10913296readelf -a vmlinux with this perf patch:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD0x00000000000010000xa8000000200040000xa8000000200040000x0000000000800c0c 0x0000000000830dc0 RWE 0x1000 NOTE 0x000000000070d020 0xa800000020710020 0xa800000020710020 0x000000000000003c 0x000000000000003c R 0x4
Quoted 7 lines
readelf -a vmlinux without this perf patch:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD0x00000000000010000xa8000000200040000xa8000000200040000x0000000000800c0c 0x0000000000830dc0 RWE 0x1000 NOTE 0x000000000070cff0 0xa80000002070fff0 0xa80000002070fff0 0x000000000000003c 0x000000000000003c R 0x4
this looks the same, are you sure you used the right images ?
Nevertheless it's not much. I've applied your new patch. Thank you for checking.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]