-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
dmesg functionality (console buffer) #11792
Conversation
Awesomeness! |
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.
This is awesome.
52d848c
to
53a3b02
Compare
How much of the motivation for this is wanting a PX4 portable way to do this?
I am assuming you are referring to the syslog options: http://nuttx.org/doku.php?id=wiki:nxinternal:syslog Ramlog and dmesg? Could we just add a backing file store to dmesg? If dmseg RAM has content append it to a file and then cat the file? |
That would either be the ramlog option (which clears on read, so not what we want), or add a read interface to our console_buf device. We could do the second one, but need a way to handle the follow/not-follow reads. The added abstraction would also add overhead. |
Would you agree the output to the console has different significance to different developers? My concern is the loss of information: I.e the diff from this to the actual console output. There are some early boot messages that are critical to diagnosis an issue. I would like to see these in the output, but as the system boots so grows the capabilities to log. I.E there is no microsd fs in |
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.
@bkueng - thank you!
Let's add to the Todo list what we discussed on the call:
- A plan to enhance the ver command, to capture the Manifest index(HW rev,ver) and Core rev/patch.
- consider using the a stream in BBSRAM for the dmsg buffer to not lose the high level information in a fault.
Questions
|
3768bac
to
434b5a2
Compare
Yes, that was already on the way. See e0cccce
There's only 2: board version (which is also in
Yes we can use a pipe. |
434b5a2
to
af17ba1
Compare
af17ba1
to
43ff93f
Compare
Rebased & tested again. Should be good to go if CI passes. There is one thing to note: output from NuttX's work queues is not captured, because they are started earlier at boot. But since we move away from them, it won't be an issue. During testing I hit the maximum task limit of 32 (mavlink shell + 1 bg task). This is likely already an issue for VTOL and certain other configurations, due to the additional work queue tasks. @dagar fyi, maybe you're aware already. |
No, I didn't realize we were that close on actual configurations. I'll accelerate plans to consolidate some of our tasks, kill off HPWORK/LPWORK (unless used by a NuttX level dependency), and shutdown any unused WQ threads (created probing empty buses at startup). |
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.
Often it would be helpful to see the boot output, but the console is not available. This PR adds all console output to a buffer (except for NuttX syslog output), so that it can be printed later on via a new
dmesg
utility.It is implemented by redirecting
stdout
to a custom device that keeps a buffer and outputs tostderr
(which still goes to the original console). I looked at different options, and this seems the best one and most efficient.Alternatives:
up_putc
instead ofstderr
is considerably less efficientNSH_ALTCONDEV
does not work, because the mavlink shell would be output to that console as well.sh /etc/init.d/rcS2 > /dev/ramlog
), but that did not work properly.tee
command, but that uses an additional 1 KB bufferSince it requires some RAM, I only enabled it for v5 targets. The buffer is 4 KB, and typical boot output is 3 KB. We can reduce that a bit by cleaning up the boot output and maybe reduce the
ver all
verbosity.Example
You can also keep it running in the background:
TODO
find a better way for the v5 ifdefadd output to the log as well