Re: [PATCH] selftests: x86: skip the tests if prerequisites aren't fulfilled
From: Muhammad Usama Anjum
Date: Tue Mar 12 2024 - 05:26:14 EST
On 3/11/24 10:39 PM, Chang S. Bae wrote:
> On 3/11/2024 10:02 AM, Muhammad Usama Anjum wrote:
>> On 3/9/24 6:06 AM, Chang S. Bae wrote:
>>> On 3/7/2024 10:37 AM, Muhammad Usama Anjum wrote:
>>>
>>>> -static void check_cpuid_xtiledata(void)
>>>> +static int check_cpuid_xtiledata(void)
>>>> {
>>>> uint32_t eax, ebx, ecx, edx;
>>>> @@ -153,12 +160,16 @@ static void check_cpuid_xtiledata(void)
>>>> * eax: XTILEDATA state component size
>>>> * ebx: XTILEDATA state component offset in user buffer
>>>> */
>>>> - if (!eax || !ebx)
>>>> - fatal_error("xstate cpuid: invalid tile data size/offset: %d/%d",
>>>> - eax, ebx);
>>>> + if (!eax || !ebx) {
>>>> + ksft_print_msg("xstate cpuid: invalid tile data size/offset:
>>>> %d/%d\n",
>>>> + eax, ebx);
>>>> + return -1;
>>>> + }
>>>> xtiledata.size = eax;
>>>> xtiledata.xbuf_offset = ebx;
>>>> +
>>>> + return 0;
>>>> }
>>>
>>> I don't think it is okay to silently skip the test here. If the feature is
>>> available, the tile data size and offset should not be zero.
>> We are logging that data size/offset are invalid if either eax or ebx are
>> invalid and then we are skipping. Not sure what you are asking me to change.
>
> You intention seems to skip the test when AMX is not available.
Yes,
> But this
> function should only be invoked when AMX is actually available, not as part
> of the feature availability check.
How can we check if AMX is available or not?
> Therefore, I think this change is not
> relevant. Also, if we encounter invalid TILEDATA CPUID, it should be a
> reason to *fail* the test, rather than calling out a skip, right?
I see. But once we check if AMX is available.
>
> Thanks,
> Chang
>
--
BR,
Muhammad Usama Anjum