Skip to content

Dropped the SMP Linux port memory sync test coverage macro - #844

Open
Dev10-sys wants to merge 1 commit into
eclipse-threadx:devfrom
Dev10-sys:fix/smp-core-wait-coverage-hook
Open

Dev10-sys wants to merge 1 commit into
eclipse-threadx:devfrom
Dev10-sys:fix/smp-core-wait-coverage-hook

Conversation

@Dev10-sys

Copy link
Copy Markdown

In _tx_initialize_kernel_enter, the kernel waits for secondary cores to complete initialization by checking _tx_thread_system_state[1 .. TX_THREAD_SMP_MAX_CORES-1]. On the Linux SMP simulator port, these slots are cleared on core 0 by TX_PORT_SPECIFIC_PRE_SCHEDULER_INITIALIZATION just before the loop starts. Because there are no secondary hardware boot cores in this simulator, the loop condition evaluates to false on the first pass and the loop-back branch is never taken.

To show both outcomes of the loop branch in test coverage reports, ports_smp/linux/gnu/inc/tx_port.h defined TX_PORT_SPECIFIC_MEMORY_SYNCHRONIZATION under TX_REGRESSION_TEST to fold core 0's own system state into the accumulator and reset it. This artificially forced a second pass through the loop, masking the fact that the port does not actually exercise that wait path.

This change removes the TX_PORT_SPECIFIC_MEMORY_SYNCHRONIZATION macro from the regression test block in ports_smp/linux/gnu/inc/tx_port.h. The macro now falls back to its default empty definition in common_smp/inc/tx_api.h. Full line coverage is maintained across tx_initialize_kernel_enter.c, the coverage report truthfully reflects that the loop-back branch is not taken on this simulated port, and all 118 SMP regression tests pass cleanly.

Fixes #768

In _tx_initialize_kernel_enter (common_smp/src/tx_initialize_kernel_enter.c),
the kernel waits for secondary cores to become ready with a loop:
do { ... } while (other_core_status != ((ULONG) 0));

On the SMP Linux port, virtual cores are simulated rather than backed by hardware
secondary cores. TX_PORT_SPECIFIC_PRE_SCHEDULER_INITIALIZATION (tx_port.h:427)
zeroes _tx_thread_system_state[1 .. TX_THREAD_SMP_MAX_CORES-1] on core 0 before
the loop begins, causing the loop condition to evaluate to false on the first
pass.

To force both outcomes of the loop-back branch in coverage reports, the port's
TX_REGRESSION_TEST block defined TX_PORT_SPECIFIC_MEMORY_SYNCHRONIZATION to fold
core 0's own _tx_thread_system_state[0] into other_core_status and clear it. This
artificially forced a second loop pass, misrepresenting the loop-back branch as
covered when the port cannot exercise it.

Dropped the TX_PORT_SPECIFIC_MEMORY_SYNCHRONIZATION macro from the
TX_REGRESSION_TEST block in ports_smp/linux/gnu/inc/tx_port.h, falling back to
its default empty definition in common_smp/inc/tx_api.h. Line 167 remains 100%
line-covered while the coverage report accurately reflects that the loop-back
edge is unreached on this simulated port.

Verified with the full SMP regression suite: all 118 ctest cases pass cleanly.

Fixes: eclipse-threadx#768
Signed-off-by: Dev10-sys <kalpanagola9897@gmail.com>

This branch has not been deployed

No deployments
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.

1 participant