Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernel: prioritize C atomic functions if selected #33964

Merged
merged 3 commits into from
Apr 2, 2021

Conversation

dcpleung
Copy link
Member

@dcpleung dcpleung commented Apr 1, 2021

Usually, GCC builtin or arch-specific atomic functions are being used. The corresponding kconfigs are "selected" by architecture
or SoC kconfigs. CONFIG_ATOMIC_OPERATIONS_C is usually used to override the GCC built-in or arch-specific atomic unctions when these two are not supported. So change the priority of #include so that C version is included first if selected, and skips the inline versions of the other two variants. Or else there will be two compiled versions of atomic functions: inline version and the compiled C version.

Also remove the incorrectly included generated syscall header in atomic_builtin.h, and changes CONFIG_ATOMIC_OPERATIONS_ARCH to imply for Xtensa.

Fixes #33857

Xtensa cores are highly configurable so each SoC may not have
the needed instructions for the hardware assisted atomic
operations. So instead of selecting the arch-specific atomic
operations kconfig, do a "imply" instead. So SoC or board
configs can disable this.

Signed-off-by: Daniel Leung <[email protected]>
The builtin atomic header file should not include the syscall
header that is generated from C version of atomic functions.

Signed-off-by: Daniel Leung <[email protected]>
@github-actions github-actions bot added the area: API Changes to public APIs label Apr 1, 2021
Usually, GCC builtin or arch-specific atomic functions are being
used. The corresponding kconfigs are "selected" by architecture
or SoC kconfigs. CONFIG_ATOMIC_OPERATIONS_C is usually used to
override the GCC built-in or arch-specific atomic functions when
these two are not supported. So change the priority of #include
so that C version is included first if selected, and skips
the inline versions of the other two variants. Or else there
will be two compiled versions of atomic functions: inline version
and the compiled C version. Note that the arch-specific version
and builtin are swapped, so the builtin one is now the default.

Fixes zephyrproject-rtos#33857

Signed-off-by: Daniel Leung <[email protected]>
@nashif nashif merged commit 9f0188d into zephyrproject-rtos:master Apr 2, 2021
@dcpleung dcpleung deleted the kconfig_atomics branch April 2, 2021 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

atomic xtensa build fail
3 participants