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

Re: [Xen-devel] questions regarding interdomain communication and xen-guest communication



On 28/10/13 15:21, Aastha Mehta wrote:
> On 25 October 2013 14:18, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>>>> Aastha Mehta <aasthakm@xxxxxxxxx> 10/24/13 7:32 PM >>>
>>> On 24 October 2013 09:09, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>>>>>> Aastha Mehta <aasthakm@xxxxxxxxx> 10/23/13 7:44 PM >>>
>>>>> In case of an asynchronous I/O does one guest have to
>>>>> register its callbacks with the other guest directly?
>>>>> Or does one guest hypercall into xen, which then upcalls into the
>>>>> other guest and then transfer reply in the reverse using another pair
>>>>> of hypercall and upcall?
>>>> Again, the latter.
>>> So when one guest (G1) shares pages with second (G2), for example for
>>> block I/O, G1 will inform second via xen about a shared page.
>> How this information is propagated is up to you; commonly this is being
>> done via xenstore.
>>
>>> G1 will also register a callback with Xen.
>> That callback will need to be registered in any case - the (general)
>> event upcall.
>>
> Could you please clarify which general event upcall are you referring to here?
>
>>> When Xen upcalls into G2 to forward G1's request, does it block on G2's 
>>> reponse?
>> Why would it - it acts as a passive agent here only.
>>
>>> How does G2 send back the result of I/O to G1?
>> Generally as contents of the shared page.
>>
>> But really - please take a look at the various existing backend/frontend
>> drivers.
>>
>>>>> Regarding xen -- domain communication: how can xen send some request
>>>>> to dom0 for some operation that needs to be performed in the dom0 and
>>>>> get back results from the dom0?
>>>> Look at the MCE polling Dom0 performs for example, or the memory pressure
>>>> threshold handling: One model would be for Dom0 to set up a (dedicated)
>>>> vIRQ for that purpose, and Xen trigger that vIRQ when it needs Dom0's help.
>>> Just to clarify, will guest return the result of the operation using a
>>> hypercall?
>> First of all there's generally no "result" in the examples I gave. Instead,
>> Xen simply requests a certain kind of action to be taken. And Xen in fact
>> must not depend on whether or when that action is being taken. But in
>> general it might well be that the action requested consists of one or more
>> hypercalls.
>>
>> Jan
>>
> Let me clarify my question a bit more. My requirement is that I need
> to perform some computations on an application data, but I cannot
> allow the application to do so directly. I would like to provide the
> computation as a service from, say dom0. Here are two approaches that
> come to my mind -
> Approach 1
> 1. Application makes a syscall into DomU kernel requesting for the 
> computation.
> 2. DomU copies the application data into a kernel buffer and makes a
> hypercall into Xen forwarding application's request.
> 3. Xen upcalls into dom0 kernel for the service (a new vIRQ?).
> 4. Dom0 performs the computation and sends the results back to Xen via
> a hypercall.
> 5. Xen returns the results to DomU kernel through another upcall (another 
> vIRQ).
> 6. DomU kernel forwards the result to the application and returns the syscall.
>
> Approach 2
> Replace steps 2-5 in the above approach with interdomain event channel
> notification between dom0 and domU and sharing the data pages through
> grant table mechanism. So domU will notify dom0 that it has sent a
> request for the computation, after placing the data to be used in the
> shared memory. dom0's handler will get the request and the shared
> data, compute the result, place it in another shared memory region and
> notify domU of the completion of the request.
>
> Do the two approaches even make sense?
> I looked at the blkfront-blkback drivers, and how they use event
> channels, grant tables and xenbus. If I understand correctly, the
> event channels have to be associated with the xenbus, but it seems
> that xenbus can only be used by drivers. I do not understand how the
> event channels can be setup ad hoc between two domains. How do I know
> what xenbus_device to connect to?
>
> Another question I have is, if a domU makes a hypercall into Xen and
> if the hypercall is long running, does it block the entire domU until
> the hypercall returns? What if there are multiple vcpus?
>
>
> Thanks and regards,
> Aastha.

This description sounds very much like you want to be using libchan,
which provides a communication mechanism between two domains.  It will
take care of the shared memory and event channels, leaving you with an
API for sending and receiving data.

With hypercalls, they will typically only block the vcpu which makes the
hypercall.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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