Skip to contentSkip to conversation

Periodic timer interrupts in the Mini-OS (working?)

DISCUSSION Simon Kagstrom 1 participant 2 messages Feb 2, 2006

lore
Share & tools
lore
#0 lore raw

Hello!

I have a question about timer interrupts in the Mini-OS and HYPERVISOR_set_timer_op. From printouts, it seems like the Mini-OS only recieves timer events after calling block_domain:

void block_domain(u32 millisecs)

{
    struct timeval tv;
    gettimeofday(&tv);
    HYPERVISOR_set_timer_op(monotonic_clock() + 1000000LL * (s64) millisecs);
    HYPERVISOR_sched_op(SCHEDOP_block, 0);
}

i.e., not the "regular" 10ms periodic events (if I don't call block_domain(), it will just sit idle). I'm trying to understand why this is the case.

Quoted 1 line

From looking in the Linux source code, I presume that the periodic ticker is

setup in setup_cpu0_timer_irq() on uniprocessors, and this simply does a bind_virq_to_irqhandler(VIRQ_TIMER, ...), which is the same thing that the mini-os does by calling bind_virq(VIRQ_TIMER, ...) in the init_time() function. These two functions do the same things, including unmasking the event channel.

The mini-os also does a __sti(), also taken from Linux, to enable event delivery before init_time().

Is there anything else which needs to be done to deliver periodic timer events?

Signature · 1 line
// Simon
#1 lore raw
Quoted 14 lines · Simon Kagstrom

Hello!

I have a question about timer interrupts in the Mini-OS and HYPERVISOR_set_timer_op. From printouts, it seems like the Mini-OS only recieves timer events after calling block_domain:

void block_domain(u32 millisecs)

{
    struct timeval tv;
    gettimeofday(&tv);
    HYPERVISOR_set_timer_op(monotonic_clock() + 1000000LL * (s64) millisecs);
    HYPERVISOR_sched_op(SCHEDOP_block, 0);
}
Quoted 2 lines

i.e., not the "regular" 10ms periodic events (if I don't call block_domain(), it will just sit idle). I'm trying to understand why this is the case.

It turned out it was my fault, for some reason I had modified do_event() to include a mask_evtchn(port) in the end. So then, naturally, there were no more events...

Sorry about the fuss, I should have checked the changes first.

Signature · 1 line
// Simon