Re: [PATCH] selftests: x86: skip the tests if prerequisites aren't fulfilled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Chang,

On 3/12/24 9:07 PM, Chang S. Bae wrote:
> On 3/12/2024 2:26 AM, Muhammad Usama Anjum wrote:
>>
>> How can we check if AMX is available or not?
> 
> After a successful check_cpuid_xsave(), examining CPUID(eax=0xd, ecx=0)
> EDX: EAX, which reports the support bits of XCR0, can give assurance of AMX
> availability. Perhaps, this change is considerable on top of your patch:
> 
> static int check_cpuid_xtiledata(void)
> {
>         uint32_t eax, ebx, ecx, edx;
> +       uint64_t xfeatures;
> 
>         __cpuid_count(CPUID_LEAF_XSTATE, CPUID_SUBLEAF_XSTATE_USER,
>                       eax, ebx, ecx, edx);
> 
> +       xfeatures = eax + ((uint64_t)edx << 32);
> +       if ((xfeatures & XFEATURE_MASK_XTILE) != XFEATURE_MASK_XTILE) {
> +               ksft_print_msg("no AMX support\n");
> +               return -1;
> +       }
Now I understand. I'll use this snippet to skip the test and fail the test
if eax and ebx are zero. Sorry, I've lesser knowledge on the x86's
extensions side. I'll build up the knowledge.

> 
> Nevertheless, I still believe that using arch_prctl(ARCH_GET_XCOMP_SUPP,
> ..) remains a simple and legitimate approach for directly checking dynamic
> feature support from the kernel: https://docs.kernel.org/arch/x86/xstate.html
I'll use arch_prtcl in another patch on top of the current patch in v2.

> 
> Thanks,
> Chang
> 

-- 
BR,
Muhammad Usama Anjum




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux