-
Notifications
You must be signed in to change notification settings - Fork 7.4k
kernel: Remove unused absolute symbols #56293
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: Remove unused absolute symbols #56293
Conversation
Uhm, not a big fan of this. The I understand the cleanup frenzy but I think that leaving these in place makes no difference in code size or footprint so why deleting those and maybe creating havoc to downstream or out-of-tree projects? |
@carlocaione - To be honest, that potential downstream impact is one that I had not previously considered. That being said, I don't think that the removal of these specific symbols is that large a concern (perhaps I am too close to this to see this objectively). However, should a downstream project require those symbols at assembly level, I would expect that they would most likely employ something similar to the following to get what they need ... In a 'C' file ... In the asembly file ... In the longer term, my aim is to eliminate the GEN_OFFSET_SYM and GEN_ABSOLUTE_SYM macros. If this can be done cleanly, then it sets the stage for simplifying the build process (as their use requires a separate compilation and custom python script just to create the defines used in assembly). |
Well, for example I have a downstream project relying on Should we go through a deprecation process for this instead if we really (really) want to progress on this? This is definitely an API breaking change (though not an API per se).
Right, but we still would need to generate
I really hope that this does not mean to give up on the |
a1df942
to
235b6d4
Compare
Fixed the build errors resulting from __z_arch_esf_t_SIZEOF being used in riscv. (For some reason, during the first pass it showed up as not used--I must have searched the wrong directory with grep.) The current failure is, I think, spurious. One objection thus far is that these symbols may be used in a downstream project. These symbols seem to fall into a bit grey zone. That is, to my knowledge they are not part of the official API, but we do have confirmation that from @carlocaione that some are used there. I previously stated that one of my longer term goals is to get rid of the GEN_ABSOLUTE_SYM() and GEN_OFFSET_SYM() to allow the build to be simplified a bit. (This could be done using by replacing them with a mixture of global variables and pre-calculated offsets, and it would also preserve the ability to allow that information to be passed downstream--albeit with different names.) I don't know if this additional information would ameliorate any concerns that people may have. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropping a +1. I get the argument that there are compatibility concerns, but given that these are fundamentally just an access mechanism for struct fields and sizes, and that (with very few exceptions) we've never documented our struct formats as a proper API, it seems OK to me.
Maybe there's an argument for a few of them to deprecate for a release, but IMHO absent specific arguments this is an OK interface to break.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peter-mitsis can we have a changelog detailing what was removed already in this PR?
6ce12d8
to
9847c8d
Compare
9847c8d
to
dc3a30a
Compare
Removes ARM specific unused absolute symbols that are defined via the GEN_ABSOLUTE_SYM() macro. Signed-off-by: Peter Mitsis <[email protected]>
Removes ARM64 specific unused absolute symbols that are defined via the GEN_ABSOLUTE_SYM() macro. Signed-off-by: Peter Mitsis <[email protected]>
Removes ARC specific unused absolute symbols that are defined via the GEN_ABSOLUTE_SYM() macro. Signed-off-by: Peter Mitsis <[email protected]>
Removes NIOS2 specific unused absolute symbols that are defined via the GEN_ABSOLUTE_SYM() macro. Signed-off-by: Peter Mitsis <[email protected]>
Removes SPARC specific unused absolute symbols that are defined via the GEN_ABSOLUTE_SYM() macro. Signed-off-by: Peter Mitsis <[email protected]>
Removes unused absolute symbols that are defined via the GEN_ABSOLUTE_SYM() macro in the kernel directory. Signed-off-by: Peter Mitsis <[email protected]>
Updates the release notes to document which absolute symbols (generated via GEN_ABSOLUTE_SYM) have been removed. Signed-off-by: Peter Mitsis <[email protected]>
dc3a30a
to
440437f
Compare
Here's one✋ We were relying on I'll acknowledge that these aren't technically part of the API, so we were on shaky ground here, but these generated symbols have no alternative solution that is covered by the API. I humbly ask you to please not delete any more of these without providing alternative ways of accomplishing the same use cases. They don't affect production binary sizes and the addition in build time and build system complexity is trivial. There was a similar discussion in #53951, where some deprecated command line options were removed, then restored. There's definitely value in cleaning up stuff that is actively a burden on the maintainers, but I think this project is big enough that Hyrum's Law should be taken into consideration at this point. |
lol, I called it. @trond-snekvik do you have a way to re-introduce |
@carlocaione we actually use |
@trond-snekvik what about only reintroducing back |
@carlocaione that wouldn't do it, no. The symbol we were relying on was actually generated by If anything, I think the offsets should be added to the thread info object here: zephyr/subsys/debug/thread_info.c Line 42 in 9f37ae9
The downside is that this can't be read at compile time in the same way. Also, this object isn't part of the API either, and it's not used anywhere else in Zephyr, so I suppose there's nothing stopping anyone from merging a PR that deletes that without deprecation as well. I don't expect that everything that ever existed in zephyr is kept around forever, I'm just hoping maintainers can keep in mind that any change to the observed behavior (and not API) will disrupt someone's workflow. That doesn't mean that the change shouldn't be made, it just means that it will always come at a cost. |
I never noticed the file zephyr/subsys/debug/thread_info.c before--I learned something new today. :) Adding the value to the _kernel_thread_info_offsets[] array seems reasonable. |
@trond-snekvik - Following up a little on this, I see that there is a pre-processor check that claims that this feature does not work properly with multiple CPUs. I am not sure if this is a make-or-break issue for you, but I thought that I would point it out. If I am following things correctly, the reason for this limitation is the entry THREAD_INFO_OFFSET_K_CURR_THREAD--offset of the current thread. In an MP system, this entry corresponds only to the offset of the current thread on cpu[0]. Perhaps the list of offsets could be extended to indicate the size of the struct _cpu? This is new code to me, so I assume that there are subtleties about which I am unaware. If you would like to file an enhancement request, it will ensure that this issue and potential solution is tracked. |
Removes unused absolute symbols (generated via the GEN_ABSOLUTE_SYM() macro) from both common kernel code and architecture specific code.