On Fri, Mar 8, 2013 at 8:57 PM, Thomas Gleixner tglx@linutronix.de wrote:
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 ?
It's `= true` in the original source, I've pasted it altered already, by mistake.
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?
The CNTP_ does not use CNTVOFF. If for some reason hypervisor wants to completly pretend what the guest platform timer is (more like a full virtual-machine) it needs to trap CNTP_ anyway and fake it. Simple re-routing to CNTV_ seemed like a great way to do this.
While I'm thinking about it ... maybe I didn't get the intended purpose of all these timers right. As CNTV is clearly available to the guests, should I consider that the guests will be virtualization-aware and by default use CNTV_, and in case I really need to fake the CNTP_ (which is rarely the case, I guess), I can just do the math manually? Makes sense.
Thanks for clarification,