Re: [PATCH 2/8] um: Check for missing AVX and AVX-512 xstate bits

David Laight <[email protected]>
Newsgroups gmane.linux.kernel.cryptoapi,gmane.linux.uml.devel,gmane.linux.raid,gmane.linux.kernel
Message-ID <20260626223331.3451c11b@pumpkin>
On Fri, 26 Jun 2026 20:55:44 +0000
Eric Biggers <[email protected]> wrote:

> On Fri, Jun 26, 2026 at 11:49:57AM +0100, David Laight wrote:
> > > UML is just another userland application from this perspective, so
> > > there is no reason for it to behave any different from the rest of
> > > the userland.  
> 
> Which is why it should do the XCR0 check that the vast majority of
> userspace programs do, right?  It has always been part of the documented
> way to detect AVX and AVX-512 support.

That and looking at the other 'cpuid' registers rather than reading
/proc/cpuinfo.
If you want to run 'um' on (say) NetBSD you'd need to do it differently.

> (I think this helps explain why LLMs notice this too.  They've been
> trained on lots of code that does it correctly.)
> 
> That being said, it does seem likely that it's basically obsolete now.
> So maybe we could take a shortcut and omit it.

It would need the linux kernel to report a cpu feature that needed
kernel support, but that the kernel didn't support.

But for things like popcnt um should probably check the relevant cpuid bit
rather than scanning /proc/cpuinfo.

> 
> The important thing is really that we make a definitive decision *once*
> for each of UML and native x86.  The status quo is that the decision is
> instead punted to every individual AVX optimized function in the kernel,
> which isn't working well.

Indeed.

	David

> 
> - Eric
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.