20260821-linuxkm-WC_SVR_USE_NATIVE_REG_BUFS - #11240
Open
douzzer wants to merge 3 commits into
Open
Conversation
…er-CPU
native vector register save buffers, serving hardirq and softirq contexts
where kernel_fpu_begin() is unusable.
previously these contexts were refused (WC_ACCEL_INHIBIT_E): hardirq
outright, softirq whenever !may_use_simd() (pre-6.15, a softirq
interrupting a foreign kernel_fpu section). an exact save/compute/restore
cycle is invisible to the interrupted context and to kernel FPU
bookkeeping, and run-to-completion freezes the blocking condition beneath
the section, so both classes are natively serviceable.
- per-CPU {softirq, hardirq} state, each {depth, pin_preempt, save_area};
xsave64/xrstor64 with RFBM 0xe7 & XCR0 (fxsave64 fallback), plain XSAVE
only; feature detection by direct CPUID/XGETBV, independent of kernel
cpufeature machinery.
- recursion is a per-(CPU, class) depth count -- save on the 0->1 edge,
restore on 1->0; softirq sections hold preempt_disable() (load-bearing
on PREEMPT_RT).
- hardirq serves plain saves; softirq serves plain and _MAYBE_INHIBIT
(its legacy short-circuit is bypassed when native is ready); _INHIBIT,
hardirq _MAYBE, and NMI keep refusal semantics; task context is
untouched.
- wc_svr_native_init() activates in place from
wc_linuxkm_allocate_svr_states() in any context but NMI -- the FIPS
pre-Init lazy allocation arrives inside the outermost save's own
bracket, and wolfCrypt_Init() has been observed with irqs disabled. a
self-bracketed register round-trip selftest gates wc_svr_native_ready;
on any failure the long-standing refusal semantics remain fully in
force.
- wc_linuxkm_svr_native_is_ready(): runtime readiness accessor for policy
decisions elsewhere (e.g. the FIPS<v7 default-bank NO_VECTOR_OPS pin).
- WOLFSSL_LINUXKM_VERBOSE_DEBUG: split the softirq WC_ACCEL_INHIBIT_E
counter into per-class counters (softirq, hardirq, NMI, other),
reported at module shutdown.
in non-VERBOSE builds with WC_SVR_DONT_USE_NATIVE_REG_BUFS (or in non-SVR
builds), generated object code is byte-identical to the previous revision.
|
Contributor
Author
|
retest this please |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
linuxkm/x86_vector_register_glue.c: addWC_SVR_USE_NATIVE_REG_BUFS: per-CPUnative vector register save buffers, serving hardirq and softirq contexts
where
kernel_fpu_begin()is unusable.previously these contexts were refused (
WC_ACCEL_INHIBIT_E): hardirqoutright, softirq whenever !
may_use_simd()(pre-6.15, a softirqinterrupting a foreign kernel_fpu section). an exact save/compute/restore
cycle is invisible to the interrupted context and to kernel FPU
bookkeeping, and run-to-completion freezes the blocking condition beneath
the section, so both classes are natively serviceable.
per-CPU {softirq, hardirq} state, each {depth, pin_preempt, save_area};
xsave64/xrstor64 with RFBM 0xe7 & XCR0 (fxsave64 fallback), plain XSAVE
only; feature detection by direct CPUID/XGETBV, independent of kernel
cpufeature machinery.
recursion is a per-(CPU, class) depth count -- save on the 0->1 edge,
restore on 1->0; softirq sections hold
preempt_disable()(load-bearingon
PREEMPT_RT).hardirq serves plain saves; softirq serves plain and _
MAYBE_INHIBIT(its legacy short-circuit is bypassed when native is ready); _INHIBIT,
hardirq _MAYBE, and NMI keep refusal semantics; task context is
untouched.
wc_svr_native_init()activates in place fromwc_linuxkm_allocate_svr_states()in any context but NMI -- the FIPSpre-Init lazy allocation arrives inside the outermost save's own
bracket, and
wolfCrypt_Init()has been observed with irqs disabled. aself-bracketed register round-trip selftest gates wc_svr_native_ready;
on any failure the long-standing refusal semantics remain fully in
force.
wc_linuxkm_svr_native_is_ready(): runtime readiness accessor for policydecisions elsewhere (e.g. the FIPS<v7 default-bank
NO_VECTOR_OPSpin).WOLFSSL_LINUXKM_VERBOSE_DEBUG: split the softirqWC_ACCEL_INHIBIT_Ecounter into per-class counters (softirq, hardirq, NMI, other),
reported at module shutdown.
in non-VERBOSE builds with
WC_SVR_DONT_USE_NATIVE_REG_BUFS(or in non-SVRbuilds), generated object code is byte-identical to the previous revision.
also add
linuxkm/simd_hammer/, a stress testing tool for kernel FPU/SIMD context handling.tested with