Port-amd64 archive

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

Re: AVX support



Le 12/08/2016 à 18:22, Erik Fair a écrit :
Has AVX support in NetBSD (context switching) been revisited yet?

According to https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#Operating_system_support we’re even later than FreeBSD and OpenBSD.

	curious,

	Erik <fair%netbsd.org@localhost>


I did check for that two or three weeks ago, and as far as I can tell, NetBSD
supports AVX-256 and AVX-512 (contrary to the other BSDs).

When context-switching, the fpu is saved, and the AVX states are part of this
since they are explicitly enabled in XCR0 [1]. By the way, there are already
definitions for the AVX structures in the XSAVE area [2] (which are never used
since they don't need to be).

One huge problem that struck me was that the fpu state is placed in the kernel
stack, which means we lose ~2500 bytes of stack. With the latest MPX states and
the future extensions, we will lose even more memory. The priority is moving the
fpu out of the pcb. We could give a look at FreeBSD [3], since their pcb only
has a pointer to a dynamically-allocated area.

Then, there may be a few things to investigate or fix; but the support is mostly
here. Note however that our Xen implementation does not support xsave, and
therefore, does not support SSE and AVX.

The real problem is that nothing is documented.

[1] https://nxr.netbsd.org/xref/src/sys/arch/x86/include/specialreg.h#112
[2] https://nxr.netbsd.org/xref/src/sys/arch/x86/include/cpu_extended_state.h#125
[3] http://bxr.su/FreeBSD/sys/amd64/include/pcb.h#105


Home | Main Index | Thread Index | Old Index