On Thu, 2009-11-12 at 11:59 +0100, Alexander Graf wrote: > > Oh you mean it will basically avoid us firing off a timer for mtdec 1? Well, I wasn't specifically thinking about the mtdec 1 case (which we would get rid off by emulating an MPIC instead of the old pmac pic) but in general, it would overall simplify the emulation. So there are two aspects here we are mixing up. Let me clarify: - Doing the TB based target thingy simplifies the calculation as to whether we need to fire off a DEC interrupt to the guest and provides a better overall emulation of the DEC behaviour since the DEC ticks at the same rate as the TB. - My other idea to modify the CPU DEC instead of firing a hrtimer is a separate thing. We could stick to a hrtimer if you want, and thus only set it at mtdec time, though as you said, it's going to be not nice with the mtdec 1 that linux does with the pmac PIC. But in general, I find it a lot simpler and -less-code- to just whack the real DEC on exit to be the min(guest_DEC,host_DEC). No need to go through all of the hrtimer code etc... > So the only really novel thing I see here is that small mtdecs don't > require a timer but instead the timer only gets issued on the next > exit. I'm not sure that's a good idea though :-/. It'd probably be > better to just define a minimum threshold. I wasn't thinking about a minimum threshold. No, we must not have DEC firing too early. The guest will get confused if it hits before the timebase reaches the expected value and the interrupt will be "lost" > on mtdec: > > if (reg < 5) > fire_off_dec(); > else > fire_dec_on(reg); > > Something like that. > > I don't want to depend on the host DEC being the clocksource btw. So > anything munching guest and host DEC together (like pHyp does) > sounds > like bad design to me. Let's better have hrtimers handle the case > where we don't need a real interrupt. Why ? Everybody is asserted to the CPU timebase. That's the real clock source for both host and guest today and you can't do anything about it since mftb isn't going to trap. The DEC counts off the TB. So it's going to be more precise and less code to just muck around with the DEC to trigger the guest interrupts don't you think ? Cheers, Ben. -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html