Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Romain Naour <romain.naour@openwide.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1] stress-ng: Depend on kernel headers >= 3.3
Date: Sat, 12 Sep 2015 12:26:33 +0200	[thread overview]
Message-ID: <55F3FDD9.1030709@openwide.fr> (raw)
In-Reply-To: <20150911195928.51c339dc@free-electrons.com>

Hi Thomas,

Le 11/09/2015 19:59, Thomas Petazzoni a ?crit :
> Julien,
> 
> On Fri, 11 Sep 2015 18:19:11 +0200, Julien Corjon wrote:
>> perf.c need PERF_COUNT_HW_REF_CPU_CYCLES instruction which is available
>> only since 3.3 kernel version
>>
>> Signed-off-by: Julien Corjon <corjon.j@ecagroup.com>
>> ---
>>  package/stress-ng/Config.in | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/package/stress-ng/Config.in b/package/stress-ng/Config.in
>> index cdf9984..1e475b1 100644
>> --- a/package/stress-ng/Config.in
>> +++ b/package/stress-ng/Config.in
>> @@ -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?

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
Acked-by: Romain Naour <romain.naour@openwide.fr>

Best regards,
Romain

> 
> Thanks,
> 
> Thomas
> 

  reply	other threads:[~2015-09-12 10:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11 16:19 [Buildroot] [PATCH 1/1] stress-ng: Depend on kernel headers >= 3.3 Julien Corjon
2015-09-11 17:59 ` Thomas Petazzoni
2015-09-12 10:26   ` Romain Naour [this message]
2015-09-13 14:27     ` Romain Naour
2015-09-12 10:19 ` Vicente Olivert Riera
2015-09-14  7:43 ` [Buildroot] [PATCH v2] " Julien Corjon
2015-09-14  8:59   ` Vicente Olivert Riera
2015-09-14 12:36   ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55F3FDD9.1030709@openwide.fr \
    --to=romain.naour@openwide.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox