From: weiming Subject: Re: how to callback from hypervisor to guest os? Date: Mon, 7 Jul 2008 20:12:29 -0400 Message-ID: References: <1215335738.9407.39.camel@thinkpad.localdomain> <1215379562.22922.21.camel@thinkpad.localdomain> <4872915A.1080705@goop.org> <48729962.1090701@goop.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1694698713==" Return-path: In-Reply-To: <48729962.1090701@goop.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jeremy Fitzhardinge Cc: Xen Developers , Daniel Stodden List-Id: xen-devel@lists.xenproject.org --===============1694698713== Content-Type: multipart/alternative; boundary="----=_Part_19027_4699542.1215475949639" ------=_Part_19027_4699542.1215475949639 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Jeremy, Thanks for your answering. If my understanding is correct, do you mean the hypervisor side should look like: Xen: _interrupt_handler() ... ... event_send(guest_dom) while(event_receive(&result)) { } post: xxx() ... } Thanks a lot! Weiming On Mon, Jul 7, 2008 at 6:32 PM, Jeremy Fitzhardinge wrote: > weiming wrote: > >> Do you mean making a hypercall after guest domain finishes processing? If >> so, in xen, after event_send(), will xxx() be executed immediately >> (non-blocking)? >> >> Xen: Guest: >> >> _interrupt_handler() { >> ... >> ... >> event_send(guest_dom) event_virq_handler() >> post: xxx() { >> do_process() >> >> hypercall_xxx()? >> >> } >> ... >> } >> > > You can get Xen to do a callback into the guest. You can either define > this as an event callback (probably a virq like the timer or debug > interrupts), or a specific callback like syscall, event delivery, failsafe > exceptions etc. That schedules the guest vcpu running at a particular > address in kernel context; it can do whatever processing you want, then do a > hypercall to pass the results back into the hypervisor. > > It's a close as you're going to get to a syncronous "call into guest" > mechanism. On the hypervisor side you're going to have to deal with it as > an async operation with split "call into guest" and "get results from guest" > phases. You also have to deal with the guest calling the hypercall 0-N > times - with no correlation to your callbacks, and with arbitrary arguments > (ie, can't trust the guest's data). > > J > ------=_Part_19027_4699542.1215475949639 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Jeremy,

Thanks for your answering.

If my understanding is correct, do you mean the hypervisor side should look like:

Xen:                                             

_interrupt_handler()                                    
  ...
  ...
  event_send(guest_dom) 
  while(event_receive(&result))
  {

  }                                                  
post: xxx()                                 
                                                           
  ...
}

Thanks a lot!
Weiming

On Mon, Jul 7, 2008 at 6:32 PM, Jeremy Fitzhardinge <jeremy@goop.org> wrote:
weiming wrote:
Do you mean making a hypercall after guest domain finishes processing?  If so, in xen, after event_send(), will xxx() be executed immediately (non-blocking)?

Xen:                                              Guest:

_interrupt_handler()                                     {
  ...
  ...
  event_send(guest_dom)                event_virq_handler()
post: xxx()                                  {
                                                             do_process()
                                                             hypercall_xxx()?

                                                    }
  ...
}

You can get Xen to do a callback into the guest.  You can either define this as an event callback (probably a virq like the timer or debug interrupts), or a specific callback like syscall, event delivery, failsafe exceptions etc.  That schedules the guest vcpu running at a particular address in kernel context; it can do whatever processing you want, then do a hypercall to pass the results back into the hypervisor.

It's a close as you're going to get to a syncronous "call into guest" mechanism.  On the hypervisor side you're going to have to deal with it as an async operation with split "call into guest" and "get results from guest" phases.  You also have to deal with the guest calling the hypercall 0-N times - with no correlation to your callbacks, and with arbitrary arguments (ie, can't trust the guest's data).

  J

------=_Part_19027_4699542.1215475949639-- --===============1694698713== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1694698713==--