diff mbox series

[kvm-unit-tests,v7,04/18] x86: pmu: Align fields in pmu_counter_t to better pack the struct

Message ID 20250215013636.1214612-5-seanjc@google.com (mailing list archive)
State New
Headers show
Series x86/pmu: Fixes and improvements | expand

Commit Message

Sean Christopherson Feb. 15, 2025, 1:36 a.m. UTC
From: Dapeng Mi <dapeng1.mi@linux.intel.com>

Hoist "idx" up in the pmu_counter_t structure so that the structure is
naturally packed for 64-bit builds.

Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Link: https://lore.kernel.org/r/20240914101728.33148-5-dapeng1.mi@linux.intel.com
[sean: rewrite changelog]
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 x86/pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mi, Dapeng Feb. 19, 2025, 1:34 a.m. UTC | #1
On 2/15/2025 9:36 AM, Sean Christopherson wrote:
> From: Dapeng Mi <dapeng1.mi@linux.intel.com>
>
> Hoist "idx" up in the pmu_counter_t structure so that the structure is
> naturally packed for 64-bit builds.
>
> Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
> Link: https://lore.kernel.org/r/20240914101728.33148-5-dapeng1.mi@linux.intel.com
> [sean: rewrite changelog]
> Signed-off-by: Sean Christopherson <seanjc@google.com>

Thanks for root causing the issue and rewriting the change log.


> ---
>  x86/pmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/x86/pmu.c b/x86/pmu.c
> index 60db8bdf..a0268db8 100644
> --- a/x86/pmu.c
> +++ b/x86/pmu.c
> @@ -21,9 +21,9 @@
>  
>  typedef struct {
>  	uint32_t ctr;
> +	uint32_t idx;
>  	uint64_t config;
>  	uint64_t count;
> -	int idx;
>  } pmu_counter_t;
>  
>  struct pmu_event {
diff mbox series

Patch

diff --git a/x86/pmu.c b/x86/pmu.c
index 60db8bdf..a0268db8 100644
--- a/x86/pmu.c
+++ b/x86/pmu.c
@@ -21,9 +21,9 @@ 
 
 typedef struct {
 	uint32_t ctr;
+	uint32_t idx;
 	uint64_t config;
 	uint64_t count;
-	int idx;
 } pmu_counter_t;
 
 struct pmu_event {