Skip to contentSkip to conversation

Clock Interrupt not occurring. hypervisor_callback not being called.

DISCUSSION Ivan Kelly 2 participants 3 messages Feb 28, 2006

lore
Share & tools
lore

Ivan Kelly

author
#0 lore raw

Im having a strange problem with a hypervisor_callback that I have written. Im setting up VIRQ_TIMER and have added a handler for it. The evtchn_mask bit, evtchn_pending bit, evtchn_upcall_mask, evtchn_upcall_pending and evtchn_pending_sel>>5 bit are all zeroed.
I have a loop running, outputting text to the console in the main thread of execution. When I run my kernel, this thread will run continuous, and never be interrupted by the evtchn handler. Im printing out the values of all the relevant fields(masks and pending etc) and they all seem to be set correctly, but nothing happens.
Curiously, when I add a print statement to the do_hypervisor_callback function, the callback seems to work correctly. Does anyone have any idea why this could be happening?
Best regards
Ivan Kelly

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Have you tried making evtchn_pending and evtchn_mask volatile in shared_info_t?

-Dave Winchell

Quoted 15 lines · Ivan Kelly

Im having a strange problem with a hypervisor_callback that I have written.
Im setting up VIRQ_TIMER and have added a handler for it. The evtchn_mask bit, evtchn_pending bit, evtchn_upcall_mask, evtchn_upcall_pending and evtchn_pending_sel>>5 bit are all zeroed.
I have a loop running, outputting text to the console in the main thread of execution. When I run my kernel, this thread will run continuous, and never be interrupted by the evtchn handler. Im printing out the values of all the relevant fields(masks and pending etc) and they all seem to be set correctly, but nothing happens. Curiously, when I add a print statement to the do_hypervisor_callback function, the callback seems to work correctly. Does anyone have any idea why this could be happening?
Best regards
Ivan Kelly

------------------------------------------------------------------------

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#2 lore raw
Quoted 2 lines · Dave Winchell

Have you tried making evtchn_pending and evtchn_mask volatile in shared_info_t?

I tried that. It's still showing the same behaviour. The function is as below. When the kprintf("l1 ... bit is uncommented, the clock events seem to get fired fine, and the the main loop also continues to run. When removed, it doesn't get called at all. It never gets as far as do_event. kprintf is a function that calls hypervisor_console_io. This is 2.0.7 btw.
Regards
Ivan

<SNIP>
PUBLIC void
do_hypervisor_callback(struct stackframe_s *regs)

{
        unsigned long  l1, l2;
        unsigned int   l1i, l2i, port;
        int            irq;
        shared_info_t *s = hypervisor_shared_info;

        s->vcpu_data[0].evtchn_upcall_pending = 0;

        l1 = x86_atomic_xchg(&s->evtchn_pending_sel, 0);

        while ( l1 != 0 )
        {
/*              kprintf("l1: %x\n");*/
                l1i = x86_scan_forward(l1);
                l1 &= ~(1 << l1i);

                l2 = s->evtchn_pending[l1i] & ~s->evtchn_mask[l1i];
                while ( l2 != 0 )
                {
                        kprintf("l2: %x\n", l2);
                        l2i = x86_scan_forward(l2);
                        l2 &= ~(1 << l2i);

                        port = (l1i << 5) + l2i;

                        if ( (irq = event_to_action[port]) != -1 ) {
                                do_event(irq, regs);
                        }
                }
        }
}

<ENDSNIP>