On Fri, 8 Mar 2013, dpc@ucore.info wrote:
Hi,
I'm developing a baremetal hypervisor for Cortex-A15 and I'm using Arndale Board as a reference platform. ATM, I'm working on running Linaro 13.02 as a guest.
I've noticed that `arch/arm/kernel/arch_timer.c` Linux prefers the virtual IRQ timers (CNTV_):
static bool arch_timer_use_virtual = false;
And how does "false" prefer virtual ?
as a timer source and I'm wondering if there's a reason for this. Is it even possible for virtual timer to be available, while physical one is not? I don't think so. So why would Linux want to default to virtual one instead of physical one, especially in the situation when it was started in SVC mode and HYP is not accessible to it?
From Hypervisor point of view, it seems natural that guest does not care about virtualization stuff, does not try to be smarter than necessary and simply uses physical timer (PL1) all the time.
That's utter nonsense. If the guest knows that it runs in a virtual machine it better uses stuff which was designed to work in a virtual machine rather than trapping out for no good reason.
It's hypervisor's job to trap guest accesses to physical timer (CNTP_) and route them to virtual timer (CNTV_) so virtual offset (CNTVOFF) value can be easily switched (again, by hypervisor, not the guest) when handling multiple guests, to correctly handle virtual time for
Are you really sure, that you want to develop a hypervisor?
It's the damned job of the hypervisor to stay out of the way as much as possible and you can do the handling of multiple guests on a physical core when you actually schedule out guest A and schedule in guest B. Why the heck do you want to trap for each access of the timer if the hardware provides proper means to avoid it? Just because you can or what?
Thanks,
tglx