Skip to content

benchmark fpu cleanup - #12098

Merged
douzzer merged 3 commits into
wolfSSL:masterfrom
philljj:bench-fpu-cleanup
Nov 12, 2026
Merged

douzzer merged 3 commits into
wolfSSL:masterfrom
philljj:bench-fpu-cleanup

Conversation

@philljj

@philljj philljj commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Description

Some fpu cleanup in wolfcrypt benchmark.c:

  • bench_dh: added missing save / restore vector register calls.
  • bench_eccEncryptEx: fixed err handling to not jump past restore vector register calls.
  • removed LINUXKM dead code blocks with bare kernel_fpu_begin(), kernel_fpu_end() calls.

The LINUXKM blocks were unreachable because linuxkm/linuxkm_wc_port.h always defined WOLFSSL_USE_SAVE_VECTOR_REGISTERS if WOLFSSL_LINUXKM_BENCHMARKS.

note: discovered when testing on FreeBSD 16.0.

fixes: zd22741.

Testing

  • linuxkm-benchmarks-allintelasm-insmod, linuxkm-benchmarks-noasm-insmod
  • freebsd 14.3-RELEASE
  • freebsd 16.0-CURRENT

multi-test: all-gcc-c89, c89-clang-tidy, wolfssl-all, etc.

@philljj philljj self-assigned this Nov 11, 2026
Copilot AI balanced review requested due to automatic review settings November 11, 2026 18:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Active error-path defects can cause FPU use without acquiring vector registers and an unmatched restore, or allow decryption to proceed with uninitialized ciphertext after encryption fails.

2 open issues
What changed in this PR

This PR cleans up floating-point and vector-register handling in wolfCrypt benchmarks, targeting kernel-build issues found during FreeBSD testing.

Changes:

  • Adds save/restore calls around DH peer-key generation.
  • Routes ECIES errors through statistics finishers so vector registers are restored.
  • Removes unreachable Linux-specific FPU handling in favor of the shared save/restore mechanism.
File Description
wolfcrypt/​benchmark/​benchmark.c Updates DH and ECIES register handling and removes redundant Linux FPU branches.

Review effort: Balanced

Comment thread wolfcrypt/benchmark/benchmark.c Resolved
Comment thread wolfcrypt/benchmark/benchmark.c Resolved
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

gcc-arm-cortex-m0plus

  • FLASH: .text +56 B (+0.1%, 71,195 B / 262,144 B, total: 27% used)

gcc-arm-cortex-m3

  • FLASH: .text +44 B (+0.0%, 132,229 B / 262,144 B, total: 50% used)

gcc-arm-cortex-m4

  • FLASH: .text +64 B (+0.0%, 209,548 B / 262,144 B, total: 80% used)

gcc-arm-cortex-m4-baremetal

  • FLASH: .text +64 B (+0.1%, 73,975 B / 262,144 B, total: 28% used)

gcc-arm-cortex-m4-crypto-only

  • FLASH: .text +64 B (+0.0%, 182,291 B / 262,144 B, total: 70% used)

gcc-arm-cortex-m4-min-ecc

  • FLASH: .text +64 B (+0.1%, 68,441 B / 262,144 B, total: 26% used)

gcc-arm-cortex-m4-openssl-compat

  • FLASH: .text -128 B (-0.0%, 802,116 B / 1,048,576 B, total: 76% used)

gcc-arm-cortex-m4-pq

  • FLASH: .text +64 B (+0.0%, 313,424 B / 1,048,576 B, total: 30% used)

gcc-arm-cortex-m4-rsa-only

  • FLASH: .text +64 B (+0.0%, 343,952 B / 1,048,576 B, total: 33% used)

gcc-arm-cortex-m4-sp-math

  • FLASH: .text +64 B (+0.1%, 68,441 B / 262,144 B, total: 26% used)

gcc-arm-cortex-m4-tls12

  • FLASH: .text +64 B (+0.0%, 133,009 B / 262,144 B, total: 51% used)

gcc-arm-cortex-m4-tls13

  • FLASH: .text +64 B (+0.0%, 250,146 B / 262,144 B, total: 95% used)

gcc-arm-cortex-m7

  • FLASH: .text +64 B (+0.0%, 209,548 B / 262,144 B, total: 80% used)

gcc-arm-cortex-m7-tls13

  • FLASH: .text +64 B (+0.0%, 250,146 B / 262,144 B, total: 95% used)

stm32-sim-stm32h753

  • FLASH: .text +440 B (+0.2%, 204,908 B / 2,097,152 B, total: 10% used)

zephyr-frdm_rw612

  • FLASH: text +1,152 B (+0.4%, 294,204 B / 67,108,864 B, total: 0% used)

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #12098

Scan targets checked: wolfssl-pr-general
Review type: general (no scan target covers the changed files)
Coverage: 1 of 1 in-scope changed file(s) opened by the reviewer

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Max

@philljj

philljj commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

Retest this please.

(PRB fips test failure, not clear)

@philljj philljj assigned wolfSSL-Bot and unassigned philljj Nov 11, 2026

@douzzer douzzer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested with

wolfssl-multi-test.sh ...
linuxkm-benchmarks-allintelasm-insmod
linuxkm-benchmarks-insmod-ksanitize
linuxkm-benchmarks-noasm-insmod
linuxkm-benchmarks-allintelasm-fips-insmod
linuxkm-benchmarks-allintelasm-insmod-kmemleak

@douzzer
douzzer merged commit e040af9 into wolfSSL:master Nov 12, 2026
432 checks passed
@philljj
philljj deleted the bench-fpu-cleanup branch November 12, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants