On machines with many CPUs, reading all of /proc/cpuinfo spends a surprising
amount of time generating information for each CPU; reduce this time by reading
incrementally until we find the CPU frequency. On such machines, this saves
3-4ms on sentry startup.
PiperOrigin-RevId: 688609950
Linux prints this field when cache information is available. This field
is conditional (see arch/x86/kernel/cpu/proc.c:x86_cache_size()). It a
different meaning and implementation on each vendor. For example, as of
Linux 6.1.0 it returns LLC size on Intel and L2 size on AMD CPUs.
Even though usefullness of this field in its current implementation
debatable, some relatively popular software such as PyPy (as of 7.3.11)
relies on it and prints a warning if it is not available.
Linux prints these fields when the kernel is built with support for multiple
processors/cores (CONFIG_SMP), in
arch/x86/kernel/cpu/proc.c:show_cpuinfo_core().
Fixes#10205
PiperOrigin-RevId: 632621375
This allows for external information to be passed to restore code.
Similar to c087777e37 ("Plumb restore context to afterLoad()").
Updates #1956.
PiperOrigin-RevId: 614125262
SETREGSET/GETREGSET expect AMX portions of fpstate to always be used.
For this reason we need to allocate enough memory for this to happen,
even if we never populate the AMX portions within initX86FPState.
PiperOrigin-RevId: 599702181
For now we are going to completely disable using AMX, so we will
always subtract extended state size reserved from AMX from the rest
of the extended state size, and hardcode the AMX XCR0 bits to be
always off.
Fixes#9750.
PiperOrigin-RevId: 599302059
This block holds information about whether AMX is enabled or not,
which is important for CPUs that support it due to the fact that
the fpstate buffer becomes dynamically sized, and the cpuid value
reported for extended state size assumes that AMX is enabled for
any given process.
PiperOrigin-RevId: 598941137
It is an idea of running codespell as part of our presubmit checks.
Before enabling it for new changes, let's fix what it has found.
Signed-off-by: Andrei Vagin <avagin@gmail.com>
It is impossible to enable any features from user-space, so
it is no reason to return the maximum size with all features enabled.
The kvm and systrap platforms uses ExtendedStateSize to generate fpu states
that are restored via rt_sigreturn, but the kernel rejects frames with
incorrect sizes.
PiperOrigin-RevId: 537333319
This moves the initialization of `cpuid.hostFeatureSet` out of package-level
`init` and instead moves it to an explicit `cpuid.Initialize()` function.
On AMD64, this saves about 512KiB of heap memory that would otherwise always
be live.
PiperOrigin-RevId: 514896323
For all trivial and zero frame-sized functions, we now require an explicit
NOFRAME annotation as the heuristic has changed. See go.dev/cl/466316.
Most of these functions do not *require* NOFRAME, but this change encodes
the existing behavior in order to avoid accidental bugs or regressions.
PiperOrigin-RevId: 513946210