-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Revert "shell: support floating point output..." #29203
Conversation
This reverts commit e812ee6. This is not the right approach. If the shell is incapable of using standard libc printing functions, it needs to use (and possibly extend) the existing printk() code already in this library. See zephyrproject-rtos#29202 Signed-off-by: Andrew Boie <[email protected]>
As I tried to argue in #29171 I think this is the wrong path forward.
However, it's been made very clear that the owner of Perhaps we need another place to put utilities that are generally useful to the entire OS. |
Why are making this discussion about ownership? This is still a PR where you can object and raise concerns and if you have a better solution and think we should not revert, please make the case and others are welcome to do the same. |
Don't know what to say about that: #27655 was open for two weeks with the lib/os codeowners added as reviewers when it was created.
It's in lib/os:
Since But if it the problem is it needs to go somewhere else, and/or be named something else, I can certainly do that. Who will own that thing, and what do they want it to be called? Because making proposals that are immediately rejected is not effective use of anybody's time. If the problem is #29202, moving it back to minimal libc (or anywhere else) isn't going to change much. |
The above refers to making decisions in a meeting. My guess is that the nature and purpose of bringing this into a meeting is not well understood because not everyone can join such meetings.
I think it is not about lib/os or lib/. this is about moving it from libc and making it part of the OS also in the case where you use another libc, basically duplicating the code. So we need to step back and figure why shell, logging and others are using this first place and how we can solve the problem at the core. |
Agreed. I think the rationale is pretty well described at #27655:
Shell and logging require a way to generate formatted text output that doesn't require arbitrary-sized buffers, because they output to a variety of endpoints (serial, network, debugger back channel). A good solution is the API for
There are no such functions in C libraries; certainly not in newlib. Zephyr applications need to support generating 64-bit integers and floating point in formatted output, certainly from the shell and arguably from logging. It's certainly technically possible to take Then that one core formatter can be used by But if a goal is indeed to have only one stream-output-formatter facility in Zephyr, then Is that not a concern from the kernel perspective? |
What I don't want is two printf() implementations in our OS library that as a maintainer I have to support. I am not trying to be difficult or give you a hard time, or give the impression this some kind of turf war. I will always consider having two pieces of code doing the fundamentally the same thing to be technical debt, especially if they are in the core OS library. We can do better than this. I am not opposed to making
Have you considered that it may be possible to build this in such a way that handling format strings without floating point format codes in them might not need significant extra stack space, even if the code is compiled in? I think you are being overly dismissive of the possibility of making printk() work for these use-cases. The
Let's be clear here, we're talking about streamable printf without buffering which is not offered by libc. All the use-cases in the kernel I see for such streamable printf are for:
We literally don't care if applications need this,
Crucial is a strong word. I think you're overstating the case. If you can afford the overhead of a debug shell, or runtime rendering of text logs, would a line buffer so that you can use libc string rendering functions really kill you? Especially if you're already willing to accept the order-of-magnitude increase in stack space used by
Just re-open the original bug and a new assignee will be found if you aren't willing to work on this further. |
Agreed.
Perhaps not, but I don't think it's generally possible to determine statically how big a buffer is needed, given that (shell) format operations come from independent modules and produce text that can be short or long depending on arguments. All libc formatting API is all-or-nothing (or "what fits and throw away the rest"). Also it makes application capability dependent on underlying libc selection, which has historically been a problem for output formatting.
From a kernel perspective, absolutely. From a Zephyr perspective, it's important to consider the functionality applications need. To that end:
Yes, I think the distinction between what "core kernel" needs and what an application needs is important. So is whether it's important to keep
Because I'm less concerned about duplication when it's partial functional overlap in functions with clearly-defined different roles and use cases. If:
then is there a conflict? Why not remove It might even be possible to extend the full capability to |
Added dev-review to discuss #29203 (comment) and whether there's consensus that a generic consistent formatting utility has value separate from printk. This is not intended to bypass any maintainer decisions related to what's in core kernel, but if nobody wants this capability the way forward is made more clear. |
Following dev-review 2020-10-22: I'll look into the impact of supporting a single stream-formatting API that can be used by the kernel and applications. |
This reverts commit e812ee6.
This is not the right approach. If the shell is incapable of
using standard libc printing functions, it needs to use (and
possibly extend) the existing printk() code already in this
library. See #29202
Signed-off-by: Andrew Boie [email protected]