> > Hi Bruce, > > Why x86/rte_cpuflags.c is not using rte_getauxval() ? > > I don't see any such DPDK function, unless I'm missing something? I do see a > linux function which includes hw capability flags. I suspect the reasons we > don't use that are: > > 1. Lack of awareness of it (at least on my end! :-)) 2. Originally when we > added > flags for new instruction sets we may have > needed to support their detection on platforms where the kernel/libc was > too old to be aware of them. > 3. It's linux only, so we'd still need these cpuid calls for other OS's > anyway. > > Therefore, I don't see any benefit in using that function over what we do now. > Is there some benefit that you see that makes you think it would be > worthwhile switching? >
Agree, all these are good reasons to avoid it. getauxval() reads these values from process stack (ELF loader places it there), so it's a relatively fast way of finding cpu features. I'm wondering if a similar mechanism is available in FreeBSD and Windows. If so, it might be beneficial to have a common API for such functions. But as you mentioned, if the kernel isn't aware of the feature it may fail.