All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] x86/pmu: Fix compilation on 32-bit hosts
@ 2020-06-16 10:59 Thomas Huth
  2020-06-16 11:13 ` Xu, Like
  2020-06-16 12:29 ` Paolo Bonzini
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Huth @ 2020-06-16 10:59 UTC (permalink / raw)
  To: pbonzini, kvm; +Cc: like.xu, vkuznets

When building for 32-bit hosts, the compiler currently complains:

 x86/pmu.c: In function 'check_gp_counters_write_width':
 x86/pmu.c:490:30: error: left shift count >= width of type

Use the correct suffix to avoid this problem.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 x86/pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/x86/pmu.c b/x86/pmu.c
index 57a2b23..91a6fb4 100644
--- a/x86/pmu.c
+++ b/x86/pmu.c
@@ -487,7 +487,7 @@ static void do_unsupported_width_counter_write(void *index)
 static void  check_gp_counters_write_width(void)
 {
 	u64 val_64 = 0xffffff0123456789ull;
-	u64 val_32 = val_64 & ((1ul << 32) - 1);
+	u64 val_32 = val_64 & ((1ull << 32) - 1);
 	u64 val_max_width = val_64 & ((1ul << eax.split.bit_width) - 1);
 	int i;
 
-- 
2.18.1


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

* Re: [kvm-unit-tests PATCH] x86/pmu: Fix compilation on 32-bit hosts
  2020-06-16 10:59 [kvm-unit-tests PATCH] x86/pmu: Fix compilation on 32-bit hosts Thomas Huth
@ 2020-06-16 11:13 ` Xu, Like
  2020-06-16 11:22   ` Thomas Huth
  2020-06-16 12:29 ` Paolo Bonzini
  1 sibling, 1 reply; 4+ messages in thread
From: Xu, Like @ 2020-06-16 11:13 UTC (permalink / raw)
  To: Thomas Huth, pbonzini, kvm; +Cc: like.xu, vkuznets

On 2020/6/16 18:59, Thomas Huth wrote:
> When building for 32-bit hosts, the compiler currently complains:
>
>   x86/pmu.c: In function 'check_gp_counters_write_width':
>   x86/pmu.c:490:30: error: left shift count >= width of type
>
> Use the correct suffix to avoid this problem.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
Thanks, I admit I did not test it on a 32-bit host.
> ---
>   x86/pmu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/x86/pmu.c b/x86/pmu.c
> index 57a2b23..91a6fb4 100644
> --- a/x86/pmu.c
> +++ b/x86/pmu.c
> @@ -487,7 +487,7 @@ static void do_unsupported_width_counter_write(void *index)
>   static void  check_gp_counters_write_width(void)
>   {
>   	u64 val_64 = 0xffffff0123456789ull;
> -	u64 val_32 = val_64 & ((1ul << 32) - 1);
> +	u64 val_32 = val_64 & ((1ull << 32) - 1);
>   	u64 val_max_width = val_64 & ((1ul << eax.split.bit_width) - 1);
>   	int i;
>   


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

* Re: [kvm-unit-tests PATCH] x86/pmu: Fix compilation on 32-bit hosts
  2020-06-16 11:13 ` Xu, Like
@ 2020-06-16 11:22   ` Thomas Huth
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2020-06-16 11:22 UTC (permalink / raw)
  To: like.xu, pbonzini, kvm; +Cc: like.xu, vkuznets

On 16/06/2020 13.13, Xu, Like wrote:
> On 2020/6/16 18:59, Thomas Huth wrote:
>> When building for 32-bit hosts, the compiler currently complains:
>>
>>   x86/pmu.c: In function 'check_gp_counters_write_width':
>>   x86/pmu.c:490:30: error: left shift count >= width of type
>>
>> Use the correct suffix to avoid this problem.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>
> Thanks, I admit I did not test it on a 32-bit host.

No problem, that's what the CI is good for :-)

(if you have a github or gitlab account, you can also run the tests
there before submitting a patch)

 Thomas


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

* Re: [kvm-unit-tests PATCH] x86/pmu: Fix compilation on 32-bit hosts
  2020-06-16 10:59 [kvm-unit-tests PATCH] x86/pmu: Fix compilation on 32-bit hosts Thomas Huth
  2020-06-16 11:13 ` Xu, Like
@ 2020-06-16 12:29 ` Paolo Bonzini
  1 sibling, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2020-06-16 12:29 UTC (permalink / raw)
  To: Thomas Huth, kvm; +Cc: like.xu, vkuznets

On 16/06/20 12:59, Thomas Huth wrote:
> When building for 32-bit hosts, the compiler currently complains:
> 
>  x86/pmu.c: In function 'check_gp_counters_write_width':
>  x86/pmu.c:490:30: error: left shift count >= width of type
> 
> Use the correct suffix to avoid this problem.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  x86/pmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/x86/pmu.c b/x86/pmu.c
> index 57a2b23..91a6fb4 100644
> --- a/x86/pmu.c
> +++ b/x86/pmu.c
> @@ -487,7 +487,7 @@ static void do_unsupported_width_counter_write(void *index)
>  static void  check_gp_counters_write_width(void)
>  {
>  	u64 val_64 = 0xffffff0123456789ull;
> -	u64 val_32 = val_64 & ((1ul << 32) - 1);
> +	u64 val_32 = val_64 & ((1ull << 32) - 1);
>  	u64 val_max_width = val_64 & ((1ul << eax.split.bit_width) - 1);
>  	int i;
>  
> 

Oh ok, applied.  Thanks,

Paolo


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

end of thread, other threads:[~2020-06-16 12:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16 10:59 [kvm-unit-tests PATCH] x86/pmu: Fix compilation on 32-bit hosts Thomas Huth
2020-06-16 11:13 ` Xu, Like
2020-06-16 11:22   ` Thomas Huth
2020-06-16 12:29 ` Paolo Bonzini

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.