[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Which ways does the event handler be called in the event_channel mechanism?


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: "p z" <zpengxen@xxxxxxxxx>
  • Date: Sat, 17 Jan 2009 14:10:39 +0800
  • Delivery-date: Fri, 16 Jan 2009 22:11:06 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=TQzuPR/puvPc1usctCtHFzPUSim883xLI3a1fz23oeP949iF1hdDHvnWwLL7K2EbyE 2Suy+FZGKEbBSs29tMn5PNmisQ8YTRIaxLZHln2WvONet7lra791RHWfDagw3y7j8KfW JUqx6q6Jtkp0pw6oDk/esbt3Zjy/4W+XsY8UM=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

mini-os/arch/x86/setup.c
hi,everybody

void arch_init(start_info_t *si)
{     ......
      HYPERVISOR_set_callbacks(
             __KERNEL_CS, (unsigned long)hypervisor_callback,
            __KERNEL_CS, (unsigned long)failsafe_callback);
      ......
}

the function HYPERVISOR_set_callbacks() is implemented by do_set_callbacks

*/xen-3.3.0 /xen/arch/x86/x86_32/traps.c*
long do_set_callbacks(unsigned long event_selector,
                      unsigned long event_address,
                      unsigned long failsafe_selector,
                      unsigned long failsafe_address)
{
    struct callback_register event = {
        .type = CALLBACKTYPE_event,
        .address = { event_selector, event_address },
    };
    register_guest_callback(&event);
}

*xen/arch/x86/x86_32/traps.c*
static long register_guest_callback(struct callback_register *reg)
{
    long ret = 0;
    struct vcpu *v = current;
    case CALLBACKTYPE_event:
        v->arch.guest_context.event_callback_cs   = reg->address.cs;     /*registered*/
        v->arch.guest_context.event_callback_eip = reg->address.eip;      /*registered*/
        break;
......
}

Through the above  function call link, the event callback function hypervisor_callback() is registered to xen,but I have three questions:

1) In which  points do v->arch.guest_context.event_callback_cs:v->arch.guest_context.event_callback_eip  be used (or called)?

2) Hypervisor_callback is implemented in the guest kerenl & it eventually call the event handlers implemented by the guest kernel,but how does the  functions in guest kernel context be called in the xen context,more exactly where and how does the function call stack be constructed please?

3) After a event is sent to a guest ,the guest kernel can detect the event and call the corresponding event handler by reading the shared info, in which the mini-os really do, but why does the mini-os still register the event channel callback function ? It seems there are two ways in which the event handler is called ,is it right? If it is right ,why xen give the two ways? 
By the way,what does the 'upcall mechanism' means? Does it means the event handler is called by xen  through calling the registered "v->arch.guest_context.event_callback_cs:v->arch.guest_context.event_callback_eip" pointer directly please?


Thanks!
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.