All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf: mips64: Convert __u64 to unsigned long long
@ 2013-10-25 19:17 Yang Shi
  2013-10-25 20:11 ` Billie Alsup
  2013-10-29  0:38 ` Khem Raj
  0 siblings, 2 replies; 9+ messages in thread
From: Yang Shi @ 2013-10-25 19:17 UTC (permalink / raw)
  To: bruce.ashfield, yocto

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.

Signed-off-by: Yang Shi <yang.shi@windriver.com>
---
 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(-)

diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 00218f5..f045c2c 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -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);
diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c
index 68daa28..bf3a094 100644
--- a/tools/perf/tests/bp_signal.c
+++ b/tools/perf/tests/bp_signal.c
@@ -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;
 	}
 
diff --git a/tools/perf/tests/bp_signal_overflow.c b/tools/perf/tests/bp_signal_overflow.c
index fe7ed28..3662b15 100644
--- a/tools/perf/tests/bp_signal_overflow.c
+++ b/tools/perf/tests/bp_signal_overflow.c
@@ -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



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] perf: mips64: Convert __u64 to unsigned long long
  2013-10-25 19:17 [PATCH] perf: mips64: Convert __u64 to unsigned long long Yang Shi
@ 2013-10-25 20:11 ` Billie Alsup
  2013-10-25 20:14   ` Billie Alsup
  2013-10-29  0:38 ` Khem Raj
  1 sibling, 1 reply; 9+ messages in thread
From: Billie Alsup @ 2013-10-25 20:11 UTC (permalink / raw)
  To: Yang Shi, bruce.ashfield@windriver.com, yocto@yoctoproject.org

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"


On 10/25/13 12:17 PM, "Yang Shi" <yang.shi@windriver.com> wrote:

>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.
>
>Signed-off-by: Yang Shi <yang.shi@windriver.com>
>---
> 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(-)
>
>diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
>index 00218f5..f045c2c 100644
>--- a/tools/perf/tests/attr.c
>+++ b/tools/perf/tests/attr.c
>@@ -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);
>diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c
>index 68daa28..bf3a094 100644
>--- a/tools/perf/tests/bp_signal.c
>+++ b/tools/perf/tests/bp_signal.c
>@@ -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;
> 	}
> 
>diff --git a/tools/perf/tests/bp_signal_overflow.c
>b/tools/perf/tests/bp_signal_overflow.c
>index fe7ed28..3662b15 100644
>--- a/tools/perf/tests/bp_signal_overflow.c
>+++ b/tools/perf/tests/bp_signal_overflow.c
>@@ -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
>yocto@yoctoproject.org
>https://lists.yoctoproject.org/listinfo/yocto



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] perf: mips64: Convert __u64 to unsigned long long
  2013-10-25 20:11 ` Billie Alsup
@ 2013-10-25 20:14   ` Billie Alsup
  2013-10-25 20:52     ` Yang Shi
  0 siblings, 1 reply; 9+ messages in thread
From: Billie Alsup @ 2013-10-25 20:14 UTC (permalink / raw)
  To: Yang Shi, bruce.ashfield@windriver.com, yocto@yoctoproject.org

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


On 10/25/13 1:11 PM, "Billie Alsup" <billie.alsup@ericsson.com> wrote:

>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"
>
>
>On 10/25/13 12:17 PM, "Yang Shi" <yang.shi@windriver.com> wrote:
>
>>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.
>>
>>Signed-off-by: Yang Shi <yang.shi@windriver.com>
>>---
>> 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(-)
>>
>>diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
>>index 00218f5..f045c2c 100644
>>--- a/tools/perf/tests/attr.c
>>+++ b/tools/perf/tests/attr.c
>>@@ -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);
>>diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c
>>index 68daa28..bf3a094 100644
>>--- a/tools/perf/tests/bp_signal.c
>>+++ b/tools/perf/tests/bp_signal.c
>>@@ -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;
>> 	}
>> 
>>diff --git a/tools/perf/tests/bp_signal_overflow.c
>>b/tools/perf/tests/bp_signal_overflow.c
>>index fe7ed28..3662b15 100644
>>--- a/tools/perf/tests/bp_signal_overflow.c
>>+++ b/tools/perf/tests/bp_signal_overflow.c
>>@@ -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
>>yocto@yoctoproject.org
>>https://lists.yoctoproject.org/listinfo/yocto
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] perf: mips64: Convert __u64 to unsigned long long
  2013-10-25 20:14   ` Billie Alsup
@ 2013-10-25 20:52     ` Yang Shi
  0 siblings, 0 replies; 9+ messages in thread
From: Yang Shi @ 2013-10-25 20:52 UTC (permalink / raw)
  To: Billie Alsup, bruce.ashfield@windriver.com,
	yocto@yoctoproject.org

On 10/25/2013 1:14 PM, Billie Alsup wrote:
> 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

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

>
>
> On 10/25/13 1:11 PM, "Billie Alsup" <billie.alsup@ericsson.com> wrote:
>
>> 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"
>>
>>
>> On 10/25/13 12:17 PM, "Yang Shi" <yang.shi@windriver.com> wrote:
>>
>>> 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.
>>>
>>> Signed-off-by: Yang Shi <yang.shi@windriver.com>
>>> ---
>>> 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(-)
>>>
>>> diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
>>> index 00218f5..f045c2c 100644
>>> --- a/tools/perf/tests/attr.c
>>> +++ b/tools/perf/tests/attr.c
>>> @@ -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);
>>> diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c
>>> index 68daa28..bf3a094 100644
>>> --- a/tools/perf/tests/bp_signal.c
>>> +++ b/tools/perf/tests/bp_signal.c
>>> @@ -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;
>>> 	}
>>>
>>> diff --git a/tools/perf/tests/bp_signal_overflow.c
>>> b/tools/perf/tests/bp_signal_overflow.c
>>> index fe7ed28..3662b15 100644
>>> --- a/tools/perf/tests/bp_signal_overflow.c
>>> +++ b/tools/perf/tests/bp_signal_overflow.c
>>> @@ -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
>>> yocto@yoctoproject.org
>>> https://lists.yoctoproject.org/listinfo/yocto
>
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] perf: mips64: Convert __u64 to unsigned long long
  2013-10-25 19:17 [PATCH] perf: mips64: Convert __u64 to unsigned long long Yang Shi
  2013-10-25 20:11 ` Billie Alsup
@ 2013-10-29  0:38 ` Khem Raj
  2013-10-29  9:28   ` Hans Beckérus
  2013-10-29 14:48   ` Yang Shi
  1 sibling, 2 replies; 9+ messages in thread
From: Khem Raj @ 2013-10-29  0:38 UTC (permalink / raw)
  To: Yang Shi; +Cc: yocto@yoctoproject.org

On Fri, Oct 25, 2013 at 12:17 PM, Yang Shi <yang.shi@windriver.com> wrote:
> 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.
>
> Signed-off-by: Yang Shi <yang.shi@windriver.com>
> ---
>  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(-)
>
> diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
> index 00218f5..f045c2c 100644
> --- a/tools/perf/tests/attr.c
> +++ b/tools/perf/tests/attr.c
> @@ -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);



>         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);
> diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c
> index 68daa28..bf3a094 100644
> --- a/tools/perf/tests/bp_signal.c
> +++ b/tools/perf/tests/bp_signal.c
> @@ -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;
>         }
>
> diff --git a/tools/perf/tests/bp_signal_overflow.c b/tools/perf/tests/bp_signal_overflow.c
> index fe7ed28..3662b15 100644
> --- a/tools/perf/tests/bp_signal_overflow.c
> +++ b/tools/perf/tests/bp_signal_overflow.c
> @@ -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
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] perf: mips64: Convert __u64 to unsigned long long
  2013-10-29  0:38 ` Khem Raj
@ 2013-10-29  9:28   ` Hans Beckérus
  2013-10-29 12:40     ` Bruce Ashfield
  2013-10-29 14:48   ` Yang Shi
  1 sibling, 1 reply; 9+ messages in thread
From: Hans Beckérus @ 2013-10-29  9:28 UTC (permalink / raw)
  To: Khem Raj; +Cc: yocto@yoctoproject.org

On Tue, Oct 29, 2013 at 1:38 AM, Khem Raj <raj.khem@gmail.com> wrote:
> On Fri, Oct 25, 2013 at 12:17 PM, Yang Shi <yang.shi@windriver.com> wrote:
>> 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.
>>
>> Signed-off-by: Yang Shi <yang.shi@windriver.com>
>> ---
>>  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(-)
>>
>> diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
>> index 00218f5..f045c2c 100644
>> --- a/tools/perf/tests/attr.c
>> +++ b/tools/perf/tests/attr.c
>> @@ -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);
>
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

>
>
>>         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);
>> diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c
>> index 68daa28..bf3a094 100644
>> --- a/tools/perf/tests/bp_signal.c
>> +++ b/tools/perf/tests/bp_signal.c
>> @@ -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;
>>         }
>>
>> diff --git a/tools/perf/tests/bp_signal_overflow.c b/tools/perf/tests/bp_signal_overflow.c
>> index fe7ed28..3662b15 100644
>> --- a/tools/perf/tests/bp_signal_overflow.c
>> +++ b/tools/perf/tests/bp_signal_overflow.c
>> @@ -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
>> yocto@yoctoproject.org
>> https://lists.yoctoproject.org/listinfo/yocto
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] perf: mips64: Convert __u64 to unsigned long long
  2013-10-29  9:28   ` Hans Beckérus
@ 2013-10-29 12:40     ` Bruce Ashfield
  2013-10-29 14:49       ` Yang Shi
  0 siblings, 1 reply; 9+ messages in thread
From: Bruce Ashfield @ 2013-10-29 12:40 UTC (permalink / raw)
  To: Hans Beckérus, Khem Raj; +Cc: yocto@yoctoproject.org

On 13-10-29 05:28 AM, Hans Beckérus wrote:
> On Tue, Oct 29, 2013 at 1:38 AM, Khem Raj <raj.khem@gmail.com> wrote:
>> On Fri, Oct 25, 2013 at 12:17 PM, Yang Shi <yang.shi@windriver.com> wrote:
>>> 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.
>>>
>>> Signed-off-by: Yang Shi <yang.shi@windriver.com>
>>> ---
>>>   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(-)
>>>
>>> diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
>>> index 00218f5..f045c2c 100644
>>> --- a/tools/perf/tests/attr.c
>>> +++ b/tools/perf/tests/attr.c
>>> @@ -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);
>>
> 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

>
> Thanks.
> Hans
>
>>
>>
>>>          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);
>>> diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c
>>> index 68daa28..bf3a094 100644
>>> --- a/tools/perf/tests/bp_signal.c
>>> +++ b/tools/perf/tests/bp_signal.c
>>> @@ -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;
>>>          }
>>>
>>> diff --git a/tools/perf/tests/bp_signal_overflow.c b/tools/perf/tests/bp_signal_overflow.c
>>> index fe7ed28..3662b15 100644
>>> --- a/tools/perf/tests/bp_signal_overflow.c
>>> +++ b/tools/perf/tests/bp_signal_overflow.c
>>> @@ -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
>>> yocto@yoctoproject.org
>>> https://lists.yoctoproject.org/listinfo/yocto
>> _______________________________________________
>> yocto mailing list
>> yocto@yoctoproject.org
>> https://lists.yoctoproject.org/listinfo/yocto
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] perf: mips64: Convert __u64 to unsigned long long
  2013-10-29  0:38 ` Khem Raj
  2013-10-29  9:28   ` Hans Beckérus
@ 2013-10-29 14:48   ` Yang Shi
  1 sibling, 0 replies; 9+ messages in thread
From: Yang Shi @ 2013-10-29 14:48 UTC (permalink / raw)
  To: Khem Raj; +Cc: yocto@yoctoproject.org

On 10/28/2013 5:38 PM, Khem Raj wrote:
> On Fri, Oct 25, 2013 at 12:17 PM, Yang Shi <yang.shi@windriver.com> wrote:
>> 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.
>>
>> Signed-off-by: Yang Shi <yang.shi@windriver.com>
>> ---
>>   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(-)
>>
>> diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
>> index 00218f5..f045c2c 100644
>> --- a/tools/perf/tests/attr.c
>> +++ b/tools/perf/tests/attr.c
>> @@ -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);

I already tried this. It works on some arches, like MIPS64, but failed 
for x86_64 build.

Thanks,
Yang

>
>
>
>>          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);
>> diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c
>> index 68daa28..bf3a094 100644
>> --- a/tools/perf/tests/bp_signal.c
>> +++ b/tools/perf/tests/bp_signal.c
>> @@ -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;
>>          }
>>
>> diff --git a/tools/perf/tests/bp_signal_overflow.c b/tools/perf/tests/bp_signal_overflow.c
>> index fe7ed28..3662b15 100644
>> --- a/tools/perf/tests/bp_signal_overflow.c
>> +++ b/tools/perf/tests/bp_signal_overflow.c
>> @@ -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
>> yocto@yoctoproject.org
>> https://lists.yoctoproject.org/listinfo/yocto



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] perf: mips64: Convert __u64 to unsigned long long
  2013-10-29 12:40     ` Bruce Ashfield
@ 2013-10-29 14:49       ` Yang Shi
  0 siblings, 0 replies; 9+ messages in thread
From: Yang Shi @ 2013-10-29 14:49 UTC (permalink / raw)
  To: Bruce Ashfield, Hans Beckérus, Khem Raj; +Cc: yocto@yoctoproject.org

On 10/29/2013 5:40 AM, Bruce Ashfield wrote:
> On 13-10-29 05:28 AM, Hans Beckérus wrote:
>> On Tue, Oct 29, 2013 at 1:38 AM, Khem Raj <raj.khem@gmail.com> wrote:
>>> On Fri, Oct 25, 2013 at 12:17 PM, Yang Shi <yang.shi@windriver.com> 
>>> wrote:
>>>> 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.
>>>>
>>>> Signed-off-by: Yang Shi <yang.shi@windriver.com>
>>>> ---
>>>>   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(-)
>>>>
>>>> diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
>>>> index 00218f5..f045c2c 100644
>>>> --- a/tools/perf/tests/attr.c
>>>> +++ b/tools/perf/tests/attr.c
>>>> @@ -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);
>>>
>> 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 <sukadev@linux.vnet.ibm.com>
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.

     Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
     Cc: Anton Blanchard <anton@au1.ibm.com>
     Cc: Jiri Olsa <jolsa@redhat.com>
     Cc: Michael Ellerman <ellerman@au1.ibm.com>
     Cc: linuxppc-dev@ozlabs.org
     Link: http://lkml.kernel.org/r/20130124054439.GA31588@us.ibm.com
     Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

But, MIPS64 still failed to build with this commit.

Yang

>
> Bruce
>
>>
>> Thanks.
>> Hans
>>
>>>
>>>
>>>>          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);
>>>> diff --git a/tools/perf/tests/bp_signal.c 
>>>> b/tools/perf/tests/bp_signal.c
>>>> index 68daa28..bf3a094 100644
>>>> --- a/tools/perf/tests/bp_signal.c
>>>> +++ b/tools/perf/tests/bp_signal.c
>>>> @@ -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;
>>>>          }
>>>>
>>>> diff --git a/tools/perf/tests/bp_signal_overflow.c 
>>>> b/tools/perf/tests/bp_signal_overflow.c
>>>> index fe7ed28..3662b15 100644
>>>> --- a/tools/perf/tests/bp_signal_overflow.c
>>>> +++ b/tools/perf/tests/bp_signal_overflow.c
>>>> @@ -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
>>>> yocto@yoctoproject.org
>>>> https://lists.yoctoproject.org/listinfo/yocto
>>> _______________________________________________
>>> yocto mailing list
>>> yocto@yoctoproject.org
>>> https://lists.yoctoproject.org/listinfo/yocto
>> _______________________________________________
>> yocto mailing list
>> yocto@yoctoproject.org
>> https://lists.yoctoproject.org/listinfo/yocto
>>
>
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-10-29 14:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-25 19:17 [PATCH] perf: mips64: Convert __u64 to unsigned long long Yang Shi
2013-10-25 20:11 ` Billie Alsup
2013-10-25 20:14   ` Billie Alsup
2013-10-25 20:52     ` Yang Shi
2013-10-29  0:38 ` Khem Raj
2013-10-29  9:28   ` Hans Beckérus
2013-10-29 12:40     ` Bruce Ashfield
2013-10-29 14:49       ` Yang Shi
2013-10-29 14:48   ` Yang Shi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.