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

Re: [Xen-users] How to set up trivial shared-memory buffer between VMs (on ARM) ?

On Tue, 2015-10-06 at 20:41 +0000, Chris (Christopher) Brand wrote:
> > What I don't understand is how the virtual device gets created. When
> > the
> > drivers get installed, they register with xenbus, and then all the
> > actual
> > communication setup happens in the respective probe functions, but what
> > triggers the kernel to call those probe functions ? I guess in the
> > blk/net case
> > this ties in to the config file for the guest...?
> Replying to myself :-)
> Looks like this is done through xenstore, is that correct ?


The generic xenbus fe driver has a watch in /local/domain/$domid/devices
and will send probe events to the corresponding driver for anything which
is created under there. e.g. vbd/0 will be passed to the driver which
claims to be the vbd frontend (which will be xen-blkfront.ko in Linux).

Under Linux core will also generate hotplug events with suitable aliases if
there is no driver, causing xen-blkfront.ko to be autoloaded as needed.

> So libxl writes to xenstore as part of the creation of the new guest, and
> that is triggered by the entries in the config file for the new guest. So
> how can I do this for my device ? I tried running xenstore-write (on
> Dom0) to create an appropriate node, but that didn't seem to have any
> effect (or maybe I'm doing something wrong...) I tried both before and
> after running xl create.

It should be possible to do with xenstore-write, you might find it easier
to create the guest paused (-p), create the front _and_ backend nodes and
then unpause the guest, but with hotplug the pause ought really to make no

Do you have a frontend driver and backend driver? Are you configuring both.
In general f/e's require a backend node in xs pointing to their peer, but
I'm not sure if this is implemented on a driver by driver basis or if the
core is involved. I'm also not sure offhand which set of keys the core
would require to exist before it did anything.

I'm sure I had an example of manually plugging a device with xenstore-write
and that I had posted it at some point but I can't find it anywhere on the
list archives, wiki or in my development folders :-/.

http://wiki.xenproject.org/wiki/Introduction_to_Xen_3.x, which looks rather
out of date so don't trust it too much, suggests:
xenstore-write /local/domain/X/device/mydevice/0/state 1
xenstore-write /local/domain/0/backend/mydevice/X/0/frontend-id X
xenstore-write /local/domain/0/backend/mydevice/X/0/frontend 
xenstore-write /local/domain/0/backend/mydevice/X/0/state 1

as a minimal set. Personally I'd do it all with one:
    xenstore-write KEY1 VALUE1 KEY2 VALUE2 KEY3 VALUE3
so it all gets done in a single transaction.


Xen-users mailing list



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