linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH: Fix for_each_set_bit(u64) build on 32-bit arches, was perf intel-pt: Add support for PERF_RECORD_AUX_OUTPUT_HW_ID
@ 2021-10-25 16:52 Arnaldo Carvalho de Melo
  2021-10-26  5:42 ` Adrian Hunter
  0 siblings, 1 reply; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-10-25 16:52 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: peterz, alexander.shishkin, jolsa, namhyung, mingo, irogers,
	linux-perf-users, linux-kernel

Em Wed, Oct 20, 2021 at 02:25:43PM -0300, Arnaldo Carvalho de Melo escreveu:
>   29     8.60 debian:experimental-x-mipsel  : FAIL gcc version 11.2.0 (Debian 11.2.0-9)
>     util/intel-pt.c: In function 'intel_pt_synth_pebs_sample':
>     util/intel-pt.c:2146:33: error: passing argument 1 of 'find_first_bit' from incompatible pointer type [-Werror=incompatible-pointer-types]
>      2146 |         for_each_set_bit(hw_id, &items->applicable_counters, INTEL_PT_MAX_PEBS) {
>     /git/perf-5.15.0-rc4/tools/include/linux/bitops.h:37:38: note: in definition of macro 'for_each_set_bit'
>        37 |         for ((bit) = find_first_bit((addr), (size));            \
>           |                                      ^~~~
>     In file included from /git/perf-5.15.0-rc4/tools/include/asm-generic/bitops.h:21,
>                      from /git/perf-5.15.0-rc4/tools/include/linux/bitops.h:34,
>                      from /git/perf-5.15.0-rc4/tools/include/linux/bitmap.h:6,
>                      from util/header.h:10,
>                      from util/session.h:7,
>                      from util/intel-pt.c:16:
>     /git/perf-5.15.0-rc4/tools/include/asm-generic/bitops/find.h:109:51: note: expected 'const long unsigned int *' but argument is of type 'const uint64_t *' {aka 'const long long unsigned int *'}
> 
>  Adrian, this is on:
> 
>  commit 803a3c9233990e1adac8ea2421e3759c2d380cf8
> Author: Adrian Hunter <adrian.hunter@intel.com>
> Date:   Tue Sep 7 19:39:03 2021 +0300
> 
>     perf intel-pt: Add support for PERF_RECORD_AUX_OUTPUT_HW_ID
> 
>     Originally, software only supported redirecting at most one PEBS event to
>     Intel PT (PEBS-via-PT) because it was not able to differentiate one event
>     from another. To overcome that, add support for the
>     PERF_RECORD_AUX_OUTPUT_HW_ID side-band event.
> 
>     Reviewed-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
>     Reviewed-by: Andi Kleen <ak@linux.intel.com>
> 
> 
> That is still just on tmp.perf/core, so we can fix it, probably its just
> making that uint64_t into a unsigned long, will check later if you don't
> beat me to it.

Do as other code in perf does, e.g.  arch/x86/events/intel/ds.c, dealing
with PEBS.

I'm adding this to that patch to fix the build on 32-bit.

- Arnaldo


diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index 1073c56a512cdc6e..c9542fada8fb6f9b 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -2143,7 +2143,7 @@ static int intel_pt_synth_pebs_sample(struct intel_pt_queue *ptq)
 		return intel_pt_synth_single_pebs_sample(ptq);
 	}
 
-	for_each_set_bit(hw_id, &items->applicable_counters, INTEL_PT_MAX_PEBS) {
+	for_each_set_bit(hw_id, (unsigned long *)&items->applicable_counters, INTEL_PT_MAX_PEBS) {
 		pe = &ptq->pebs[hw_id];
 		if (!pe->evsel) {
 			if (!pt->single_pebs)

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

* Re: [PATCH: Fix for_each_set_bit(u64) build on 32-bit arches, was perf intel-pt: Add support for PERF_RECORD_AUX_OUTPUT_HW_ID
  2021-10-25 16:52 [PATCH: Fix for_each_set_bit(u64) build on 32-bit arches, was perf intel-pt: Add support for PERF_RECORD_AUX_OUTPUT_HW_ID Arnaldo Carvalho de Melo
@ 2021-10-26  5:42 ` Adrian Hunter
  0 siblings, 0 replies; 2+ messages in thread
From: Adrian Hunter @ 2021-10-26  5:42 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: peterz, alexander.shishkin, jolsa, namhyung, mingo, irogers,
	linux-perf-users, linux-kernel

On 25/10/2021 19:52, Arnaldo Carvalho de Melo wrote:
> Em Wed, Oct 20, 2021 at 02:25:43PM -0300, Arnaldo Carvalho de Melo escreveu:
>>   29     8.60 debian:experimental-x-mipsel  : FAIL gcc version 11.2.0 (Debian 11.2.0-9)
>>     util/intel-pt.c: In function 'intel_pt_synth_pebs_sample':
>>     util/intel-pt.c:2146:33: error: passing argument 1 of 'find_first_bit' from incompatible pointer type [-Werror=incompatible-pointer-types]
>>      2146 |         for_each_set_bit(hw_id, &items->applicable_counters, INTEL_PT_MAX_PEBS) {
>>     /git/perf-5.15.0-rc4/tools/include/linux/bitops.h:37:38: note: in definition of macro 'for_each_set_bit'
>>        37 |         for ((bit) = find_first_bit((addr), (size));            \
>>           |                                      ^~~~
>>     In file included from /git/perf-5.15.0-rc4/tools/include/asm-generic/bitops.h:21,
>>                      from /git/perf-5.15.0-rc4/tools/include/linux/bitops.h:34,
>>                      from /git/perf-5.15.0-rc4/tools/include/linux/bitmap.h:6,
>>                      from util/header.h:10,
>>                      from util/session.h:7,
>>                      from util/intel-pt.c:16:
>>     /git/perf-5.15.0-rc4/tools/include/asm-generic/bitops/find.h:109:51: note: expected 'const long unsigned int *' but argument is of type 'const uint64_t *' {aka 'const long long unsigned int *'}
>>
>>  Adrian, this is on:
>>
>>  commit 803a3c9233990e1adac8ea2421e3759c2d380cf8
>> Author: Adrian Hunter <adrian.hunter@intel.com>
>> Date:   Tue Sep 7 19:39:03 2021 +0300
>>
>>     perf intel-pt: Add support for PERF_RECORD_AUX_OUTPUT_HW_ID
>>
>>     Originally, software only supported redirecting at most one PEBS event to
>>     Intel PT (PEBS-via-PT) because it was not able to differentiate one event
>>     from another. To overcome that, add support for the
>>     PERF_RECORD_AUX_OUTPUT_HW_ID side-band event.
>>
>>     Reviewed-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
>>     Reviewed-by: Andi Kleen <ak@linux.intel.com>
>>
>>
>> That is still just on tmp.perf/core, so we can fix it, probably its just
>> making that uint64_t into a unsigned long, will check later if you don't
>> beat me to it.
> 
> Do as other code in perf does, e.g.  arch/x86/events/intel/ds.c, dealing
> with PEBS.
> 
> I'm adding this to that patch to fix the build on 32-bit.
> 
> - Arnaldo
> 
> 
> diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
> index 1073c56a512cdc6e..c9542fada8fb6f9b 100644
> --- a/tools/perf/util/intel-pt.c
> +++ b/tools/perf/util/intel-pt.c
> @@ -2143,7 +2143,7 @@ static int intel_pt_synth_pebs_sample(struct intel_pt_queue *ptq)
>  		return intel_pt_synth_single_pebs_sample(ptq);
>  	}
>  
> -	for_each_set_bit(hw_id, &items->applicable_counters, INTEL_PT_MAX_PEBS) {
> +	for_each_set_bit(hw_id, (unsigned long *)&items->applicable_counters, INTEL_PT_MAX_PEBS) {
>  		pe = &ptq->pebs[hw_id];
>  		if (!pe->evsel) {
>  			if (!pt->single_pebs)
> 

That is fine. Thank you!

Acked-by: Adrian Hunter <adrian.hunter@intel.com>


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

end of thread, other threads:[~2021-10-26  5:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-25 16:52 [PATCH: Fix for_each_set_bit(u64) build on 32-bit arches, was perf intel-pt: Add support for PERF_RECORD_AUX_OUTPUT_HW_ID Arnaldo Carvalho de Melo
2021-10-26  5:42 ` Adrian Hunter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).