Re: + stupid-hack-to-make-mainline-build.patch added to -mm tree

Jeremy Fitzhardinge
2007-03-07T19:05:46Z

James Morris wrote:
> It seems to me that it could be useful to have a library of common virtual
> time code (entirely separate from pv_ops), to avoid re-implementing some
> apparently common requirements, such as: handling TSC frequency changes,
> stolen time accounting, synthetic programmable clockevent etc.
>

Well, lets put our clock* implementations next to each other and see how
much common code there is to be factored out.

The Xen time code is pretty lean. There's not much difference in
abstraction between the clocksource/event interface and the hypervisor
interface, so there's just not very much code there.

One immediate candidate is the scale_delta() function which does the
necessary cycles->tsc conversion. I think that will be generally useful
and should be put somewhere common rather than copied.

I think stolen time is a bit more core, and in principle applies to
non-virtualized systems as well (such as time stolen by SMM and
discontinuities caused by suspend/resume). The key piece is a monotonic
clock which advances while a vcpu is actually running on a real cpu,
since that should be used to determine how much time each process has
been running for.

Maybe it will just fall out if we start moving to a state-transition
process time accounting rather than the current sample-based one. Is
there an actual plan to do that, or is it at the handwaving stage?

J