Subject: Re: Negative time with ps
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Christian Limpach <chris@pin.lu>
List: port-xen
Date: 03/23/2005 21:33:07
From: "Manuel Bouyer" <bouyer@antioche.eu.org>
> On Tue, Mar 22, 2005 at 11:42:26AM +0100, Quentin Garnier wrote:
> > On Tue, Mar 22, 2005 at 10:29:27AM +0200, Martti Kuparinen wrote:
> > > I'm getting weird output from domain0's ps command. Any ideas
> > > what's causing this?
> >
> > root         4  0.0 19.2    0 24700 ?? DK   Wed02PM -18516351:-27.18
[pagedaemon]
> > root         5  0.0 19.2    0 24700 ?? DK   Wed02PM -18516350:-26.87
[ioflush]
> > root         6  0.0 19.2    0 24700 ?? DK   Wed02PM -18516351:-27.70
[aiodoned]
> >
> > It happens in domU, too.
>
> Yes.
> The clock code isn't perfect. Especially, it doesn't compensate for the
> fact that clock interrupts don't run at exacltly hz, because of domain
> scheduling, and also because xen will send extra interrupts from
> time to time, when domain0 updates the master clock. This needs more work.
> Now, I'm not sure if this can cause the process time to become negative.
> BTW, it this seems to happen only for kernel threads.

Yes, this has been a bug since day one and the time of some kernel threads
seems to be wrong from the start.

I thought Thor or I had added code to compensate for the irregular clock
interrupts at some point?  It should keep the last time the clock was
updated in a variable and then do no, one or several clock ticks at once
depending on how many clock interrupts were lost.  With this code, it should
then also be possible to set HZ to the same value as is used on NetBSD/i386.

    christian