Re: [RFC] ARM binutils feature churn causing kernel problems

Paulo Marques
2004-10-08T19:43:36Z

Albert Cahalan wrote:
> ....
>
> No, the /proc/*/wchan file is supposed to be used.
> For some reason, stat() is failing. Here is the code:
>
> // next try the Linux 2.5.xx method
> if(!stat("/proc/self/wchan", &sbuf)){
> use_wchan_file = 1; // hack
> return 0;
> }
>
> See what these commands tell you:
>
> strace -o data -e trace=stat ps alx >> /dev/null ; grep self data
> stat /proc/self/wchan
> stat /proc/$$/wchan
> stat /proc/self/
> stat /proc/self

You are right. I just tested this on my system and ps doesn't read any
System.map at all, provided there is a /proc/<pid>/wchan file to read from.

>>If this is the case, then after the changes to kallsyms go in, procps
>>could start using wchan directly and avoid reading the System.map
>>altogether.
>
>
> Here's an idea: if both name and number were provided
> at the same time and I could get notified when a module
> is loaded or unloaded, then I could cache the
> number-to-name translation.

This is more a question of whether kallsyms is a good feature to have
always (modulo embedded or very limited memory systems) or not. If
kallsyms is always available, the procps tools already read
/proc/<pid>/wchan and don't need to cache anything at all. The only
reason to cache would be performance, but if you try a recent -mm kernel
you can see that there is no need for that any more.

From what I've seen on this list since I've joined (almost a year ago),
2.4 stack dumps are almost useless[1] whereas the 2.6 ones give very
useful information thanks to the function names (and offsets) that lead
to the problem.

IMHO we should try to make kallsyms always available, reducing further
the space used by the symbol data if necessary.

--
Paulo Marques - www.grupopie.com

To err is human, but to really foul things up requires a computer.
Farmers' Almanac, 1978

[1] of course using ksymoops would solve this, but it requires more
knowledge from the user than kallsyms, so it is not the same thing