Skip to content

Conversation

@zhangyu-duck
Copy link

@zhangyu-duck zhangyu-duck commented Jan 14, 2026

Summary
Optimize tricore arch task switching process, now most other archs have already implemented task switching optimizations, such as:

Directly using tcb->xcp.regs instead of up_current_regs to determine whether to switch tasks.

Removing interfaces like up_set_current_regs/up_current_regs.

Inlining up_switch_context, etc.

For ARM implementation references:

03af486

4972a8e

Impact
The logic during doirq.c and svcall.c for determining whether a task needs to be switched has changed;
The interrupt flag interface has changed.

Testing
Run ostest multiple times and observe whether the task switch is normal.

The main test items in ostest:
task create/exit/restart.
semaphore wait/post test
message queue test
signal process test
wdog test
...

ostest log:apache-tricore-ostest.txt

xianglyc and others added 6 commits January 14, 2026 20:44
…he CSA.

In the exception panic process, regs needs to use a memory address, which defaults to PCXI. Here, it is uniformly saved as the actual memory address.

Signed-off-by: liwenxiang1 <[email protected]>
fix type error and add up_getusrpc()

Signed-off-by: liwenxiang1 <[email protected]>
g_current_regs is only used to determine if we are in irq, with other functionalities removed.

Signed-off-by: zhangyu117 <[email protected]>
add g_interrupt_context to to identify interruption context

Signed-off-by: zhangyu117 <[email protected]>
inline up_switch_context, avoid function call burden.

Signed-off-by: zhangyu117 <[email protected]>
…0 para

after task switch optimization, we can just use g_running_tasks and this_task() without pass params

Signed-off-by: zhangyu117 <[email protected]>
@github-actions github-actions bot added Area: Tooling Arch: tricore Issues related to the TriCore architecture from Infineon Size: M The size of the change in this PR is medium labels Jan 14, 2026
@wangchdo
Copy link
Contributor

wangchdo commented Jan 14, 2026

Great work!
However, could you please provide an ostest results log on a tricore arch platform?

@zhangyu-duck
Copy link
Author

Great work! However, could you please provide an ostest results log on a tricore arch platform?

hello, ostest log: https://github.com/user-attachments/files/24630850/apache-tricore-ostest.txt

@xiaoxiang781216 xiaoxiang781216 merged commit 8786c81 into apache:master Jan 15, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: tricore Issues related to the TriCore architecture from Infineon Area: Tooling Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants