Skip to content

Conversation

@JordanYates
Copy link
Contributor

Remove mutex locking in favour of the standard IRQ locking mechanism. The primary problem with the mutex implementation is that mutex locking is forbidden in ISR's. This means that any logging from an interrupt context (e.g. LOG_PANIC in an exception handler), will itself trigger another assertion due its attempt to use a mutex.

Furthermore, mutexes are a relatively heavyweight locking scheme, which doesn't necessarily make sense in the context of extremely short locking periods that would be expected from RTT.

This change aligns Zephyr with the default RTT locking scheme, which uses interrupt masking to perform access control.

Resolves #79403.

@zephyrbot
Copy link

zephyrbot commented Oct 4, 2024

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff
segger zephyrproject-rtos/segger@b011c45 zephyrproject-rtos/segger@798f95e (master) zephyrproject-rtos/[email protected]

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@JordanYates JordanYates force-pushed the 241004_rtt_locking branch 2 times, most recently from e0b9343 to fa5a9f4 Compare October 4, 2024 03:52
@zephyrbot zephyrbot added the DNM This PR should not be merged (Do Not Merge) label Oct 4, 2024
@zephyrbot zephyrbot added the area: UART Universal Asynchronous Receiver-Transmitter label Oct 4, 2024
@zephyrbot zephyrbot requested a review from dcpleung October 4, 2024 06:54
dcpleung
dcpleung previously approved these changes Oct 4, 2024
Copy link
Member

Choose a reason for hiding this comment

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

Is this mutex instance still used?

nordic-krch
nordic-krch previously approved these changes Oct 8, 2024
Remove mutex locking in favour of the standard IRQ locking mechanism.
The primary problem with the mutex implementation is that mutex locking
is forbidden in ISR's. This means that any logging from an interrupt
context (e.g. LOG_PANIC in an exception handler), will itself trigger
another assertion due its attempt to use a mutex.

Furthermore, mutexes are a relatively heavyweight locking scheme, which
doesn't necessarily make sense in the context of extremely short locking
periods that would be expected from RTT.

This change aligns Zephyr with the default RTT locking scheme, which
uses interrupt masking to perform access control.

Resolves zephyrproject-rtos#79403.

Signed-off-by: Jordan Yates <[email protected]>
@JordanYates
Copy link
Contributor Author

Updated with final SHA

@zephyrbot zephyrbot removed the DNM This PR should not be merged (Do Not Merge) label Oct 8, 2024
@mmahadevan108
Copy link
Contributor

@dcpleung , can you help review

@mmahadevan108 mmahadevan108 added the bug The issue is a bug, or the PR is fixing a bug label Nov 6, 2024
@mmahadevan108 mmahadevan108 added this to the v4.0.0 milestone Nov 7, 2024
@dkalowsk dkalowsk merged commit 60442a2 into zephyrproject-rtos:main Nov 7, 2024
27 of 28 checks passed
@JordanYates JordanYates deleted the 241004_rtt_locking branch November 7, 2024 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Debugging area: UART Universal Asynchronous Receiver-Transmitter bug The issue is a bug, or the PR is fixing a bug manifest manifest-segger

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RTT: LOG_PANIC unable to be called in ISR's

7 participants