[PATCH] tools/perf/tests/expr: Make the system_tsc_freq test only for intel
Athira Rajeev
atrajeev at linux.vnet.ibm.com
Fri Dec 6 04:00:32 AEDT 2024
> On 3 Dec 2024, at 11:46 PM, Namhyung Kim <namhyung at kernel.org> wrote:
>
> Hello,
>
> On Fri, Nov 08, 2024 at 10:50:10AM +0530, Athira Rajeev wrote:
>>
>>
>>> On 7 Nov 2024, at 7:26 PM, Leo Yan <leo.yan at arm.com> wrote:
>>>
>>> Hi Athira,
>>>
>>> On Wed, Nov 06, 2024 at 03:04:57PM +0530, Athira Rajeev wrote:
>>>
>>> [...]
>>>
>>>>> Hi Athira,
>>>>>
>>>>> sorry for the breakage and thank you for the detailed explanation. As
>>>>> the code will run on AMD I think your change will break that - . It is
>>>>> probably safest to keep the ".. else { .." for this case but guard it
>>>>> in the ifdef.
>>>>>
>>>>
>>>> Hi Ian
>>>>
>>>> Thanks for your comments. Does the below change looks good ?
>>>>
>>>> diff --git a/tools/perf/tests/expr.c b/tools/perf/tests/expr.c
>>>> index e3aa9d4fcf3a..f5b2d96bb59b 100644
>>>> --- a/tools/perf/tests/expr.c
>>>> +++ b/tools/perf/tests/expr.c
>>>> @@ -74,14 +74,12 @@ static int test__expr(struct test_suite *t __maybe_unused, int subtest __maybe_u
>>>> double val, num_cpus_online, num_cpus, num_cores, num_dies, num_packages;
>>>> int ret;
>>>> struct expr_parse_ctx *ctx;
>>>> - bool is_intel = false;
>>>> char strcmp_cpuid_buf[256];
>>>> struct perf_pmu *pmu = perf_pmus__find_core_pmu();
>>>> char *cpuid = perf_pmu__getcpuid(pmu);
>>>> char *escaped_cpuid1, *escaped_cpuid2;
>>>>
>>>> TEST_ASSERT_VAL("get_cpuid", cpuid);
>>>> - is_intel = strstr(cpuid, "Intel") != NULL;
>>>>
>>>> TEST_ASSERT_EQUAL("ids_union", test_ids_union(), 0);
>>>>
>>>> @@ -244,11 +242,13 @@ static int test__expr(struct test_suite *t __maybe_unused, int subtest __maybe_u
>>>> if (num_dies) // Some platforms do not have CPU die support, for example s390
>>>> TEST_ASSERT_VAL("#num_dies >= #num_packages", num_dies >= num_packages);
>>>>
>>>> +#if defined(__i386__) && defined(__x86_64__)
>>>> TEST_ASSERT_VAL("#system_tsc_freq", expr__parse(&val, ctx, "#system_tsc_freq") == 0);
>>>> - if (is_intel)
>>>> + if (strstr(cpuid, "Intel") != NULL)
>>>> TEST_ASSERT_VAL("#system_tsc_freq > 0", val > 0);
>>>> else
>>>> TEST_ASSERT_VAL("#system_tsc_freq == 0", fpclassify(val) == FP_ZERO);
>>>> +#endif
>>>>
>>>> /*
>>>> * Source count returns the number of events aggregating in a leader
>>>
>>> I confirmed the change above fixes the failure on Arm64.
>>>
>>> Tested-by: Leo Yan <leo.yan at arm.com>
>> Thanks Leo Yan for testing.
>>
>> Hi Ian,
>>
>> If the change above looks good, I will post a V2 . Please share your review comments
>
> Sorry for the delay, it looks good to me. Can you please send the v2?
Hi Namhyung
Thanks for checking on this.
I will test with the latest version sent by Ian and respond with the results soon
Thanks
Athira Rajeev
>
> Thanks,
> Namhyung
More information about the Linuxppc-dev
mailing list