All of lore.kernel.org
 help / color / mirror / Atom feed
* mini-os: x86: virtual-timer interrupt and get_time_values_from_xen
@ 2014-10-17 14:12 Thomas Leonard
  2014-10-21 10:38 ` Ian Campbell
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Leonard @ 2014-10-17 14:12 UTC (permalink / raw)
  To: xen-devel@lists.xenproject.org

In Mini-OS on x86 we have:

static void timer_handler(evtchn_port_t ev, struct pt_regs *regs, void *ign)
{
    get_time_values_from_xen();
    update_wallclock();
}

static evtchn_port_t port;
void init_time(void)
{
    printk("Initialising timer interface\n");
    port = bind_virq(VIRQ_TIMER, &timer_handler, NULL);
    unmask_evtchn(port);
}

It seems that the timer values are only correct after the first timer
interrupt occurs. For example, test.c can output this (if you remove
xenbus_tester so it starts the timer test quickly enough):

    Periodic thread started.
    T(s=8734 us=790808)
    T(s=1413543796 us=487564)
    T(s=1413543797 us=487867)
    ...

I can fix this by getting it to read the values in init_time:

void init_time(void)
{
    printk("Initialising timer interface\n");
    port = bind_virq(VIRQ_TIMER, &timer_handler, NULL);
    unmask_evtchn(port);

    get_time_values_from_xen();
    update_wallclock();
}

But now I wonder whether the code in timer_handler is needed at all.
It seems that all code that reads the timer already ensures these
values are up-to-date by comparing the version number (presumably this
doesn't work the first time because shadow isn't initialised). With
the fix to init_time, is it safe to use an empty handler?

Thanks,


-- 
Dr Thomas Leonard        http://0install.net/
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1
GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-10-21 21:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-17 14:12 mini-os: x86: virtual-timer interrupt and get_time_values_from_xen Thomas Leonard
2014-10-21 10:38 ` Ian Campbell
2014-10-21 21:46   ` Samuel Thibault

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.