xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@entel.upc.edu>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: xen-devel <xen-devel@lists.xensource.com>,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>
Subject: Re: Driver domains and hotplug scripts, redux
Date: Mon, 9 Jan 2012 11:08:25 +0100	[thread overview]
Message-ID: <CAPLaKK4KDTmOjudDJ9XUM1id3VTBibAomXTDw2AHX0g8Bs2Fpw@mail.gmail.com> (raw)
In-Reply-To: <20229.59079.535980.830271@mariner.uk.xensource.com>

2012/1/5 Ian Jackson <Ian.Jackson@eu.citrix.com>:
> Roger Pau Monné writes ("Re: [Xen-devel] RFC: Still TODO for 4.2?"):
>> I don't know much about driver domains, but from what I've read they
>> should be running something like NetBSD xenbackend and listen for
>> xenstore events. Most of the functions that I've written on my hotplug
>> series can be used to create a little daemon, that's not the problem,
>> the problem is what can we use to synchronize hotplug script calling
>> and libxl (what comes to mind is using a dedicated xenstore variable
>> for each device, but someone might have a better idea).

Sorry I didn't reply earlier, I was still on holidays (mostly working
with the autotools stuff).

> This envisages devicer setup/teardown scripts in driver domains
> running in a different way to those in the same domain as the
> toolstack.  Are we sure this is a good idea ?

No, I think it's best that even is the driver domain is Dom0 the same
procedure should be executed, and xenbackendd should be running in
every driver domain, Dom0 included, toolstack should never execute
hotplug scripts directly.

> I think it would be preferable to have only one interface to device
> scripts, which is used everywhere.  That interface would have to
> involve initiation by the toolstack, and collection of resulting
> success/failure/etc., via xenstore.

Are we only going to use xenstore to share information between both
domains (Dom0 <--> Driver domain)?

I'm going to comment the vif case, but I think both vif and block
devices should follow the same approach, and hotplug script execution
has to be something "standard" and should not rely on the type of the
device.

> The sequence of events for vifs with a kernel-level backend needs
> to go like this:
>  * toolstack tells backend domain to create vif, via xenstore

How does the toolstack tell a domain to create a device? Creating a
xenstore entry like:

/local/domain/<domid>/backend/vif/...

does trigger the creation of a vif interface in the <domid> domain?

>  * backend kernel creates a virtual network interface vifNN
>  * something in backend domain notices that this vifNN
>    has appeared and consequently

This should be handled by xenbackendd (I know it will not exactly be
xenbackendd, but let's call it that way to simplify things), since it
should be listening to /local/domain/<domid>/backend/* for changes and
react upon them.

>  * device setup script runs, enslaves vifNN to bridge, adds
>    it to routing tables, gives it an address, etc.

Handled by hotplug scripts.

>  * something in backend domain domain tells toolstack vif is ready

Hotplug scripts should change backend state (and write the appropriate
values) to notify everything when ok. Since xenbackendd is the one
that executes the scripts, it should examine the exit code of the
called hotplug script and write the exit status code and message if
hotplug script execution is not successful. This values can be
retrieved from the toolstack and notify the user if something failed.

>  [ device is used ]
>  * toolstack tells backend domain to destroy vif; perhaps entire
>    xenstore directory is forcibly removed??

If entire xenstore directory is forcibly removed, how does xenbackendd
know the parameters to pass to the hotplug script to shutdown the
device? Do we have to keep a copy of this somewhere else (xenstore or
create a xenbackendd private database)?

Here we have two cases, whether it is a shutdown or a destroy:

When doing a shutdown the toolstack should wait to get a notification
from the driver domain that hotplug execution was done (either
successfully or not) and then proceed with the removal of xenstore
directory.

DomU closes device --> driver domain notices --> execution of hotplug
scripts --> write result to xenstore --> toolstack reads results of
hotplug teardown.

When doing a destroy, the toolstack should manually set the frontend
state to closed, and thus force the execution of hotplug scripts in
the driver domain? I know this has been a cause of discussion in
previous patches, but I really don't see the problem with modifying
the frontend status if the domain is already dead, it's just a way to
force the unplug of the device and the execution of hotplug scripts.
Normally the DomU should set the frontend status to closed, but since
we killed it from the toolstack, it should be the toolstack itself the
one in charge of setting the status to closed.

toolstack kills domain --> toolstack sets frontend status to closed
--> driver domain kernel notices frontend change and closes backend
--> xenbackendd noticies change --> execution of hotplug scripts -->
write results to xenstore --> toolstack reads results of hotplug
teardown.

>  * backend kernel removes virtual network interface immediately
>    and all routes, bridge enslavements, etc., are undone
>  * something in backend notices the removal
>  * device teardown script may need to remove eg firewall rules
>  * when this is complete, the backend domain notifies the
>    toolstack (how??)

Should the toolstack wait for a notification from the driver domain? I
think it is important that the toolstack is always aware of what
happens in the driver domain, and it should wait for the execution of
the teardown hotplug scripts and catch it's results, to notify the
user if it is not successful.

> For block devices with a kernel-level backend:
>  * toolstack tells backend domain to create vbd
>    parameters include: vbd number, target??, script??
>  * something in backend domain notices this and consequently
>  * device setup script runs, creates a suitable actual
>    block device in backend domain
>  * backend kernel picks up actual block device details and
>    becomes available to guest
>  * something in backend domain tells the toolstack all is well
>  [ device is used ]
>  * toolstack tells backend domain to destroy vbd; perhaps entire
>    xenstore directory is forcibly removed??
>  * backend kernel removes its actual backend and closes the
>    block device, and somehow notifies userspace when this
>    is done so that
>  * device teardown script cleans up, including making actual
>    block device go away (if it was one which the setup script
>    created)
>  * when this is complete, the backend domain notifies the
>    toolstack (how??)
>
> For block devices with a user-level backend:
>  * toolstack tells backend domain to create vbd
>    parameters include: vbd number, target??, script??
>  * userland backend notices this, does its housekeeping
>    and setup, and tells the toolstack all is well
>  [ device is used ]
>  * toolstack tells backend domain to destroy vbd; perhaps entire
>    xenstore directory is forcibly removed??
>  * userland backend removes its actual backend and closes the
>    resources it was using, and
>  * notifies the toolstack (how??)

When it comes to block hotplug scripts, we have to let xenbackendd
decide which kind of backend to use, so we should agree on what to
write to xenstore that can cover all types of block backends (phy,
qdisk, blktap...), since the toolstack probably doesn't have access to
the requested medium.

> Much of this seems to be covered by, or coverable by, the existing
> xenstore protocol.  I think we just need to define in more detail
> exactly how it should all work, and on each platform how the
> "something"s work.
>
> Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  parent reply	other threads:[~2012-01-09 10:08 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-04 16:29 RFC: Still TODO for 4.2? Ian Campbell
2012-01-04 16:47 ` Konrad Rzeszutek Wilk
2012-01-04 16:51   ` Stefano Stabellini
2012-01-16 13:42     ` Ian Campbell
2012-01-04 16:55 ` Jan Beulich
2012-01-16 13:39   ` Ian Campbell
2012-01-16 14:48     ` Jan Beulich
2012-01-16 15:00       ` Stefano Stabellini
2012-01-04 17:25 ` Pasi Kärkkäinen
2012-01-04 17:36   ` George Dunlap
2012-01-04 18:20   ` Tim Deegan
2012-01-05 10:39     ` Ian Campbell
2012-01-06 15:24       ` RFC: Still TODO for 4.2? Nested Paging for Intel Nested Virt Pasi Kärkkäinen
2012-01-04 19:21   ` RFC: Still TODO for 4.2? Wei Huang
2012-01-04 19:43     ` Pasi Kärkkäinen
2012-01-04 19:57       ` Wei Huang
2012-01-05  7:27         ` Pasi Kärkkäinen
2012-01-06 15:37         ` Konrad Rzeszutek Wilk
2012-01-06 19:08           ` Wei Huang
2012-02-06 17:57           ` Pasi Kärkkäinen
2012-02-13 17:52             ` Extracting ATI/AMD Radeon VBIOS ROM Pasi Kärkkäinen
2012-01-05 13:19       ` Re : RFC: Still TODO for 4.2? David TECHER
2012-01-05 13:25         ` Ian Campbell
2012-01-05 13:41           ` Re : " David TECHER
2012-01-05 16:18             ` Ian Campbell
2012-01-16 13:28   ` Ian Campbell
2012-01-16 14:39     ` Re : " David TECHER
2012-01-04 17:39 ` Roger Pau Monné
2012-01-05 18:07   ` Driver domains and hotplug scripts, redux Ian Jackson
2012-01-06 12:01     ` Stefano Stabellini
2012-01-09 10:08     ` Roger Pau Monné [this message]
2012-01-09 12:26       ` Stefano Stabellini
2012-01-09 17:39         ` Ian Jackson
     [not found]           ` <alpine.DEB.2.00.1201101448030.3150@kaball-desktop>
     [not found]             ` <20236.23822.715733.455559@mariner.uk.xensource.com>
     [not found]               ` <alpine.DEB.2.00.1201101547540.3150@kaball-desktop>
     [not found]                 ` <20236.24780.865152.458124@mariner.uk.xensource.com>
     [not found]                   ` <alpine.DEB.2.00.1201101619460.3150@kaball-desktop>
     [not found]                     ` <20236.27158.706017.813195@mariner.uk.xensource.com>
     [not found]                       ` <alpine.DEB.2.00.1201101655390.3150@kaball-desktop>
     [not found]                         ` <20236.28931.127139.752426@mariner.uk.xensource.com>
2012-01-11 11:50                           ` Roger Pau Monné
2012-01-11 12:17                             ` Ian Campbell
2012-01-11 14:26                               ` Dave Scott
2012-01-12 16:50                                 ` Ian Jackson
2012-01-12 18:07                                   ` Dave Scott
2012-01-11 14:44                               ` Roger Pau Monné
2012-01-12 16:48                               ` Ian Jackson
2012-01-16 17:52                                 ` Roger Pau Monné
2012-01-16 17:58                                   ` Ian Jackson
2012-01-17  9:17                                     ` Ian Campbell
2012-01-17  9:30                                       ` Roger Pau Monné
2012-01-17  9:43                                         ` Ian Campbell
2012-01-17  9:40                                       ` Roger Pau Monné
2012-01-17  9:52                                         ` Ian Campbell
2012-01-17 10:00                                           ` Roger Pau Monné
2012-01-17 10:39                                             ` Ian Campbell
2012-01-23 11:40                                               ` Roger Pau Monné
2012-01-27  8:43                                                 ` Roger Pau Monné
2012-01-27 10:57                                                   ` Stefano Stabellini
2012-01-31  9:57                                                     ` Roger Pau Monné
2012-01-31 10:06                                                       ` Tim Deegan
2012-01-31 13:47                                                         ` Stefano Stabellini
2012-01-31 13:51                                                           ` Ian Campbell
2012-01-31 13:51                                                       ` Stefano Stabellini
2012-01-31 20:02                                                       ` Ian Campbell
2012-01-17  9:22                                     ` Roger Pau Monné
2012-01-11 12:50                             ` Stefano Stabellini
2012-01-05 17:49 ` RFC: Still TODO for 4.2? Ian Jackson
2012-01-06 13:37   ` Ian Campbell
2012-01-10 16:06     ` Ian Jackson
2012-01-16 11:55 ` George Dunlap
2012-01-19 21:14 ` RFC: Still TODO for 4.2? xl domain numa memory allocation vs xm/xend Pasi Kärkkäinen
2012-01-20  7:59   ` Ian Campbell
2012-01-20  8:15     ` Pasi Kärkkäinen
2012-01-20  9:01       ` Ian Campbell
2012-01-20  9:47         ` Dario Faggioli
2012-01-20 11:56           ` Ian Campbell
2012-01-23  9:59         ` Juergen Gross
2012-01-20 10:55     ` Stefano Stabellini
2012-01-20 11:22       ` Ian Campbell
2012-01-20 11:25         ` Stefano Stabellini
2012-01-20 11:44         ` Dario Faggioli
2012-01-20 11:54           ` Ian Campbell
2012-01-20 12:04             ` Dario Faggioli
2012-01-20 12:33               ` Ian Campbell
2012-01-20 13:11                 ` Ian Campbell
2012-01-20 15:06                   ` Ian Campbell
2012-01-20 16:02                     ` Dario Faggioli
2012-01-20 16:21                       ` Ian Campbell
2012-01-20 16:28                         ` Ian Campbell
2012-01-20 16:31                           ` George Dunlap
2012-01-20 16:39                             ` Ian Campbell
2012-01-20 16:43                               ` George Dunlap
2012-01-20 16:54                                 ` Ian Campbell
2012-01-20 17:32                                   ` Dario Faggioli
2012-01-23 10:19                                     ` Ian Campbell
2012-01-23 13:14                                       ` Dario Faggioli
2012-01-23 13:20                                         ` Ian Campbell
2012-01-20 16:55                                 ` Ian Campbell
2012-01-20 16:59                                   ` George Dunlap
2012-01-20 16:58                         ` Dario Faggioli
2012-01-20 17:23                           ` Ian Campbell
2012-01-20 17:28                             ` Dario Faggioli
2012-01-20 11:26       ` Dario Faggioli

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=CAPLaKK4KDTmOjudDJ9XUM1id3VTBibAomXTDw2AHX0g8Bs2Fpw@mail.gmail.com \
    --to=roger.pau@entel.upc.edu \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=stefano.stabellini@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).