How to find stuff in the kernel

I'm doing various tasks on the linux kernel, and I end up reading source code from time to time. I haven't really needed to change the kernel yet (I'm good with so called "Loadable Kernel Modules") so I didn't download the source of the kernel, just using http://lxr.free-electrons.com/ . And quite a lot I find myself finding a function that has many implementations, and start guessing which one is the one I need.

For example, I looked at the file Linux/virt/kvm/kvm_main.c at line 496 is a call to list_add, a click on it gives me two options: drivers/gpu/drm/radeon/mkregtable.c, line 84 and include/linux/list.h, line 60 - It's quite clear that kvm will not send my to something under "gpu" but this is not always the case. I have looked at the includes of the file - was not much help.

So my questions: Given a file from the kernel, and a function call at line ###, what is the nicest way to find where one function call actually continues?

(I'll be happy to hear also about ways that don't include the website and\or require me to download the source code)

Answers


There are many things in kernel that are #define'd or typedef'd or functions mapped inside structs (the fop struct in the drivers). So, there's no easy way to browse the kernel source. lxr site helps you but it can't go any further when you encounter any of the above data structs. The same is with using cscope/ctags. The best way though, despite you explicitly mentioning against it, is to download the source and browse through it.

Another method would be to use kgdb and inspect the code function by function, but that requires you to have some knowledge of the functions where you want to step in or not, to save a lot of time. And last but not the least, increase the kernel log level, and print the logs that are accessible through dmesg. But these all require you to have a kernel source.


Need Your Help

Silverlight: Two-Way binding on ComboBox doesn't hit BindingValidationError handler with null

c# silverlight validation data-binding combobox

I've scoured the internet and have yet to find a solution. Help me Stack-Overflow-Kenobi, you're my only hope!

XML and XSLT and setting namespace

xml xslt namespaces

I need to add an xmlns to the root element in the output of this XSLT transform. I've tried added <xsl:attribute name="xmlns"> but it's disallowed.