mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf/x86/intel: Cast u64 variable
@ 2024-11-15 22:58 Ragavendra
  2024-11-16 10:11 ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: Ragavendra @ 2024-11-15 22:58 UTC (permalink / raw)
  To: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
	jolsa, irogers, adrian.hunter, kan.liang, tglx, bp, dave.hansen,
	hpa
  Cc: x86, linux-perf-users, linux-kernel, Ragavendra

Casting (1 >> bit) to u64 before it is compared with pebs_status variable.

Fixes: 21509084f999 perf/x86/intel: Handle multiple records in the PEBS buffer
Signed-off-by: Ragavendra Nagraj <ragavendra.bn@gmail.com>
---
 arch/x86/events/intel/ds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
index fa5ea65de0d0..9ea147565dc2 100644
--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -2072,7 +2072,7 @@ get_next_pebs_record_by_bit(void *base, void *top, int bit)
 			/* clear non-PEBS bit and re-check */
 			pebs_status = status & cpuc->pebs_enabled;
 			pebs_status &= PEBS_COUNTER_MASK;
-			if (pebs_status == (1 << bit))
+			if (pebs_status == (u64) (1 << bit))
 				return at;
 		}
 	}
-- 
2.46.1


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

* Re: [PATCH] perf/x86/intel: Cast u64 variable
  2024-11-15 22:58 [PATCH] perf/x86/intel: Cast u64 variable Ragavendra
@ 2024-11-16 10:11 ` Peter Zijlstra
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2024-11-16 10:11 UTC (permalink / raw)
  To: Ragavendra
  Cc: mingo, acme, namhyung, mark.rutland, alexander.shishkin, jolsa,
	irogers, adrian.hunter, kan.liang, tglx, bp, dave.hansen, hpa,
	x86, linux-perf-users, linux-kernel

On Fri, Nov 15, 2024 at 02:58:30PM -0800, Ragavendra wrote:
> Casting (1 >> bit) to u64 before it is compared with pebs_status variable.

I don't think this does what you want it to.

> Fixes: 21509084f999 perf/x86/intel: Handle multiple records in the PEBS buffer
> Signed-off-by: Ragavendra Nagraj <ragavendra.bn@gmail.com>
> ---
>  arch/x86/events/intel/ds.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
> index fa5ea65de0d0..9ea147565dc2 100644
> --- a/arch/x86/events/intel/ds.c
> +++ b/arch/x86/events/intel/ds.c
> @@ -2072,7 +2072,7 @@ get_next_pebs_record_by_bit(void *base, void *top, int bit)
>  			/* clear non-PEBS bit and re-check */
>  			pebs_status = status & cpuc->pebs_enabled;
>  			pebs_status &= PEBS_COUNTER_MASK;
> -			if (pebs_status == (1 << bit))
> +			if (pebs_status == (u64) (1 << bit))
>  				return at;
>  		}
>  	}
> -- 
> 2.46.1
> 

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

end of thread, other threads:[~2024-11-16 10:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-15 22:58 [PATCH] perf/x86/intel: Cast u64 variable Ragavendra
2024-11-16 10:11 ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®