All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Subject: Re: [PATCH 5/6] libxl: introduce libxl__alloc_vdev
Date: Fri, 30 Mar 2012 16:23:12 +0100	[thread overview]
Message-ID: <alpine.DEB.2.00.1203301556100.15151@kaball-desktop> (raw)
In-Reply-To: <20341.49280.31751.307404@mariner.uk.xensource.com>

On Fri, 30 Mar 2012, Ian Jackson wrote:
> Stefano Stabellini writes ("Re: [PATCH 5/6] libxl: introduce libxl__alloc_vdev"):
> > On Tue, 27 Mar 2012, Ian Jackson wrote:
> > > Furthermore, for the purpose for which you're using this, you should
> > > not start at zero (xvda).  You should start at at least 26 (xvdA) and
> > > possibly later.  That way you are less likely to clash with other
> > > statically-allocated vbds.
> >  
> > Another interesting observation but I disagree: why should we expect
> > "statically-allocated vbds" below xvdA? How many do you think we are
> > going to find? Why 26? I think it is very arbitrary.
> > We should just make sure that our allocation policy works well and start
> > from 0.
> 
> Your design assumes that the system administrator has not configured,
> for themselves, any disks to be exposed to dom0 (eg by a driver
> domain).  If they have (eg, run "xl block-attach 0 vdev=xvda ...")
> then they will expect it to work, and they will expect to be able to
> control the device name that this appears as in dom0.  Therefore the
> namespace of xvd* names in dom0 is not freely available to us as libxl
> programmers; we need to avoid trampling all over it.
> 
> Since we need to be able to allocate some vbds dynamically, the right
> approach is to decree that some portion of the dom0 vbd space is
> reserved for static allocations by the administrator, and that the
> remainder is for dynamic allocations by software which picks a free
> vbd.  Naturally the static space should come first.

When you hotplug a new disk on your system, for example a new USB disk
to your native Linux box, usually Linux chooses the device name for
you. I don't see why this should be any different.
The admin is going to call instead:

xl block-attach 0

and then checkout dmesg.


> > > Of course you can't then using the resulting vdev as a pathname in
> > > /dev/ but that's nonportable anyway; different guest OSs (and here we
> > > are playing the role of the guest) may have different conventions.
> > > You need a separate function to convert vdev numbers (as returned from
> > > _disk_dev_number) to pathnames in /dev.
> > 
> > This is a good point and the key issue here.
> > 
> > The frontend is actually free to choose whatever name it wants for the
> > device it is going to create from the dev number.
> 
> I don't think that is true.  On each individual guest platform, the
> relationship between vbd numbers (the actual interface between
> frontend and backend), and whatever that guest has for device names,
> needs to be statically defined.

I disagree: when we introduced docs/txt/misc/vbd-interface.txt we never
specified what names the guest kernel is allowed to choose for a
particular vbd encoding. See the following quote:

"The Xen interface does not specify what name a device should have in the
guest (nor what major/minor device number it should have in the guest,
if the guest has such a concept)."


> > So I think that the best thing we can do is rely on it to find out the
> > device name, either doing:
> > 
> > [1] xvd(a + i) -> libxl__device_disk_dev_number -> xs_read
> 
> This is not correct, because the device name in the guest is not
> written to xenstore anywhere.  It is private to the guest.
> 
> (In this case the "guest" is actually dom0, but the point stands.)
> 
> > or reading the "dev" node under the xenstore backend path, that is
> > generated using the same libxl function (this is what I am doing now).
> > I fail to see why one of these two approaches would be better than the
> > other, but if you think that [1] is the best, I can change my code.
> 
> Again, you are confusing the virtual name given in the domain config
> file with the actual device name in the guest's /dev, which may not be
> the same.

What I find confusing is that before you say that "the relationship
between vbd numbers and whatever that guest has for device names needs
to be statically defined", but then you say that "the device name in the
guest is not written to xenstore anywhere.  It is private to the guest."


In any case that was a conscious decision: considering that we have no
way to know the device name in the guest (see above quote), the best
thing we can do is guessing.  The best guess we can have is using the
mapping implemented in libxl__device_disk_dev_number.

Maybe we can slightly improve the situation moving libxl__alloc_vdev to
an OS specific file so that we can have a Linux and a BSD implementation.
Both are going to be "guessing", in particular the Linux version is just
going to use libxl__device_disk_dev_number, but the BSD version might
want to do something different.

  reply	other threads:[~2012-03-30 15:23 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-27 13:58 [PATCH 0/6] qdisk local attach Stefano Stabellini
2012-03-27 13:59 ` [PATCH 1/6] libxl: libxl_device_disk_local_attach return a new libxl_device_disk Stefano Stabellini
2012-03-27 14:07   ` Ian Campbell
2012-03-30 10:42     ` Stefano Stabellini
2012-03-27 16:21   ` Ian Jackson
2012-03-30 10:43     ` Stefano Stabellini
2012-03-27 13:59 ` [PATCH 2/6] libxl: introduce libxl__device_generic_add_t Stefano Stabellini
2012-03-27 14:04   ` Ian Campbell
2012-03-30 10:44     ` Stefano Stabellini
2012-03-27 16:50   ` Ian Jackson
2012-03-30 10:46     ` Stefano Stabellini
2012-04-02 16:18       ` Ian Jackson
2012-04-03 12:03         ` Stefano Stabellini
2012-03-27 13:59 ` [PATCH 3/6] libxl: add an xs_transaction_t parameter to two libxl functions Stefano Stabellini
2012-03-27 14:17   ` Ian Campbell
2012-03-27 16:50   ` Ian Jackson
2012-03-27 13:59 ` [PATCH 4/6] libxl: introduce libxl__device_disk_add_t Stefano Stabellini
2012-03-27 13:59 ` [PATCH 5/6] libxl: introduce libxl__alloc_vdev Stefano Stabellini
2012-03-27 14:21   ` Ian Campbell
2012-03-27 17:21     ` Ian Jackson
2012-03-30 11:43     ` Stefano Stabellini
2012-03-30 12:14       ` Ian Campbell
2012-03-30 12:57         ` Stefano Stabellini
2012-03-27 17:19   ` Ian Jackson
2012-03-30 11:57     ` Stefano Stabellini
2012-03-30 14:17       ` Ian Jackson
2012-03-30 15:23         ` Stefano Stabellini [this message]
2012-04-02 16:15           ` Ian Jackson
2012-04-03 13:15             ` Stefano Stabellini
2012-04-03 13:17               ` Ian Jackson
2012-04-03 14:19                 ` Stefano Stabellini
2012-04-03 14:24                   ` Ian Jackson
2012-04-10 17:37                     ` Stefano Stabellini
2012-04-11 15:49                       ` Stefano Stabellini
2012-03-27 13:59 ` [PATCH 6/6] xl/libxl: implement QDISK libxl_device_disk_local_attach Stefano Stabellini
2012-03-27 17:20   ` Ian Jackson
2012-03-30 10:50     ` Stefano Stabellini
2012-03-30 13:47       ` Ian Jackson
2012-03-30 14:55         ` Stefano Stabellini

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=alpine.DEB.2.00.1203301556100.15151@kaball-desktop \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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.