diff mbox series

[kvm-unit-tests,v3,01/11] x86: pmu: Remove duplicate code in pmu_init()

Message ID 20240103031409.2504051-2-dapeng1.mi@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series pmu test bugs fix and improvements | expand

Commit Message

Mi, Dapeng Jan. 3, 2024, 3:13 a.m. UTC
From: Xiong Zhang <xiong.y.zhang@intel.com>

There are totally same code in pmu_init() helper, remove the duplicate
code.

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
---
 lib/x86/pmu.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Yang, Weijiang March 28, 2024, 1:19 a.m. UTC | #1
On 1/3/2024 11:13 AM, Dapeng Mi wrote:
> From: Xiong Zhang <xiong.y.zhang@intel.com>
>
> There are totally same code in pmu_init() helper, remove the duplicate
> code.
>
> Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>

Jim has already added RB tag for this patch in v2, you may add it here.

> ---
>   lib/x86/pmu.c | 5 -----
>   1 file changed, 5 deletions(-)
>
> diff --git a/lib/x86/pmu.c b/lib/x86/pmu.c
> index 0f2afd650bc9..d06e94553024 100644
> --- a/lib/x86/pmu.c
> +++ b/lib/x86/pmu.c
> @@ -16,11 +16,6 @@ void pmu_init(void)
>   			pmu.fixed_counter_width = (cpuid_10.d >> 5) & 0xff;
>   		}
>   
> -		if (pmu.version > 1) {
> -			pmu.nr_fixed_counters = cpuid_10.d & 0x1f;
> -			pmu.fixed_counter_width = (cpuid_10.d >> 5) & 0xff;
> -		}
> -
>   		pmu.nr_gp_counters = (cpuid_10.a >> 8) & 0xff;
>   		pmu.gp_counter_width = (cpuid_10.a >> 16) & 0xff;
>   		pmu.gp_counter_mask_length = (cpuid_10.a >> 24) & 0xff;
Mi, Dapeng March 28, 2024, 1:21 a.m. UTC | #2
On 3/28/2024 9:19 AM, Yang, Weijiang wrote:
> On 1/3/2024 11:13 AM, Dapeng Mi wrote:
>> From: Xiong Zhang <xiong.y.zhang@intel.com>
>>
>> There are totally same code in pmu_init() helper, remove the duplicate
>> code.
>>
>> Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
>> Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
>
> Jim has already added RB tag for this patch in v2, you may add it here.

Oh, missed it. Thanks for reminding.

>
>> ---
>>   lib/x86/pmu.c | 5 -----
>>   1 file changed, 5 deletions(-)
>>
>> diff --git a/lib/x86/pmu.c b/lib/x86/pmu.c
>> index 0f2afd650bc9..d06e94553024 100644
>> --- a/lib/x86/pmu.c
>> +++ b/lib/x86/pmu.c
>> @@ -16,11 +16,6 @@ void pmu_init(void)
>>               pmu.fixed_counter_width = (cpuid_10.d >> 5) & 0xff;
>>           }
>>   -        if (pmu.version > 1) {
>> -            pmu.nr_fixed_counters = cpuid_10.d & 0x1f;
>> -            pmu.fixed_counter_width = (cpuid_10.d >> 5) & 0xff;
>> -        }
>> -
>>           pmu.nr_gp_counters = (cpuid_10.a >> 8) & 0xff;
>>           pmu.gp_counter_width = (cpuid_10.a >> 16) & 0xff;
>>           pmu.gp_counter_mask_length = (cpuid_10.a >> 24) & 0xff;
>
diff mbox series

Patch

diff --git a/lib/x86/pmu.c b/lib/x86/pmu.c
index 0f2afd650bc9..d06e94553024 100644
--- a/lib/x86/pmu.c
+++ b/lib/x86/pmu.c
@@ -16,11 +16,6 @@  void pmu_init(void)
 			pmu.fixed_counter_width = (cpuid_10.d >> 5) & 0xff;
 		}
 
-		if (pmu.version > 1) {
-			pmu.nr_fixed_counters = cpuid_10.d & 0x1f;
-			pmu.fixed_counter_width = (cpuid_10.d >> 5) & 0xff;
-		}
-
 		pmu.nr_gp_counters = (cpuid_10.a >> 8) & 0xff;
 		pmu.gp_counter_width = (cpuid_10.a >> 16) & 0xff;
 		pmu.gp_counter_mask_length = (cpuid_10.a >> 24) & 0xff;