stress-ng: Depend on kernel headers >= 3.3
PATCH 1/1 stress-ng: Depend on kernel headers >= 3.3
perf.c need PERF_COUNT_HW_REF_CPU_CYCLES instruction which is available only since 3.3 kernel version
--- package/stress-ng/Config.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
package/stress-ng/Config.in +4 -4
@@ -4,8 +4,8 @@ config BR2_PACKAGE_STRESS_NG # disabled on musl: stress-malloc.c needs mallopt() and M_MMAP_THRESHOLD # disabled on uClibc: stress-aio.c needs aio.h depends on BR2_TOOLCHAIN_USES_GLIBC - # perf.c needs PERF_COUNT_HW_STALLED_CYCLES_FRONTEND - depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 + # perf.c needs PERF_COUNT_HW_REF_CPU_CYCLES + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_3 depends on !BR2_microblaze # keyutils depends on !BR2_STATIC_LIBS # keyutils select BR2_PACKAGE_KEYUTILS # stress-key.c needs keyutils.h
@@ -18,8 +18,8 @@ config BR2_PACKAGE_STRESS_NG http://kernel.ubuntu.com/~cking/stress-ng/ -comment "stress-ng needs a glibc toolchain w/ dynamic library, headers >= 3.0" +comment "stress-ng needs a glibc toolchain w/ dynamic library, headers >= 3.3" depends on !BR2_microblaze depends on BR2_USE_MMU - depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 \ + depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_3 \ || !BR2_TOOLCHAIN_USES_GLIBC
Signature · 1 line
2.1.4
PATCH 1/1 stress-ng: Depend on kernel headers >= 3.3
Julien,
Quoted 13 lines · Julien Corjon
perf.cneedPERF_COUNT_HW_REF_CPU_CYCLESinstruction which is available only since 3.3 kernel versionSigned-off-by Julien Corjon <[email protected]>--- package/stress-ng/Config.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)package/stress-ng/Config.in +0
-0
package/stress-ng/Config.in config BR2_PACKAGE_STRESS_NG · line 8
Quoted 7 lines
package/stress-ng/Config.in +2
-2@@ -4,8 +4,8 @@ config BR2_PACKAGE_STRESS_NG # disabled on musl: stress-malloc.c needs mallopt() and M_MMAP_THRESHOLD # disabled on uClibc: stress-aio.c needs aio.h depends on BR2_TOOLCHAIN_USES_GLIBC - # perf.c needs PERF_COUNT_HW_STALLED_CYCLES_FRONTEND - depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 + # perf.c needs PERF_COUNT_HW_REF_CPU_CYCLES + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_3
This seems wrong, because stress-ng.h has the definitions for all the PERF_COUNT_* values:
#if defined(__linux__) && defined(__NR_perf_event_open)
#define STRESS_PERF_STATS (1)
#define STRESS_PERF_INVALID (~0ULL)
enum {
STRESS_PERF_HW_CPU_CYCLES = 0, STRESS_PERF_HW_INSTRUCTIONS, STRESS_PERF_HW_CACHE_REFERENCES, STRESS_PERF_HW_CACHE_MISSES, STRESS_PERF_HW_BRANCH_INSTRUCTIONS, STRESS_PERF_HW_BRANCH_MISSES, STRESS_PERF_HW_BUS_CYCLES, STRESS_PERF_HW_REF_CPU_CYCLES, STRESS_PERF_HW_STALLED_CYCLES_FRONTEND, STRESS_PERF_HW_STALLED_CYCLES_BACKEND,
STRESS_PERF_SW_PAGE_FAULTS_MIN,
STRESS_PERF_SW_PAGE_FAULTS_MAJ,
STRESS_PERF_SW_CONTEXT_SWITCHES,
STRESS_PERF_SW_CPU_MIGRATIONS,
STRESS_PERF_SW_ALIGNMENT_FAULTS,
Can you figure out why it doesn't get used?
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 1/1 stress-ng: Depend on kernel headers >= 3.3
Hi Thomas,
Le 11/09/2015 19:59, Thomas Petazzoni a ?crit :
Quoted 42 lines
Julien,
Quoted 13 lines · Julien Corjon
perf.cneedPERF_COUNT_HW_REF_CPU_CYCLESinstruction which is available only since 3.3 kernel versionSigned-off-by Julien Corjon <[email protected]>--- package/stress-ng/Config.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)package/stress-ng/Config.in +0
-0package/stress-ng/Config.in config BR2_PACKAGE_STRESS_NG · line 8
Quoted 7 lines
package/stress-ng/Config.in +2
-2@@ -4,8 +4,8 @@ config BR2_PACKAGE_STRESS_NG # disabled on musl: stress-malloc.c needs mallopt() and M_MMAP_THRESHOLD # disabled on uClibc: stress-aio.c needs aio.h depends on BR2_TOOLCHAIN_USES_GLIBC - # perf.c needs PERF_COUNT_HW_STALLED_CYCLES_FRONTEND - depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 + # perf.c needs PERF_COUNT_HW_REF_CPU_CYCLES + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_3This seems wrong, because
stress-ng.hhas the definitions for all the PERF_COUNT_* values:#if
defined(__linux__)&&defined(__NR_perf_event_open)
#defineSTRESS_PERF_STATS(1)
#defineSTRESS_PERF_INVALID(~0ULL)
enum {
STRESS_PERF_HW_CPU_CYCLES= 0,STRESS_PERF_HW_INSTRUCTIONS,STRESS_PERF_HW_CACHE_REFERENCES,STRESS_PERF_HW_CACHE_MISSES,STRESS_PERF_HW_BRANCH_INSTRUCTIONS,STRESS_PERF_HW_BRANCH_MISSES,STRESS_PERF_HW_BUS_CYCLES,STRESS_PERF_HW_REF_CPU_CYCLES,STRESS_PERF_HW_STALLED_CYCLES_FRONTEND,STRESS_PERF_HW_STALLED_CYCLES_BACKEND,
Quoted 7 lines
STRESS_PERF_SW_PAGE_FAULTS_MIN,
STRESS_PERF_SW_PAGE_FAULTS_MAJ,
STRESS_PERF_SW_CONTEXT_SWITCHES,
STRESS_PERF_SW_CPU_MIGRATIONS,
STRESS_PERF_SW_ALIGNMENT_FAULTS,Can you figure out why it doesn't get used?
Here is the complete build failure with a toolchain using 3.2 kernel headers:
[...]i586-buildroot-linux-gnu-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wall -Wextra -DVERSION="0.04.16" -O2 -c -o perf.o perf.c perf.c:77:48: erreur: ?PERF_COUNT_HW_REF_CPU_CYCLES? undeclared here (not in a function)
{ STRESS_PERF_ ## config, PERF_TYPE_ ## type, PERF_COUNT_ ## config, label } ^
perf.c:110:2: note: in expansion of macro ?PERF_INFO? PERF_INFO(HARDWARE, HW_REF_CPU_CYCLES, "Total Cycles"),
^
Makefile:164: recipe for target 'perf.o' failed
This error is due to PERF_INFO macro from perf.c using PERF_COUNT_* values directly.
During my testing, I used an very old toolchain with 2.6 headers so I had an error with PERF_COUNT_HW_STALLED_CYCLES_FRONTEND and I missed PERF_COUNT_HW_REF_CPU_CYCLES.
I'm agree with the patch proposed by Julien, so
Best regards,
Romain
Quoted 5 lines
Thanks,
Thomas
PATCH 1/1 stress-ng: Depend on kernel headers >= 3.3
Hi Julien, All
Le 12/09/2015 12:26, Romain Naour a ?crit :
Quoted 65 lines
Hi Thomas,
Le 11/09/2015 19:59, Thomas Petazzoni a ?crit :
Quoted 42 lines
Julien,
Quoted 13 lines · Julien Corjon
perf.cneedPERF_COUNT_HW_REF_CPU_CYCLESinstruction which is available only since 3.3 kernel versionSigned-off-by Julien Corjon <[email protected]>--- package/stress-ng/Config.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)package/stress-ng/Config.in +0
-0package/stress-ng/Config.in config BR2_PACKAGE_STRESS_NG · line 8
Quoted 7 lines
package/stress-ng/Config.in +2
-2@@ -4,8 +4,8 @@ config BR2_PACKAGE_STRESS_NG # disabled on musl: stress-malloc.c needs mallopt() and M_MMAP_THRESHOLD # disabled on uClibc: stress-aio.c needs aio.h depends on BR2_TOOLCHAIN_USES_GLIBC - # perf.c needs PERF_COUNT_HW_STALLED_CYCLES_FRONTEND - depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 + # perf.c needs PERF_COUNT_HW_REF_CPU_CYCLES + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_3This seems wrong, because
stress-ng.hhas the definitions for all the PERF_COUNT_* values:#if
defined(__linux__)&&defined(__NR_perf_event_open)
#defineSTRESS_PERF_STATS(1)
#defineSTRESS_PERF_INVALID(~0ULL)
enum {
STRESS_PERF_HW_CPU_CYCLES= 0,STRESS_PERF_HW_INSTRUCTIONS,STRESS_PERF_HW_CACHE_REFERENCES,STRESS_PERF_HW_CACHE_MISSES,STRESS_PERF_HW_BRANCH_INSTRUCTIONS,STRESS_PERF_HW_BRANCH_MISSES,STRESS_PERF_HW_BUS_CYCLES,STRESS_PERF_HW_REF_CPU_CYCLES,STRESS_PERF_HW_STALLED_CYCLES_FRONTEND,STRESS_PERF_HW_STALLED_CYCLES_BACKEND,Quoted 7 lines
STRESS_PERF_SW_PAGE_FAULTS_MIN,
STRESS_PERF_SW_PAGE_FAULTS_MAJ,
STRESS_PERF_SW_CONTEXT_SWITCHES,
STRESS_PERF_SW_CPU_MIGRATIONS,
STRESS_PERF_SW_ALIGNMENT_FAULTS,Can you figure out why it doesn't get used?
Here is the complete build failure with a toolchain using 3.2 kernel headers:
[...]i586-buildroot-linux-gnu-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wall -Wextra -DVERSION="0.04.16" -O2 -c -o perf.operf.cperf.c:77:48: erreur: ?PERF_COUNT_HW_REF_CPU_CYCLES? undeclared here (not in a function)
{STRESS_PERF_## config,PERF_TYPE_## type,PERF_COUNT_## config, label } ^
perf.c:110:2: note: in expansion of macro ?PERF_INFO?PERF_INFO(HARDWARE, HW_REF_CPU_CYCLES, "Total Cycles"),
^
Makefile:164: recipe for target 'perf.o' failed
Quoted 8 lines
This error is due to
PERF_INFOmacro fromperf.cusing PERF_COUNT_* values directly.During my testing, I used an very old toolchain with 2.6 headers so I had an error with
PERF_COUNT_HW_STALLED_CYCLES_FRONTENDand I missedPERF_COUNT_HW_REF_CPU_CYCLES.I'm agree with the patch proposed by Julien, so
Acked-by Romain Naour <[email protected]>
Julien, if you respin the patch, can you add this autobuilder reference ?
http://autobuild.buildroot.net/results/889/88909b118dc927f31ed5c3b5f3513734a88085a9/build-end.log
Thanks!
Best regards,
Romain
PATCH 1/1 stress-ng: Depend on kernel headers >= 3.3
In reply to Julien CorjonDear Julien Corjon,
Quoted 4 lines · Julien Corjon
perf.cneedPERF_COUNT_HW_REF_CPU_CYCLESinstruction which is available only since 3.3 kernel versionSigned-off-by Julien Corjon <[email protected]>
How I tested it:
Not found.
Found. Indeed, PERF_COUNT_HW_REF_CPU_CYCLES is available from v3.3, although is not an instruction (as you say in the subject) but a generic PMU event, as stated in the commit log:
Perhaps you could change your commit log to make it more accurate.
Trying to build stress-ng with a toolchain with 3.2 headers:
$ grep 'BR2_TOOLCHAIN_HEADERS_AT_LEAST=' .config BR2_TOOLCHAIN_HEADERS_AT_LEAST="3.2"
This is the error message:
/br/output/host/usr/bin/mips-buildroot-linux-gnu-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wall -Wextra -DVERSION="0.04.16" -O2 -c -o perf.o perf.c
perf.c:77:48: error: ?PERF_COUNT_HW_REF_CPU_CYCLES? undeclared here (not in a function)
{ STRESS_PERF_ ## config, PERF_TYPE_ ## type, PERF_COUNT_ ## config,
label }
^
perf.c:110:2: note: in expansion of macro ?PERF_INFO?
PERF_INFO(HARDWARE, HW_REF_CPU_CYCLES, "Total Cycles"), ^
make[1]: *** [perf.o] Error 1
Trying to build stress-ng with a toolchain with headers > 3.2:
$ grep 'BR2_TOOLCHAIN_HEADERS_AT_LEAST=' .config BR2_TOOLCHAIN_HEADERS_AT_LEAST="3.19"
$ file output/target/usr/bin/stress-ng output/target/usr/bin/stress-ng: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, with unknown capability 0x41000000 = 0xf676e75, with unknown capability 0x10000 = 0x70403, stripped
Built successfully for MIPS architecture.
Regards,
Vincent.
Quoted 31 lines
--- package/stress-ng/Config.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)package/stress-ng/Config.in +4
-4@@ -4,8 +4,8 @@ config BR2_PACKAGE_STRESS_NG # disabled on musl: stress-malloc.c needs mallopt() and M_MMAP_THRESHOLD # disabled on uClibc: stress-aio.c needs aio.h depends on BR2_TOOLCHAIN_USES_GLIBC - # perf.c needs PERF_COUNT_HW_STALLED_CYCLES_FRONTEND - depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 + # perf.c needs PERF_COUNT_HW_REF_CPU_CYCLES + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_3 depends on !BR2_microblaze # keyutils depends on !BR2_STATIC_LIBS # keyutils select BR2_PACKAGE_KEYUTILS # stress-key.c needs keyutils.h@@ -18,8 +18,8 @@ config BR2_PACKAGE_STRESS_NG http://kernel.ubuntu.com/~cking/stress-ng/ -comment "stress-ng needs a glibc toolchain w/ dynamic library, headers >= 3.0" +comment "stress-ng needs a glibc toolchain w/ dynamic library, headers >= 3.3" depends on !BR2_microblaze depends on BR2_USE_MMU - depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 \ + depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_3 \ || !BR2_TOOLCHAIN_USES_GLIBC
PATCH v2 1/1 stress-ng: Depend on kernel headers >= 3.3
In reply to Julien Corjonperf.c need PERF_COUNT_HW_REF_CPU_CYCLES generic PMU event which is available only since 3.3 kernel version
Fixes:
http://autobuild.buildroot.net/results/88909b118dc927f31ed5c3b5f3513734a88085a9
http://autobuild.buildroot.net/results/dac6a85fdd721b959175caf5629b91dee717c3c6
http://autobuild.buildroot.net/results/88909b118dc927f31ed5c3b5f3513734a88085a9
---
v1 -> v2 :
- Fixe commit log (suggested by Vincente Olivert Riera)
- Add autobuild references (suggested by Romain Naour)
package/stress-ng/Config.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
package/stress-ng/Config.in +4 -4
@@ -4,8 +4,8 @@ config BR2_PACKAGE_STRESS_NG # disabled on musl: stress-malloc.c needs mallopt() and M_MMAP_THRESHOLD # disabled on uClibc: stress-aio.c needs aio.h depends on BR2_TOOLCHAIN_USES_GLIBC - # perf.c needs PERF_COUNT_HW_STALLED_CYCLES_FRONTEND - depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 + # perf.c needs PERF_COUNT_HW_REF_CPU_CYCLES + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_3 depends on !BR2_microblaze # keyutils depends on !BR2_STATIC_LIBS # keyutils select BR2_PACKAGE_KEYUTILS # stress-key.c needs keyutils.h
@@ -18,8 +18,8 @@ config BR2_PACKAGE_STRESS_NG http://kernel.ubuntu.com/~cking/stress-ng/ -comment "stress-ng needs a glibc toolchain w/ dynamic library, headers >= 3.0" +comment "stress-ng needs a glibc toolchain w/ dynamic library, headers >= 3.3" depends on !BR2_microblaze depends on BR2_USE_MMU - depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 \ + depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_3 \ || !BR2_TOOLCHAIN_USES_GLIBC
Signature · 1 line
2.1.4
PATCH v2 1/1 stress-ng: Depend on kernel headers >= 3.3
Dear Julien Corjon,
Quoted 9 lines · Julien Corjon
perf.cneedPERF_COUNT_HW_REF_CPU_CYCLESgeneric PMU event which is available only since 3.3 kernel versionFixes:
http://autobuild.buildroot.net/results/88909b118dc927f31ed5c3b5f3513734a88085a9
http://autobuild.buildroot.net/results/dac6a85fdd721b959175caf5629b91dee717c3c6
http://autobuild.buildroot.net/results/88909b118dc927f31ed5c3b5f3513734a88085a9Signed-off-by Julien Corjon <[email protected]>
Could you please mark as superseded your previous patch?
http://patchwork.ozlabs.org/patch/516900/
Regards,
Vincent.
Quoted 34 lines
---
v1 -> v2 :
- Fixe commit log (suggested by Vincente Olivert Riera)
- Add autobuild references (suggested by Romain Naour)package/stress-ng/Config.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)package/stress-ng/Config.in +4
-4@@ -4,8 +4,8 @@ config BR2_PACKAGE_STRESS_NG # disabled on musl: stress-malloc.c needs mallopt() and M_MMAP_THRESHOLD # disabled on uClibc: stress-aio.c needs aio.h depends on BR2_TOOLCHAIN_USES_GLIBC - # perf.c needs PERF_COUNT_HW_STALLED_CYCLES_FRONTEND - depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 + # perf.c needs PERF_COUNT_HW_REF_CPU_CYCLES + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_3 depends on !BR2_microblaze # keyutils depends on !BR2_STATIC_LIBS # keyutils select BR2_PACKAGE_KEYUTILS # stress-key.c needs keyutils.h@@ -18,8 +18,8 @@ config BR2_PACKAGE_STRESS_NG http://kernel.ubuntu.com/~cking/stress-ng/ -comment "stress-ng needs a glibc toolchain w/ dynamic library, headers >= 3.0" +comment "stress-ng needs a glibc toolchain w/ dynamic library, headers >= 3.3" depends on !BR2_microblaze depends on BR2_USE_MMU - depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 \ + depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_3 \ || !BR2_TOOLCHAIN_USES_GLIBC
PATCH v2 1/1 stress-ng: Depend on kernel headers >= 3.3
In reply to Julien CorjonQuoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Julien" == Julien Corjon <[email protected]> writes:
perf.cneedPERF_COUNT_HW_REF_CPU_CYCLESgeneric PMU event which is available only since 3.3 kernel versionFixes:
http://autobuild.buildroot.net/results/88909b118dc927f31ed5c3b5f3513734a88085a9
http://autobuild.buildroot.net/results/dac6a85fdd721b959175caf5629b91dee717c3c6
http://autobuild.buildroot.net/results/88909b118dc927f31ed5c3b5f3513734a88085a9
Quoted 5 lines
Signed-off-by Julien Corjon <[email protected]>---
v1 -> v2 :
- Fixe commit log (suggested by Vincente Olivert Riera)
- Add autobuild references (suggested by Romain Naour)
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard