This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] how to make xenbus do .probe?

To: Jian Wang <jeans.wang@xxxxxxxxx>
Subject: Re: [Xen-devel] how to make xenbus do .probe?
From: Ryan Riley <rileyrd@xxxxxxxxxx>
Date: Wed, 07 Mar 2007 13:03:30 -0500
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 08 Mar 2007 02:32:37 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <f8c101b70703061835j4c7572a0g88adaded454dfd5b@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <45EDC042.8090003@xxxxxxxxxx> <45EDC185.4060302@xxxxxxxxxx> <f8c101b70703061835j4c7572a0g88adaded454dfd5b@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird (Windows/20070221)
Attached you'll find a simple bash script illustrating how to get both the backend and frontend of the skeleton driver to fire.

Here's how to use it:
-Startup a Xen guest that contains your frontend driver, and be sure dom0 contains the backend driver. -Figure out the frontend-id for the guest. (I only have one guest so, the frontend-id is the number on the first line of `xenstore-ls /local/domain/0/backend/vbd`). Let's pretend that number is 3.
-Run the script as so:  ./probetest.sh mydevice 3

That should fire both probes.

The only tricky things about the script are writing the states in the right order and changing the permissions of one of the xenstore keys.


Jian Wang wrote:
It really works for backend!!
Thanks a lot.
But seems frontend .probe still not got called.
Could you tell me how to adjust the parameter to make the frontend do probe?

On 3/6/07, Ryan Riley <rileyrd@xxxxxxxxxx> wrote:
Yeah, the wiki page you refer to in a later message is incorrect, but I
think that the major thing wrong with it is the xenstore-write commands.
(At the moment I don't have time to check whether the skeleton driver
code is correct, and I can't remember if I had to tweak it when I went
through what you're going through.)

Here's 4 xenstore-write commands that should get a probe out of the device:

xenstore-write /local/domain/5/device/mydevice/0/state 1

xenstore-write /local/domain/0/backend/mydevice/5/0/frontend-id 5

xenstore-write /local/domain/0/backend/mydevice/5/0/frontend

xenstore-write /local/domain/0/backend/mydevice/5/0/state 1

Quick note: That will only work once per boot, because once the driver
is probed with frontend-id 5 the xenbus code seems to be smart enough to
not do it again.  If you need to make another probe happen during the
same boot, just increment the 5 all around.  I hope this helps.


Jian Wang <jeans.wang@xxxxxxxxx> wrote:
>    Hi,
>    Can anyone please tell me how to get  ".probe" function in "struct
>    xenbus_driver" called?
> I want to do one simple test of event channel communication between
>    peer modules of
>    domU and dom0.
>    I wrote one backend and one frontend driver (I tried registered as
>    misc/blk/input device) where I put in all my xenbus routines, but
>    cannot get .probe called after  insmod my module, I have put
>    one week's time to try to find the answer,  failed.
>    Thanks a lot!
>    -Jian


if [ $# != 2 ]
        echo "Usage: $0 <device name> <frontend-id>"
        # Write backend information into the location the frontend will look 
        # for it.
        xenstore-write /local/domain/${2}/device/${1}/0/backend-id 0
        xenstore-write /local/domain/${2}/device/${1}/0/backend \

        # Write frontend information into the location the backend will look 
        # for it.
        xenstore-write /local/domain/0/backend/${1}/${2}/0/frontend-id ${2}
        xenstore-write /local/domain/0/backend/${1}/${2}/0/frontend \

        # Set the permissions on the backend so that the frontend can 
        # actually read it.
        xenstore-chmod /local/domain/0/backend/${1}/${2}/0 r

        # Write the states.  Note that the backend state must be written 
        # last because it requires a valid frontend state to already be 
        # written.
        xenstore-write /local/domain/${2}/device/${1}/0/state 1
        xenstore-write /local/domain/0/backend/${1}/${2}/0/state 1
Xen-devel mailing list
<Prev in Thread] Current Thread [Next in Thread>