From: Mark Williamson Subject: Re: back/frontend drivers HelloWorld Date: Thu, 22 Sep 2005 17:04:00 +0100 Message-ID: <200509221704.01201.mark.williamson@cl.cam.ac.uk> References: <200509221746.32758.tiger@swsoft.mipt.ru> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <200509221746.32758.tiger@swsoft.mipt.ru> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Anton Korenyushkin List-Id: xen-devel@lists.xenproject.org > I'm trying to write 2 simple xen0/xenU modules, which only transfer string > "Hello world" by grant tables interface. But in docs/misc/grant-tables.txt > there is no explanation of how to transmit grant table reference to another > domain: > .. gref is then somehow transmitted to domB for use. > > I'm reading blkback/front driver's code, but it is too complicated. I've > understood that i should use message rings for my task (i've read > docs/misc/blkif-drivers-explained.txt too). But how to get such ring? You share it using grant tables ;-) I'll assume that since you're using grant-tables you're developing on 3.0-unstable (the control plane was very different on Xen 2.0). > May be a simple example of solution such problem exists, so could you point > me on this example? To share the initial grant reference you using "xenstore". This is a hierarchical directory structure, holding names "keys" which contain arbitrailty structured data. Think "registry" ;-) The kernel interface to Xenstore is the Xenbus - you use Xenbus API functions in the kernel to write and read the keys in the store. By writing the grant reference into a key at a standard location, you can communicate it from the frontend to the backend. This is what the block and network devices do. For a very simple driver, you might want to bypass the complexity of using Xenstore at all... How about passing the grant reference on the command line? Add a printk to the frontend, outputting the reference ID to the dmesg log, then pass this as an argument when you load the module for the backend driver. Just a thought... (side note: I'm not sure if we currently export all the symbols required for an unloadable backend - if not, we probably should). > Sorry for bad English. Way better than my Russian ever was. For that matter, probably better than my English too ;-) Poka! Mark