[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] xen/arm: Software Step ARMv8 - PC stuck on instruction
Hello James, Julien, regarding your previous mails. I was able to single step every instruction of my module. The problem (or rather the solution) was to _disable_ the IRQ interrupts from within my guest module. This solves the problem of singlestepping a module which previously ended in a spinlock. But it does not solve the problem with system that is singlestepped with enabled IRQ's, as it still will be locked within a spinlock. int init_module() This following part is the importand bit. I disable the local_irq's and execute two SMCs. local_irq_disable(); When executing these exact steps, it is possible to singlestep the whole module. Without the local_irq_disable() the system will stop the module execution right after the first SMC. My Xen Access version got, just like the original one, a main loop where events will be catched:
This part enables singlestepping the VM with the first SMC. (The function toggle_single_step_domain just sets the domain flag i mentioned in earlier mails)
This is the part which sets the VM.PC to the next instruction after the SMC instruction within the guest module.
The above part is the handling of software step exceptions. As you can see, i print the PC value and read a command from the user in order to let the guest execute further or print its registers. These two are the main control flow of xen-access. Finally my Xen Code within the leave_hypervisor_tail looks like this. The leave_hypervisor_tail function is called right before the control flow switches to the guest. Because of this, every time when the guest gets to run, we set the bits needed to singlestep. asmlinkage void leave_hypervisor_tail(void)
So, I adapted your comments and as I mentioned. The general SingleStep functionality works fine. But: It's not possible to singlestep a system as long as the VM IRQ's are enabled. If we would activate single stepping with enabled interrupts, we will be locked in the mentioned spinlock. Because of this it is not possible to singlestep other application. Additionally it is not possible to print anything while singlestepping because, as far as I understood, the system will wait within a spinlock until the terminal is free to print. Do you have any idea why it's not possible to escape the lock while singlestepping? Like I mentioned, my guess is on timer interrupts, which should unlock the spinlock but generate problems with singlestep enabled at the same time. This would also explain why i can observe the control flow of my guest module with IRQ's being disabled. Below is an abstract of the program flow. The first one is with disabled IRQ's. You can see that every instruction is from my module (as the addresses are around 0xffff0000008e0000). The second one shows instructions which, directly after the SMC, starts the "go to spinlock" routine because of enabled IRQ's. Kind regards, Florian Working Singlestep in module: root@avocet:~# ./xen-access -m 2 singlestep Singlestep with enabled IRQ's: root@avocet:~# ./xen-access -m 2 singlestep ++++++++++++++++++++++++++++
Singlestep: PC=ffff000008081a80
Singlestep: PC=ffff000008082700 Singlestep: PC=ffff0000080814e8 Singlestep: PC=ffff000008100f60 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |