All of lore.kernel.org
 help / color / mirror / Atom feed
From: Toby Karyadi <toby.karyadi@gmail.com>
To: Manuel Bouyer <bouyer@antioche.eu.org>
Cc: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH v2 0/3] Add support for NetBSD gntdev
Date: Mon, 03 Dec 2012 14:47:42 -0500	[thread overview]
Message-ID: <50BD01DE.1050809@gmail.com> (raw)
In-Reply-To: <20121130105058.GA3457@asim.lip6.fr>

On 11/30/12 5:50 AM, Manuel Bouyer wrote:
> On Fri, Nov 30, 2012 at 10:43:21AM +0000, Ian Campbell wrote:
>> On Fri, 2012-11-30 at 10:38 +0000, Manuel Bouyer wrote:
>>> On Fri, Nov 30, 2012 at 10:32:32AM +0000, Ian Campbell wrote:
>>>> libxl only selects the backend itself if the caller doesn't provide one.
>>>> If the caller sets the backend field !=  UNKNOWN then libxl will (try)
>>>> and use it. This field is exposed by xl via the backendtype= key in the
>>>> disk configuration
>>>> http://xenbits.xen.org/docs/unstable/misc/xl-disk-configuration.txt
>>> thanks for pointing this out.
>>> I guess qdisk is the qemu backend, and tap would be the in-kernel backend ?
>> qdisk == qemu, tap == blktap, phy == in kernel.
> OK; but then, how does the script called by xenbackendd know what setup
> is should do ? With xm, it would get a string in the form
> phy:/dev/wd0e
> or
> file:/domains/foo.img
>
> but from what I've understant, this syntax is deprecated now ?

Hi Manuel, thanks for all of your work on xen.

So, the short answer is that the /usr/pkg/etc/xen/scripts/block 
executable (which is just a shell script) needs to fish the type of the 
backend and other extra info out of xenstore. In the case of netbsd's 
block script, it uses the xenstore-read utility. When the block script 
is called, $1 ($xpath) will be an entry like so 
/local/domain/0/backend/vbd/2/768; so this is vbd for domU instance #2 
with disk instance id 768. $2 ($xstatus) is the reason the block script 
is called, 2 for startup, and 6 for tear down.

If you look at the block script you can also see that the block script 
needs to fish out the type of the backend that is located at $xpath/type 
in xenstore. The block script utilizes the xenstore-read and 
xenstore-write to read/modify xenstore, if you notice.

So, under $xpath here are the pertinent entries:
- $xpath/type
- $xpath/params
- $xpath/physical-disk

With xm+xend, for disk config file:/var/xen/domu/server001/disk.img, 
prior to the block script getting called:
$xpath/type = 'file'
$xpath/params = '/var/xen/domu/server001/disk.img'
$xpath/physical-disk = <unspecified>

Then when the block script is called, it detects that the type is 'file' 
and so it would call vnconfig using the value $xpath/params as the 
actual file using an unused vnd device, say vnd2. Then it would modify 
$xpath/physical-disk using the xenstore-write utility and set the value 
of $xpath/physical-disk to /dev/vnd2. After that, the handling, 
everything else is handled as if the backend is an actual physical 
device, which is true.

If the value of $xpath/type is 'phy', nothing needs to be done, since 
$xpath/physical-disk has been setup properly.

Now, the above behavior is how xm+xend+xenbackendd works. There was a 
bug in libxl/xl that I fixed as described here 
http://mail-index.netbsd.org/port-xen/2012/05/29/msg007252.html so that 
libxl/xl would behave the same way. You might also notice, I made small 
changes to allow custom backend type. I don't mean to keep tooting my 
own horn, but I just don't want the fix to get lost, although I just 
learned that I probably should do a bug report with the patch, but I 
don't have much time right now.

Hopefully I don't bore you to death if you read this far, but the way 
the libxl/xl is going seems somewhat ridiculous, where they are trying 
to insert more and more policy vs functionality, as evidenced by Roger's 
effort to outrightly to just decide (hence a policy) that 'well, vnd 
can't work with file on NFS, so be damn with it and just route 
everything via qemu-dm'. Additionally, they are planning to retire 
xenbackendd and again this is a trend that I don't like where they clump 
everything into one giant ball called the libxl/xl, as opposed to a 
bunch of little executables doing specific things. Another illustration: 
you might ask who's managing the domU in the absence of xend; well what 
happens is that when you do 'xl create ...' xl would then daemonize 
itself to watch xenstore for that specific domU that it just created. I 
guess that's cool, but to me it's got the feel to put everything into 
one giant, monolithic, unflexible entity (shudder).

So, I'm just writing to give you some more information about this whole 
libxl/xl stuff, and hopefully it'll give you some arsenal so that some 
of the xen folks don't try to force policies that is claimed to protect 
'end-user' or very linux specific.

Cheers,
Toby

  parent reply	other threads:[~2012-12-03 19:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1354210308-23251-1-git-send-email-roger.pau@citrix.com>
2012-11-29 17:31 ` [PATCH v2 1/3] libxc: add suport for NetBSD gntdev Roger Pau Monne
2012-11-29 17:31 ` [PATCH v2 2/3] libxl: fix wrong comment Roger Pau Monne
2012-11-29 17:31 ` [PATCH v2 3/3] libxl: switch NetBSD file backend to Qemu if filesystem is not local Roger Pau Monne
2012-11-29 18:56 ` [PATCH v2 0/3] Add support for NetBSD gntdev Manuel Bouyer
     [not found] ` <20121129185635.GA1045@asim.lip6.fr>
2012-11-30  8:42   ` Roger Pau Monné
     [not found]     ` <20121130085241.GC311@asim.lip6.fr>
2012-11-30  9:21       ` Roger Pau Monné
     [not found]         ` <20121130094143.GA10993@asim.lip6.fr>
     [not found]           ` <50B88325.1050009@citrix.com>
2012-11-30 10:10             ` Manuel Bouyer
2012-11-30 10:32             ` Ian Campbell
2012-11-30 10:38               ` Manuel Bouyer
     [not found]                 ` <1354272201.6269.113.camel@zakaz.uk.xensource.com>
     [not found]                   ` <20121130105058.GA3457@asim.lip6.fr>
2012-12-03 19:47                     ` Toby Karyadi [this message]
2012-12-03 21:34                       ` Roger Pau Monné
     [not found]                       ` <50BD1ACD.2030001@citrix.com>
2012-12-03 22:54                         ` Toby Karyadi
2012-12-21 17:48                       ` Ian Jackson
     [not found] ` <1354210308-23251-2-git-send-email-roger.pau@citrix.com>
2012-12-04 14:45   ` [PATCH v2 1/3] libxc: add suport " Ian Campbell
     [not found]   ` <1354632334.15296.13.camel@zakaz.uk.xensource.com>
2012-12-04 14:57     ` Roger Pau Monné
     [not found] ` <1354210308-23251-3-git-send-email-roger.pau@citrix.com>
2012-12-04 15:50   ` [PATCH v2 2/3] libxl: fix wrong comment Ian Campbell
2012-11-29 17:31 [PATCH v2 0/3] Add support for NetBSD gntdev Roger Pau Monne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50BD01DE.1050809@gmail.com \
    --to=toby.karyadi@gmail.com \
    --cc=bouyer@antioche.eu.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.