perf: mips64: Convert __u64 to unsigned long long
PATCH 1/1 perf: mips64: Convert __u64 to unsigned long long
On MIPS64, "__u64" is "unsigned long" type, so the "%llu" specifier will cause build error on MIPS64.
Convert __u64 to unsigned long long in those sprintf calls to avoid the build error.
--- tools/perf/tests/attr.c | 20 ++++++++++---------- tools/perf/tests/bp_signal.c | 2 +- tools/perf/tests/bp_signal_overflow.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-)
tools/perf/tests/attr.c +10 -10
@@ -71,7 +71,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,char path[PATH_MAX ];snprintf (path,PATH_MAX ,"%s/event-%d-%llu-%d" , dir, - attr->type, attr->config, fd); + attr->type, (unsigned long long )attr->config, fd); file =fopen (path,"w+" );if (!file) {
@@ -80,7 +80,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, }if (fprintf (file,"[event-%d-%llu-%d]\n" , - attr->type, attr->config, fd) <0 ) { + attr->type, (unsigned long long )attr->config, fd) <0 ) {perror ("test attr - failed to write event file" );fclose (file);return -1 ;
@@ -96,10 +96,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,/* struct perf_event_attr */ WRITE_ASS (type, PRIu32);WRITE_ASS (size, PRIu32); -WRITE_ASS (config,"llu" ); -WRITE_ASS (sample_period,"llu" ); -WRITE_ASS (sample_type,"llu" ); -WRITE_ASS (read_format,"llu" ); +__WRITE_ASS (config,"llu" , (unsigned long long )attr->config); +__WRITE_ASS (sample_period,"llu" , (unsigned long long )attr->sample_period); +__WRITE_ASS (sample_type,"llu" , (unsigned long long )attr->sample_type); +__WRITE_ASS (read_format,"llu" , (unsigned long long )attr->read_format);WRITE_ASS (disabled,"d" );WRITE_ASS (inherit,"d" );WRITE_ASS (pinned,"d" );
@@ -124,10 +124,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,WRITE_ASS (exclude_callchain_user,"d" );WRITE_ASS (wakeup_events, PRIu32);WRITE_ASS (bp_type, PRIu32); -WRITE_ASS (config1,"llu" ); -WRITE_ASS (config2,"llu" ); -WRITE_ASS (branch_sample_type,"llu" ); -WRITE_ASS (sample_regs_user,"llu" ); +__WRITE_ASS (config1,"llu" , (unsigned long long )attr->config1); +__WRITE_ASS (config2,"llu" , (unsigned long long )attr->config2); +__WRITE_ASS (branch_sample_type,"llu" , (unsigned long long )attr->branch_sample_type); +__WRITE_ASS (sample_regs_user,"llu" , (unsigned long long )attr->sample_regs_user);WRITE_ASS (sample_stack_user, PRIu32);fclose (file);
tools/perf/tests/bp_signal.c +1 -1
@@ -74,7 +74,7 @@ static int bp_event(void *fn, int setup_signal) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; }
tools/perf/tests/bp_signal_overflow.c +1 -1
@@ -87,7 +87,7 @@ int test__bp_signal_overflow(void) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; }
Signature · 1 line
1.7.5.4
Wouldn't it be better to change "%llu" to PRIu64 (from inttypes.h)? Notice that PRIu32 is already used in places.
You can use string catenation where necessary, e.g.
"%s/event-%d-" PRIu64 "-%d"
Quoted 112 lines · Yang Shi
On MIPS64, "
__u64" is "unsigned long" type, so the "%llu" specifier will cause
build error on MIPS64.Convert
__u64to unsigned long long in those sprintf calls to avoid the build
error.Signed-off-by Yang Shi <[email protected]>---
tools/perf/tests/attr.c | 20 ++++++++++---------- tools/perf/tests/bp_signal.c | 2 +- tools/perf/tests/bp_signal_overflow.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-)tools/perf/tests/attr.c +1
-1@@ -71,7 +71,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, char path[PATH_MAX];snprintf (path,PATH_MAX ,"%s/event-%d-%llu-%d" , dir, - attr->type, attr->config, fd); + attr->type, (unsigned long long )attr->config, fd); file =fopen (path,"w+" );if (!file) {tools/perf/tests/attr.c +1
-1@@ -80,7 +80,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, } if (fprintf(file, "[event-%d-%llu-%d]\n", - attr->type, attr->config, fd) < 0) { + attr->type, (unsigned long long)attr->config, fd) < 0) {perror ("test attr - failed to write event file" );fclose (file);return -1;tools/perf/tests/attr.c +4
-4@@ -96,10 +96,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,/* struct perf_event_attr */ WRITE_ASS (type ,PRIu32 );WRITE_ASS (size, PRIu32); -WRITE_ASS (config,"llu" ); -WRITE_ASS (sample_period,"llu" ); -WRITE_ASS (sample_type,"llu" ); -WRITE_ASS (read_format,"llu" ); +__WRITE_ASS (config,"llu" , (unsigned long long )attr->config); +__WRITE_ASS (sample_period,"llu" , (unsigned long long )attr->sample_period); +__WRITE_ASS (sample_type,"llu" , (unsigned long long )attr->sample_type); + __WRITE_ASS(read_format, "llu", (unsigned longlong)attr->read_format); WRITE_ASS(disabled, "d"); WRITE_ASS(inherit, "d"); WRITE_ASS(pinned, "d");tools/perf/tests/attr.c +3
-4@@ -124,10 +124,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,WRITE_ASS (exclude_callchain_user,"d" );WRITE_ASS (wakeup_events, PRIu32);WRITE_ASS (bp_type, PRIu32); -WRITE_ASS (config1,"llu" ); -WRITE_ASS (config2,"llu" ); -WRITE_ASS (branch_sample_type,"llu" ); -WRITE_ASS (sample_regs_user,"llu" ); +__WRITE_ASS (config1,"llu" , (unsigned long long )attr->config1); +__WRITE_ASS (config2,"llu" , (unsigned long long )attr->config2); + __WRITE_ASS(branch_sample_type, "llu", (unsigned longlong)attr->branch_sample_type);
tools/perf/tests/attr.c +1
-0+ __WRITE_ASS(sample_regs_user, "llu", (unsigned longlong)attr->sample_regs_user); WRITE_ASS(sample_stack_user, PRIu32); fclose(file);tools/perf/tests/bp_signal.c +1
-1@@ -74,7 +74,7 @@ static int bp_event(void *fn, int setup_signal) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; }tools/perf/tests/bp_signal_overflow.c +1
-1@@ -87,7 +87,7 @@ int test__bp_signal_overflow(void) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; }Signature · 6 lines
1.7.5.4 _______________________________________________ yocto mailing list [email protected] https://lists.yoctoproject.org/listinfo/yocto
I guess for that example, you have to add % yourself
"%s/event-%d-%" PRIu64 "-%d"
but for all the WRITE_ASS examples, simply replace "llu" with PRIu64
Quoted 124 lines · Billie Alsup
Wouldn't it be better to change "%llu" to PRIu64 (from
inttypes.h)? Notice that PRIu32 is already used in places.
You can use string catenation where necessary, e.g."%s/event-%d-" PRIu64 "-%d"
Quoted 114 lines · Yang Shi
On MIPS64, "
__u64" is "unsigned long" type, so the "%llu" specifier will cause
build error on MIPS64.Convert
__u64to unsigned long long in those sprintf calls to avoid the build
error.Signed-off-by Yang Shi <[email protected]>---
tools/perf/tests/attr.c | 20 ++++++++++---------- tools/perf/tests/bp_signal.c | 2 +- tools/perf/tests/bp_signal_overflow.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-)tools/perf/tests/attr.c +1
-1@@ -71,7 +71,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, char path[PATH_MAX];snprintf (path,PATH_MAX ,"%s/event-%d-%llu-%d" , dir, - attr->type, attr->config, fd); + attr->type, (unsigned long long )attr->config, fd); file =fopen (path,"w+" );if (!file) {tools/perf/tests/attr.c +1
-1@@ -80,7 +80,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, } if (fprintf(file, "[event-%d-%llu-%d]\n", - attr->type, attr->config, fd) < 0) { + attr->type, (unsigned long long)attr->config, fd) < 0) {perror ("test attr - failed to write event file" );fclose (file);return -1;tools/perf/tests/attr.c +4
-4@@ -96,10 +96,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,/* struct perf_event_attr */ WRITE_ASS (type ,PRIu32 );WRITE_ASS (size, PRIu32); -WRITE_ASS (config,"llu" ); -WRITE_ASS (sample_period,"llu" ); -WRITE_ASS (sample_type,"llu" ); -WRITE_ASS (read_format,"llu" ); +__WRITE_ASS (config,"llu" , (unsigned long long )attr->config); +__WRITE_ASS (sample_period,"llu" , (unsigned long long )attr->sample_period); +__WRITE_ASS (sample_type,"llu" , (unsigned long long )attr->sample_type); + __WRITE_ASS(read_format, "llu", (unsigned longlong)attr->read_format); WRITE_ASS(disabled, "d"); WRITE_ASS(inherit, "d"); WRITE_ASS(pinned, "d");tools/perf/tests/attr.c +3
-4@@ -124,10 +124,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,WRITE_ASS (exclude_callchain_user,"d" );WRITE_ASS (wakeup_events, PRIu32);WRITE_ASS (bp_type, PRIu32); -WRITE_ASS (config1,"llu" ); -WRITE_ASS (config2,"llu" ); -WRITE_ASS (branch_sample_type,"llu" ); -WRITE_ASS (sample_regs_user,"llu" ); +__WRITE_ASS (config1,"llu" , (unsigned long long )attr->config1); +__WRITE_ASS (config2,"llu" , (unsigned long long )attr->config2); + __WRITE_ASS(branch_sample_type, "llu", (unsigned longlong)attr->branch_sample_type);
tools/perf/tests/attr.c +1
-0+ __WRITE_ASS(sample_regs_user, "llu", (unsigned longlong)attr->sample_regs_user); WRITE_ASS(sample_stack_user, PRIu32); fclose(file);tools/perf/tests/bp_signal.c +1
-1@@ -74,7 +74,7 @@ static int bp_event(void *fn, int setup_signal) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; }tools/perf/tests/bp_signal_overflow.c +1
-1@@ -87,7 +87,7 @@ int test__bp_signal_overflow(void) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; }Signature · 7 lines
-- 1.7.5.4 _______________________________________________ yocto mailing list [email protected] https://lists.yoctoproject.org/listinfo/yocto
Quoted 5 lines · Billie Alsup
I guess for that example, you have to add % yourself
"%s/event-%d-%" PRIu64 "-%d"
but for all the
WRITE_ASSexamples, simply replace "llu" with PRIu64
Thanks for the suggestion. I had a try, but it failed to build for x86_64.
| tests/attr.c:74:4: error: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type '__u64' [-Werror=format=]
| attr->type, attr->config, fd);
Yang
Quoted 129 lines · Billie Alsup
Quoted 124 lines
Wouldn't it be better to change "%llu" to PRIu64 (from
inttypes.h)? Notice that PRIu32 is already used in places.
You can use string catenation where necessary, e.g."%s/event-%d-" PRIu64 "-%d"
Quoted 114 lines · Yang Shi
On MIPS64, "
__u64" is "unsigned long" type, so the "%llu" specifier will cause
build error on MIPS64.Convert
__u64to unsigned long long in those sprintf calls to avoid the build
error.Signed-off-by Yang Shi <[email protected]>---
tools/perf/tests/attr.c | 20 ++++++++++---------- tools/perf/tests/bp_signal.c | 2 +- tools/perf/tests/bp_signal_overflow.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-)tools/perf/tests/attr.c +1
-1@@ -71,7 +71,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, char path[PATH_MAX];snprintf (path,PATH_MAX ,"%s/event-%d-%llu-%d" , dir, - attr->type, attr->config, fd); + attr->type, (unsigned long long )attr->config, fd); file =fopen (path,"w+" );if (!file) {tools/perf/tests/attr.c +1
-1@@ -80,7 +80,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, } if (fprintf(file, "[event-%d-%llu-%d]\n", - attr->type, attr->config, fd) < 0) { + attr->type, (unsigned long long)attr->config, fd) < 0) {perror ("test attr - failed to write event file" );fclose (file);return -1;tools/perf/tests/attr.c +4
-4@@ -96,10 +96,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,/* struct perf_event_attr */ WRITE_ASS (type ,PRIu32 );WRITE_ASS (size, PRIu32); -WRITE_ASS (config,"llu" ); -WRITE_ASS (sample_period,"llu" ); -WRITE_ASS (sample_type,"llu" ); -WRITE_ASS (read_format,"llu" ); +__WRITE_ASS (config,"llu" , (unsigned long long )attr->config); +__WRITE_ASS (sample_period,"llu" , (unsigned long long )attr->sample_period); +__WRITE_ASS (sample_type,"llu" , (unsigned long long )attr->sample_type); + __WRITE_ASS(read_format, "llu", (unsigned longlong)attr->read_format); WRITE_ASS(disabled, "d"); WRITE_ASS(inherit, "d"); WRITE_ASS(pinned, "d");tools/perf/tests/attr.c +3
-4@@ -124,10 +124,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,WRITE_ASS (exclude_callchain_user,"d" );WRITE_ASS (wakeup_events, PRIu32);WRITE_ASS (bp_type, PRIu32); -WRITE_ASS (config1,"llu" ); -WRITE_ASS (config2,"llu" ); -WRITE_ASS (branch_sample_type,"llu" ); -WRITE_ASS (sample_regs_user,"llu" ); +__WRITE_ASS (config1,"llu" , (unsigned long long )attr->config1); +__WRITE_ASS (config2,"llu" , (unsigned long long )attr->config2); + __WRITE_ASS(branch_sample_type, "llu", (unsigned longlong)attr->branch_sample_type);
tools/perf/tests/attr.c +1
-0+ __WRITE_ASS(sample_regs_user, "llu", (unsigned longlong)attr->sample_regs_user); WRITE_ASS(sample_stack_user, PRIu32); fclose(file);tools/perf/tests/bp_signal.c +1
-1@@ -74,7 +74,7 @@ static int bp_event(void *fn, int setup_signal) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; }tools/perf/tests/bp_signal_overflow.c +1
-1@@ -87,7 +87,7 @@ int test__bp_signal_overflow(void) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; }Signature · 7 lines
-- 1.7.5.4 _______________________________________________ yocto mailing list [email protected] https://lists.yoctoproject.org/listinfo/yocto
Quoted 18 lines · Yang Shi
On MIPS64, "
__u64" is "unsigned long" type, so the "%llu" specifier will cause build error on MIPS64.Convert
__u64to unsigned long long in those sprintf calls to avoid the build error.Signed-off-by Yang Shi <[email protected]>--- tools/perf/tests/attr.c | 20 ++++++++++---------- tools/perf/tests/bp_signal.c | 2 +- tools/perf/tests/bp_signal_overflow.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-)tools/perf/tests/attr.c +0
-0
tools/perf/tests/attr.c static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, · line 75
Quoted 6 lines
tools/perf/tests/attr.c +1
-1@@ -71,7 +71,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,char path[PATH_MAX ];snprintf (path,PATH_MAX ,"%s/event-%d-%llu-%d" , dir, - attr->type, attr->config, fd); + attr->type, (unsigned long long )attr->config, fd);
hmm may be you can convert %llu into PRIu64
e.g.
printf( "%" PRIu64 "\n", val);
Quoted 74 lines
tools/perf/tests/attr.c +9
-9file =fopen (path,"w+" );if (!file) {@@ -80,7 +80,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, }if (fprintf (file,"[event-%d-%llu-%d]\n" , - attr->type, attr->config, fd) <0 ) { + attr->type, (unsigned long long )attr->config, fd) <0 ) {perror ("test attr - failed to write event file" );fclose (file);return -1 ;@@ -96,10 +96,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,/* struct perf_event_attr */ WRITE_ASS (type, PRIu32);WRITE_ASS (size, PRIu32); -WRITE_ASS (config,"llu" ); -WRITE_ASS (sample_period,"llu" ); -WRITE_ASS (sample_type,"llu" ); -WRITE_ASS (read_format,"llu" ); +__WRITE_ASS (config,"llu" , (unsigned long long )attr->config); +__WRITE_ASS (sample_period,"llu" , (unsigned long long )attr->sample_period); +__WRITE_ASS (sample_type,"llu" , (unsigned long long )attr->sample_type); +__WRITE_ASS (read_format,"llu" , (unsigned long long )attr->read_format);WRITE_ASS (disabled,"d" );WRITE_ASS (inherit,"d" );WRITE_ASS (pinned,"d" );@@ -124,10 +124,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,WRITE_ASS (exclude_callchain_user,"d" );WRITE_ASS (wakeup_events, PRIu32);WRITE_ASS (bp_type, PRIu32); -WRITE_ASS (config1,"llu" ); -WRITE_ASS (config2,"llu" ); -WRITE_ASS (branch_sample_type,"llu" ); -WRITE_ASS (sample_regs_user,"llu" ); +__WRITE_ASS (config1,"llu" , (unsigned long long )attr->config1); +__WRITE_ASS (config2,"llu" , (unsigned long long )attr->config2); +__WRITE_ASS (branch_sample_type,"llu" , (unsigned long long )attr->branch_sample_type); +__WRITE_ASS (sample_regs_user,"llu" , (unsigned long long )attr->sample_regs_user);WRITE_ASS (sample_stack_user, PRIu32);fclose (file);tools/perf/tests/bp_signal.c +1
-1@@ -74,7 +74,7 @@ static int bp_event(void *fn, int setup_signal) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; }tools/perf/tests/bp_signal_overflow.c +1
-2@@ -87,7 +87,7 @@ int test__bp_signal_overflow(void) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; } --1.7.5.4
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
Quoted 28 lines · Khem Raj
Quoted 18 lines · Yang Shi
On MIPS64, "
__u64" is "unsigned long" type, so the "%llu" specifier will cause build error on MIPS64.Convert
__u64to unsigned long long in those sprintf calls to avoid the build error.Signed-off-by Yang Shi <[email protected]>--- tools/perf/tests/attr.c | 20 ++++++++++---------- tools/perf/tests/bp_signal.c | 2 +- tools/perf/tests/bp_signal_overflow.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-)tools/perf/tests/attr.c +0
-0tools/perf/tests/attr.c static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, · line 75
Quoted 6 lines
tools/perf/tests/attr.c +1
-1@@ -71,7 +71,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,char path[PATH_MAX ];snprintf (path,PATH_MAX ,"%s/event-%d-%llu-%d" , dir, - attr->type, attr->config, fd); + attr->type, (unsigned long long )attr->config, fd);hmm may be you can convert %llu into PRIu64
Quoted 4 lines
e.g.
printf( "%" PRIu64 "\n", val);
I think there was a thread/patch on the exact same package and issue in OE-core. The solution I think was to define __SANE_USERSPACE_TYPES__ to get proper definition of __u64.
http://patchwork.openembedded.org/patch/59641/
Or maybe this is something completely different?
Thanks.
Hans
Quoted 80 lines
Quoted 72 lines
tools/perf/tests/attr.c +9
-9file =fopen (path,"w+" );if (!file) {@@ -80,7 +80,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, }if (fprintf (file,"[event-%d-%llu-%d]\n" , - attr->type, attr->config, fd) <0 ) { + attr->type, (unsigned long long )attr->config, fd) <0 ) {perror ("test attr - failed to write event file" );fclose (file);return -1 ;@@ -96,10 +96,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,/* struct perf_event_attr */ WRITE_ASS (type, PRIu32);WRITE_ASS (size, PRIu32); -WRITE_ASS (config,"llu" ); -WRITE_ASS (sample_period,"llu" ); -WRITE_ASS (sample_type,"llu" ); -WRITE_ASS (read_format,"llu" ); +__WRITE_ASS (config,"llu" , (unsigned long long )attr->config); +__WRITE_ASS (sample_period,"llu" , (unsigned long long )attr->sample_period); +__WRITE_ASS (sample_type,"llu" , (unsigned long long )attr->sample_type); +__WRITE_ASS (read_format,"llu" , (unsigned long long )attr->read_format);WRITE_ASS (disabled,"d" );WRITE_ASS (inherit,"d" );WRITE_ASS (pinned,"d" );@@ -124,10 +124,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,WRITE_ASS (exclude_callchain_user,"d" );WRITE_ASS (wakeup_events, PRIu32);WRITE_ASS (bp_type, PRIu32); -WRITE_ASS (config1,"llu" ); -WRITE_ASS (config2,"llu" ); -WRITE_ASS (branch_sample_type,"llu" ); -WRITE_ASS (sample_regs_user,"llu" ); +__WRITE_ASS (config1,"llu" , (unsigned long long )attr->config1); +__WRITE_ASS (config2,"llu" , (unsigned long long )attr->config2); +__WRITE_ASS (branch_sample_type,"llu" , (unsigned long long )attr->branch_sample_type); +__WRITE_ASS (sample_regs_user,"llu" , (unsigned long long )attr->sample_regs_user);WRITE_ASS (sample_stack_user, PRIu32);fclose (file);tools/perf/tests/bp_signal.c +1
-1@@ -74,7 +74,7 @@ static int bp_event(void *fn, int setup_signal) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; }tools/perf/tests/bp_signal_overflow.c +1
-2@@ -87,7 +87,7 @@ int test__bp_signal_overflow(void) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; } --1.7.5.4
Quoted 4 lines
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
Quoted 31 lines · Hans Beckérus
Quoted 30 lines · Khem Raj
Quoted 18 lines · Yang Shi
On MIPS64, "
__u64" is "unsigned long" type, so the "%llu" specifier will cause build error on MIPS64.Convert
__u64to unsigned long long in those sprintf calls to avoid the build error.Signed-off-by Yang Shi <[email protected]>--- tools/perf/tests/attr.c | 20 ++++++++++---------- tools/perf/tests/bp_signal.c | 2 +- tools/perf/tests/bp_signal_overflow.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-)tools/perf/tests/attr.c +0
-0tools/perf/tests/attr.c static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, · line 75
Quoted 6 lines
tools/perf/tests/attr.c +1
-1@@ -71,7 +71,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,char path[PATH_MAX ];snprintf (path,PATH_MAX ,"%s/event-%d-%llu-%d" , dir, - attr->type, attr->config, fd); + attr->type, (unsigned long long )attr->config, fd);hmm may be you can convert %llu into PRIu64
e.g.
Quoted 7 lines
Quoted 2 lines
printf( "%" PRIu64 "\n", val);I think there was a thread/patch on the exact same package and issue in OE-core. The solution I think was to define
__SANE_USERSPACE_TYPES__to get proper definition of__u64.
http://patchwork.openembedded.org/patch/59641/
Or maybe this is something completely different?
The are the same, just a kernel guy versus a userspace guy looking at the same issue from different points of view. :)
Bruce
Quoted 89 lines
Thanks.
HansQuoted 72 lines
Quoted 72 lines
tools/perf/tests/attr.c +9
-9file =fopen (path,"w+" );if (!file) {@@ -80,7 +80,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, }if (fprintf (file,"[event-%d-%llu-%d]\n" , - attr->type, attr->config, fd) <0 ) { + attr->type, (unsigned long long )attr->config, fd) <0 ) {perror ("test attr - failed to write event file" );fclose (file);return -1 ;@@ -96,10 +96,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,/* struct perf_event_attr */ WRITE_ASS (type, PRIu32);WRITE_ASS (size, PRIu32); -WRITE_ASS (config,"llu" ); -WRITE_ASS (sample_period,"llu" ); -WRITE_ASS (sample_type,"llu" ); -WRITE_ASS (read_format,"llu" ); +__WRITE_ASS (config,"llu" , (unsigned long long )attr->config); +__WRITE_ASS (sample_period,"llu" , (unsigned long long )attr->sample_period); +__WRITE_ASS (sample_type,"llu" , (unsigned long long )attr->sample_type); +__WRITE_ASS (read_format,"llu" , (unsigned long long )attr->read_format);WRITE_ASS (disabled,"d" );WRITE_ASS (inherit,"d" );WRITE_ASS (pinned,"d" );@@ -124,10 +124,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,WRITE_ASS (exclude_callchain_user,"d" );WRITE_ASS (wakeup_events, PRIu32);WRITE_ASS (bp_type, PRIu32); -WRITE_ASS (config1,"llu" ); -WRITE_ASS (config2,"llu" ); -WRITE_ASS (branch_sample_type,"llu" ); -WRITE_ASS (sample_regs_user,"llu" ); +__WRITE_ASS (config1,"llu" , (unsigned long long )attr->config1); +__WRITE_ASS (config2,"llu" , (unsigned long long )attr->config2); +__WRITE_ASS (branch_sample_type,"llu" , (unsigned long long )attr->branch_sample_type); +__WRITE_ASS (sample_regs_user,"llu" , (unsigned long long )attr->sample_regs_user);WRITE_ASS (sample_stack_user, PRIu32);fclose (file);tools/perf/tests/bp_signal.c +1
-1@@ -74,7 +74,7 @@ static int bp_event(void *fn, int setup_signal) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; }tools/perf/tests/bp_signal_overflow.c +1
-2@@ -87,7 +87,7 @@ int test__bp_signal_overflow(void) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; } --1.7.5.4
Quoted 8 lines
Quoted 4 lines
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
Quoted 35 lines · Bruce Ashfield
Quoted 34 lines · Hans Beckérus
Quoted 33 lines · Khem Raj
Quoted 18 lines · Yang Shi
On MIPS64, "
__u64" is "unsigned long" type, so the "%llu" specifier will cause build error on MIPS64.Convert
__u64to unsigned long long in those sprintf calls to avoid the build error.Signed-off-by Yang Shi <[email protected]>--- tools/perf/tests/attr.c | 20 ++++++++++---------- tools/perf/tests/bp_signal.c | 2 +- tools/perf/tests/bp_signal_overflow.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-)tools/perf/tests/attr.c +0
-0tools/perf/tests/attr.c static int store_event(struct perf_event_attr · line 76
Quoted 7 lines
tools/perf/tests/attr.c +1
-1@@ -71,7 +71,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, char path[PATH_MAX];snprintf (path,PATH_MAX ,"%s/event-%d-%llu-%d" , dir, - attr->type, attr->config, fd); + attr->type, (unsigned long long )attr->config, fd);hmm may be you can convert %llu into PRIu64
e.g.
printf( "%" PRIu64 "\n", val);
Quoted 8 lines
Quoted 5 lines
I think there was a thread/patch on the exact same package and issue in OE-core. The solution I think was to define
__SANE_USERSPACE_TYPES__to get proper definition of__u64.
http://patchwork.openembedded.org/patch/59641/
Or maybe this is something completely different?The are the same, just a kernel guy versus a userspace guy looking at the same issue from different points of view. :)
Yes, actually kernel already had a commit to define that macro:
commit e3541ec75219819d3235f80125a1a75d798ff6e1
Author: Sukadev Bhattiprolu <[email protected]> Date: Wed Jan 23 21:44:39 2013 -0800
perf tools, powerpc: Fix compile warnings in tests/attr.c
We print several '__u64' quantities using '%llu'. On powerpc, we by default include '<asm-generic/int-l64.h> which results in __u64
being an
unsigned long. This causes compile warnings which are treated as errors due to '-Werror'.
By defining __SANE_USERSPACE_TYPES__ we include
<asm-generic/int-ll64.h>
and define __u64 as unsigned long long.
Changelog[v2]:
[Michael Ellerman] Use __SANE_USERSPACE_TYPES__ and avoid PRIu64 format specifier - which as Jiri Olsa pointed out, breaks on
x86-64.
But, MIPS64 still failed to build with this commit.
Yang
Quoted 112 lines
Bruce
Quoted 98 lines
Thanks.
HansQuoted 86 lines
Quoted 86 lines
tools/perf/tests/attr.c +0
-0file =fopen (path,"w+" );if (!file) {tools/perf/tests/attr.c +1
-1@@ -80,7 +80,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, }if (fprintf (file,"[event-%d-%llu-%d]\n" , - attr->type, attr->config, fd) <0 ) { + attr->type, (unsigned long long )attr->config, fd) <0 ) {perror ("test attr - failed to write event file" );fclose(file); return -1;tools/perf/tests/attr.c +3
-4@@ -96,10 +96,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,/* struct perf_event_attr */ WRITE_ASS (type, PRIu32);WRITE_ASS (size, PRIu32); -WRITE_ASS (config,"llu" ); -WRITE_ASS (sample_period,"llu" ); -WRITE_ASS (sample_type,"llu" ); -WRITE_ASS (read_format,"llu" ); +__WRITE_ASS (config,"llu" , (unsigned long long )attr->config); +__WRITE_ASS (sample_period,"llu" , (unsigned long long )attr->sample_period); + __WRITE_ASS(sample_type, "llu", (unsigned longlong)attr->sample_type);
+ __WRITE_ASS(read_format, "llu", (unsigned longlong)attr->read_format); WRITE_ASS(disabled, "d"); WRITE_ASS(inherit, "d"); WRITE_ASS(pinned, "d");tools/perf/tests/attr.c +3
-4@@ -124,10 +124,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,WRITE_ASS (exclude_callchain_user,"d" );WRITE_ASS (wakeup_events, PRIu32);WRITE_ASS (bp_type, PRIu32); -WRITE_ASS (config1,"llu" ); -WRITE_ASS (config2,"llu" ); -WRITE_ASS (branch_sample_type,"llu" ); -WRITE_ASS (sample_regs_user,"llu" ); +__WRITE_ASS (config1,"llu" , (unsigned long long )attr->config1); +__WRITE_ASS (config2,"llu" , (unsigned long long )attr->config2); + __WRITE_ASS(branch_sample_type, "llu", (unsigned longlong)attr->branch_sample_type);
+ __WRITE_ASS(sample_regs_user, "llu", (unsigned longlong)attr->sample_regs_user); WRITE_ASS(sample_stack_user, PRIu32); fclose(file);tools/perf/tests/bp_signal.c +1
-1@@ -74,7 +74,7 @@ static int bp_event(void *fn, int setup_signal) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; }tools/perf/tests/bp_signal_overflow.c +1
-1@@ -87,7 +87,7 @@ int test__bp_signal_overflow(void) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; }Signature · 2 lines
-- 1.7.5.4Quoted 8 lines
Quoted 4 lines
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yoctoQuoted 5 lines
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
Quoted 27 lines · Khem Raj
Quoted 18 lines · Yang Shi
On MIPS64, "
__u64" is "unsigned long" type, so the "%llu" specifier will cause build error on MIPS64.Convert
__u64to unsigned long long in those sprintf calls to avoid the build error.Signed-off-by Yang Shi <[email protected]>--- tools/perf/tests/attr.c | 20 ++++++++++---------- tools/perf/tests/bp_signal.c | 2 +- tools/perf/tests/bp_signal_overflow.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-)tools/perf/tests/attr.c +0
-0tools/perf/tests/attr.c static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, · line 75
Quoted 6 lines
tools/perf/tests/attr.c +1
-1@@ -71,7 +71,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,char path[PATH_MAX ];snprintf (path,PATH_MAX ,"%s/event-%d-%llu-%d" , dir, - attr->type, attr->config, fd); + attr->type, (unsigned long long )attr->config, fd);hmm may be you can convert %llu into PRIu64
Quoted 3 lines
e.g.
printf( "%" PRIu64 "\n", val);
I already tried this. It works on some arches, like MIPS64, but failed for x86_64 build.
Thanks,
Yang
Quoted 77 lines
Quoted 77 lines
tools/perf/tests/attr.c +9
-9file =fopen (path,"w+" );if (!file) {@@ -80,7 +80,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu, }if (fprintf (file,"[event-%d-%llu-%d]\n" , - attr->type, attr->config, fd) <0 ) { + attr->type, (unsigned long long )attr->config, fd) <0 ) {perror ("test attr - failed to write event file" );fclose (file);return -1 ;@@ -96,10 +96,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,/* struct perf_event_attr */ WRITE_ASS (type, PRIu32);WRITE_ASS (size, PRIu32); -WRITE_ASS (config,"llu" ); -WRITE_ASS (sample_period,"llu" ); -WRITE_ASS (sample_type,"llu" ); -WRITE_ASS (read_format,"llu" ); +__WRITE_ASS (config,"llu" , (unsigned long long )attr->config); +__WRITE_ASS (sample_period,"llu" , (unsigned long long )attr->sample_period); +__WRITE_ASS (sample_type,"llu" , (unsigned long long )attr->sample_type); +__WRITE_ASS (read_format,"llu" , (unsigned long long )attr->read_format);WRITE_ASS (disabled,"d" );WRITE_ASS (inherit,"d" );WRITE_ASS (pinned,"d" );@@ -124,10 +124,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,WRITE_ASS (exclude_callchain_user,"d" );WRITE_ASS (wakeup_events, PRIu32);WRITE_ASS (bp_type, PRIu32); -WRITE_ASS (config1,"llu" ); -WRITE_ASS (config2,"llu" ); -WRITE_ASS (branch_sample_type,"llu" ); -WRITE_ASS (sample_regs_user,"llu" ); +__WRITE_ASS (config1,"llu" , (unsigned long long )attr->config1); +__WRITE_ASS (config2,"llu" , (unsigned long long )attr->config2); +__WRITE_ASS (branch_sample_type,"llu" , (unsigned long long )attr->branch_sample_type); +__WRITE_ASS (sample_regs_user,"llu" , (unsigned long long )attr->sample_regs_user);WRITE_ASS (sample_stack_user, PRIu32);fclose (file);tools/perf/tests/bp_signal.c +1
-1@@ -74,7 +74,7 @@ static int bp_event(void *fn, int setup_signal) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; }tools/perf/tests/bp_signal_overflow.c +1
-2@@ -87,7 +87,7 @@ int test__bp_signal_overflow(void) fd =sys_perf_event_open (&pe,0 ,-1 ,-1 ,0 );if (fd <0 ) { -pr_debug ("failed opening event %llx\n" , pe.config); +pr_debug ("failed opening event %llx\n" , (unsigned long long )pe.config);return TEST_FAIL ; } --1.7.5.4
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto