Kernel debugging

i’m using the hikey board in order to develop a thin hypervisor and ofcourse i’m having tons of problems and in desperate need of a debugger.

i was wondering if you know how i could do kernel debugging for the hikey board ?
can it be done over USB ?

thanks, asaf :slight_smile:

I am doing some analysis on KVM and I am just using the standard kernel debugging capabilities (pretty much ftrace [1] and pr_debug in UP mode for simplicity - no reason to debug in SMP for me yet).

What do you mean by debugger? are you thinking about a JTAG or BDI sort of device?


well the first thing is i’m trying to replace the hyp exception vector but the boards locks up and i very much would like to know why.

i’m used to working with kgdb on virtualized environments to solve such issues…
i was hoping for a simpler solution than jtag, something based on the otg port…

I noticed that the virtualization group suggested you to look into how KVM does what you are trying to replicate (type 2 hyper-visor).

Not sure if you followed up my entry there but you can run a simple guest instance in HiKey 16.06 by installing kvmtools (either from source or via apt) and execute:

$ lkvm run --console serial -c2 -m256 -k /tmp/Image -n mode=user,trans=mmio -p "console=ttyS0 earlycon=uart,mmio,0x3f8"

[be sure to pass an uncompressed Image to lkvm: if you dont pass a kernel image, it will attempt to load bzImages/vmlinuz from /boot which obviously wont boot].

Yes but that is not what I want…
I need to build an hypervisor not use an existing one…

The thing I didn’t understand is how identity mapping of the hyp vectors work.

I think your question is understood.

I am simply letting you know that you can use kvm and lkvm on HiKey to find out the answer to your question - you are not going to do (architecturally speaking, maybe feature wise you will) anything that kvm is not doing already so understanding how kvm works might help.

Oh lol, that’s exactly what im trying to understand, I looked at the code but when I try to replicate it in my module it won’t work due to the fact that I’m sending bad virtual address since it is not I’d mapped to physical memory.