Skip to content

coproc/vecaccess/mxaccess/lxaccess: extend test suite and refactor#61

Open
zbelinsk wants to merge 1 commit into
masterfrom
extend-coproc-tests-and-refactor
Open

coproc/vecaccess/mxaccess/lxaccess: extend test suite and refactor#61
zbelinsk wants to merge 1 commit into
masterfrom
extend-coproc-tests-and-refactor

Conversation

@zbelinsk

Copy link
Copy Markdown
Contributor

Add comprehensive unit tests for mxaccess and lxaccess (previously untested), and replace the vecaccess smoke test with a full path-testing suite. All three tests share the same structure: unit_init with state verification, acquire/release/reuse bounded by a hardware-queried limit, a limit+1 blocking acquire via a second thread, double-release rejection, and a legacy-wrapper check. The tests derive the context limit by calling unit_init first (which latches the hardware style), then using h2_coproc_count() sign to mirror the impl's semaphore init logic for both oldstyle and newstyle hardware.

Refactors in the implementation:

  • h2_coproc_init: fix one-shot regression (re-report OLDSTYLE on every call once latched; set init_done only after the full unit loop succeeds); add h2_coproc_init_result_t enum replacing magic 0/1/-1
  • h2_coproc_set: replace per-call bit-scan with O(1) bitpos table lookup built at init time; remove redundant Q6_R_popcount_P call (use pre-computed counts[] array); remove dead bits local
  • h2_coproc: extract coproc_grow() helper, eliminating repeated realloc-assign-null-check pattern across init_entry_contexts and h2_coproc_init
  • h2_vecaccess/mxaccess/lxaccess release: add double-release guard (check active bit before releasing); fix idx passed to h2_coproc_set (was hardcoded 0); remove redundant h2_hwconfig_extbits call in vecaccess release
  • h2_vecaccess new-style branch: add missing HVX_64 case; align SILVER/SILVER_MAX sem init to use h2_coproc_count (was h2_info)
  • h2_vecaccess.h: add H2_VECACCESS_MAX_VLENGTH_BYTES replacing bare 128

Add comprehensive unit tests for mxaccess and lxaccess (previously
untested), and replace the vecaccess smoke test with a full path-testing
suite.  All three tests share the same structure: unit_init with state
verification, acquire/release/reuse bounded by a hardware-queried limit,
a limit+1 blocking acquire via a second thread, double-release rejection,
and a legacy-wrapper check.  The tests derive the context limit by calling
unit_init first (which latches the hardware style), then using
h2_coproc_count() sign to mirror the impl's semaphore init logic for both
oldstyle and newstyle hardware.

Refactors in the implementation:
- h2_coproc_init: fix one-shot regression (re-report OLDSTYLE on every
  call once latched; set init_done only after the full unit loop
  succeeds); add h2_coproc_init_result_t enum replacing magic 0/1/-1
- h2_coproc_set: replace per-call bit-scan with O(1) bitpos table lookup
  built at init time; remove redundant Q6_R_popcount_P call (use
  pre-computed counts[] array); remove dead `bits` local
- h2_coproc: extract coproc_grow() helper, eliminating repeated
  realloc-assign-null-check pattern across init_entry_contexts and
  h2_coproc_init
- h2_vecaccess/mxaccess/lxaccess release: add double-release guard
  (check active bit before releasing); fix idx passed to h2_coproc_set
  (was hardcoded 0); remove redundant h2_hwconfig_extbits call in
  vecaccess release
- h2_vecaccess new-style branch: add missing HVX_64 case; align
  SILVER/SILVER_MAX sem init to use h2_coproc_count (was h2_info)
- h2_vecaccess.h: add H2_VECACCESS_MAX_VLENGTH_BYTES replacing bare 128

Signed-off-by: Zeev Belinsky <zbelinsk@qti.qualcomm.com>
@github-actions github-actions Bot added the untested Mark untested PRs label Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

untested Mark untested PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant