-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Enable CONFIG_DYNAMIC_DEBUG on the default raspbian build #3486
Comments
+1 I'm currently trying to debug some issues with a V4L2 app. It would have been nice to have this on by default. |
I agree that it's pretty important for this feature to be enabled by default--I hate the fact that I have to manually recompile the kernel in order to view Wireguard logs. |
We usually expect requesters of a feature like this (which could have non-trivial cost on kernel size, free memory and performance) to test it and report any changes. |
okay, I'll provide those info when I next need to do a kernel build. Others, please feel free to beat me to it! |
I will get the results posted in the next day or two. Thanks. |
@cjones26 If you could do that it would be great! Thanks! |
@popcornmix @HinTak -- ok so I cross-compiled the 32-bit Pi 4 armv7l kernel both with and without With dynamic debug
Without dynamic debug
I then proceeded to compare the compiled module size between the two kernels and found absolutely no difference in size (see attached files): dd_kernel_modules_sorted.csv Note: The following is not a fresh install as I have a few things installed, @HinTak -- if you have the ability to perform a fresh install the results may be better. Otherwise give me a few more days and I will be able to check the kernel against a fresh install of Raspberry Pi OS. Here's also the lsmod from both kernels (excuse the fact I may have some extraneous modules running, such as "wireguard"): With dynamic debug
Without dynamic debug
And finally, the With dynamic debug
Without dynamic debug
|
@cjones26 Thanks for the effort! I see you have a whole bunch of firewall / wireguard related modules. That 11MB transfer from shared to used in output of
This is a fairly minimal headless setup I used for debugging a out-of-tree driver a month or two ago. Maybe I'll go ahead and build a kernel too... I am not surprised that individual modules are not affected - the overhead is likely in the kernel core and with maintaining the extra debugfs string tables. |
@popcornmix @cjones26 okay, I have made two clones and can freely swap between the two, so let me know if you want to know anything else.
It is at 0088fda . For linux-5.10-a, I just did
The results:
Here are the sorted listings under
You can look at the details yourself, but for the 1677 files under there, 1129 are the same size, 548 are large for the dynamic debug version. So in terms of static sizes, the kernel is increased by about 132k compressed, 455k decompressed; the sum total size of the kernel modules increases by 3.6MB out of ~62MB, or about 5%; but 2/3 of kernel modules built for the pi 4 defconfig actually stays the same size. I think that's because dynamic debugging have no effect on stable kernel modules which does not contain debug statements, which is 2/3 of all the modules in the pi 4 defconfig. for
The other interesting thing is the Memory line in
From further above, the uncompressed kernel image file size is increased by 455k; and resulting runtime change is in 56k more rwdata and 164k more rodata, 56k more reseved. I don't know if 455k is supposed to related to that 56k + 164k + 56k? Anyway, how do you decide whether these numbers are large? as you see this is a pi 4 with 4GB ram; 0.5MB for increase in uncompressed kernel image file size, plus 4MB of kernel modules (2/3 of them don't change, and many of the rest are not used) increase seem small. As I have two separate builds with different extraversions, I can switch between them just by copy |
Mine is a native build, BTW. @cjones26 I am surprised that you found no changes in kernel modules sizes - I found about 2/3 are the same, so I looked at your csv file - you are looking at |
Welp, apologies I am a bit of a newbie when it comes to the Linux kernel. Thanks for posting more detailed information and giving me a heads up! |
@cjones26 no need to apologize - I appreciate the effort, and it is always good to have another person checking. I think the uncompressed size is supposed to be related to the runtime memory footprint line, but maybe @popcornmix knows better? I am actually quite surprised that it is such a high proportion (0.5M / 20M, and 4M / 65M, say 3-5%), but maybe because the pi 4 defconfig is already quite minimal, unlike the typical x86 scenario. |
To my mind that is too large an overhead to inflict on all users, given that the kind of users who are likely to want to enable debug are also the ones who would end up compiling a kernel. Kernel debug facilities are not something that would normally be used frequently. Does WireGuard really not provide other logging options? |
Got it. Strangely, and unfortunately, they do not provide other logging options. |
I am surprised about the high proportion (however one sees it, it is no less than ~2%). I wonder if the pi set of modules and pi core code paths have a higher debug print counts than the rest (and more than the x86 ones). One interesting finding is that the effects on kernel modules are not uniform, and affects 1/3 of them, and some worse than others. Maybe that's a useful classification to spend time on improve the individual modules on. That wireguard uses a debugging functionality as a routine day-to-day logging operation is certainly a strange decision. The original motivation for this filing was for out-of-tree driver debugging; meanwhile wireguard has changed from being out of tree to in tree, I think? Anyway, seeing what I find now, I agree that it is not a good idea to enable it by default. It would be interesting to know if the overhead would get better in a year or two's time on the pi though. |
I agree. In the meantime I'm going to close this issue. |
FWIW I ran into this Wireguard logging peculiarity. I opened a discussion about it at MichaIng/DietPi#5847 |
I'm the kind of user that wants to enable (WireGuard) debug Just wanted to post here for future reference - are there by any Alternatively, would there be a guide on how to recompile the Pi |
@mck182 recompile pi kernel with dynamic debug enabled is not hard. There is already an official "bulld your own pi kernel" guide from the pi people on the official pi website. The small additional step(change one kernel build option) you follow any of the standard or hobbyist Linux kernel page on such, the short version is my comment #3486 (comment) above. Perhaps you go and read thr official pi kernel build page first, then read that comment of mine above, then ask questions of things not clear? |
I am quite familiar with x86/x86_64 kernel debugging (being one of the in-tree driver maintainers...), and recently needed to look into some raspberrypi driver-related issues. I found that in raspbian buster (at least) , CONFIG_DYNAMIC_DEBUG is off. This is on by default on most x86/x86_64 linux desktop distros - at least those I regularly use. And the overhead is very small if you don't do additional steps to use it.
Could we switch this on in the default raspbian kernels?
The text was updated successfully, but these errors were encountered: