* Trigger code in domU from dom0
@ 2008-08-21 23:07 Asim
2008-08-22 3:01 ` Christopher Head
[not found] ` <48AE2AA4.9000104@cs.ubc.ca>
0 siblings, 2 replies; 4+ messages in thread
From: Asim @ 2008-08-21 23:07 UTC (permalink / raw)
To: Xen-Devel (E-mail)
Hi,
I want to trigger some code in my domU as soon as migration happens. I
can only know when to trigger in my destination dom0 but the code
should trigger in domU.
How do I go about doing this? Is there any script that completes or is
running that executes when a migration finishes or is about to finish?
Regards,
Asim
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Trigger code in domU from dom0
2008-08-21 23:07 Trigger code in domU from dom0 Asim
@ 2008-08-22 3:01 ` Christopher Head
[not found] ` <48AE2AA4.9000104@cs.ubc.ca>
1 sibling, 0 replies; 4+ messages in thread
From: Christopher Head @ 2008-08-22 3:01 UTC (permalink / raw)
To: xen-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I'm doing something very similar for a research project. Assuming your
domU is PV, look in linux/drivers/xen/core/reboot.c and
linux/drivers/xen/core/machine_reboot.c. You'll discover that the dom0
tools don't actually suspend the domU for migration: instead, they send
an event channel event to domU which then suspends itself via a
hypercall. All you have to do is pick a place sufficiently close to the
hypercall to run your own code.
Note that this is SMP safe as well: one of the first things the kernel
does when the suspend message is received is shut down all CPUs except
for #0, so only #0 will be alive around the hypercall. Combining that
with the lack of preemption in the Xen kernel, you have a situation
where your code is guaranteed to run before anything else.
Chris
Asim wrote:
| Hi,
|
| I want to trigger some code in my domU as soon as migration happens. I
| can only know when to trigger in my destination dom0 but the code
| should trigger in domU.
| How do I go about doing this? Is there any script that completes or is
| running that executes when a migration finishes or is about to finish?
|
| Regards,
| Asim
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: GnuPT 2.7.2
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkiuLA0ACgkQiD2svb/jCb7h/gCeNrT5yZXcX8T8oRlcFOtkSTQI
gFwAn00RJmlo6xuQpxLOZg4Yo9fM/gpE
=7q20
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Trigger code in domU from dom0
[not found] ` <7ef321c10808212014n1db69d6ej124a13431ab13bfb@mail.gmail.com>
@ 2008-08-22 4:13 ` Christopher Head
2008-08-22 22:02 ` Asim
0 siblings, 1 reply; 4+ messages in thread
From: Christopher Head @ 2008-08-22 4:13 UTC (permalink / raw)
To: Asim, xen-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
As far as live migration, this should work perfectly as long as you want
your code to run **after** migration and not before. Live migration
differs from regular migration only in that the tools copy a pile of
memory pages without suspending the domain (meaning domU doesn't know
when this starts happening), then suspend the domain and copy the last
few pages. The event channel (or xenstore) mechanism used to trigger the
suspend is the same, though, meaning you can hook your code in and be
notified either between the mass copying and the copying of the last few
pages (before the hypercall), or after all migration is done (after the
hypercall).
I didn't see any documentation on the code, I just browsed the source.
For my purposes I'm not so much interested in IRQs, I'm more interested
in running before userspace gets a chance to run - so I'm not sure about
what you need for your project.
Chris
Asim wrote:
| Thanks a lot Chris for the response. I have some followup questions:-
|
| 1. Does this hold for "live" migration as well?
|
| 2. I want to run my code when all devices/irqs are available. The
| post_suspend looks like a good place to me. Did you get this
| information via mere source code browsing or there is a reference to
| it. It would be great for me to know where this is in migration stage
| in terms of dom0 - Is it after dom0 declared migration finished?
|
| 3. Thanks a lot for your help.
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: GnuPT 2.7.2
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkiuPNEACgkQiD2svb/jCb7DyACfTmUoolUKYDjSWK+6MWWMGRoQ
DAcAnR9D4LweqxryduJdpLRheROVqFEO
=8mEz
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Trigger code in domU from dom0
2008-08-22 4:13 ` Christopher Head
@ 2008-08-22 22:02 ` Asim
0 siblings, 0 replies; 4+ messages in thread
From: Asim @ 2008-08-22 22:02 UTC (permalink / raw)
To: Christopher Head; +Cc: xen-devel
Thanks a lot Chris -- I can see it working fine. I have placed my
calls after the hypercall in take_machine_down in
linux/drivers/xen/core/machine_reboot.c (if suspend is successful) and
it looks to be working good.
Thanks again.
Regards,
Asim
On 8/21/08, Christopher Head <chead@cs.ubc.ca> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> As far as live migration, this should work perfectly as long as you want
> your code to run **after** migration and not before. Live migration
> differs from regular migration only in that the tools copy a pile of
> memory pages without suspending the domain (meaning domU doesn't know
> when this starts happening), then suspend the domain and copy the last
> few pages. The event channel (or xenstore) mechanism used to trigger the
> suspend is the same, though, meaning you can hook your code in and be
> notified either between the mass copying and the copying of the last few
> pages (before the hypercall), or after all migration is done (after the
> hypercall).
>
> I didn't see any documentation on the code, I just browsed the source.
> For my purposes I'm not so much interested in IRQs, I'm more interested
> in running before userspace gets a chance to run - so I'm not sure about
> what you need for your project.
>
> Chris
>
> Asim wrote:
> | Thanks a lot Chris for the response. I have some followup questions:-
> |
> | 1. Does this hold for "live" migration as well?
> |
> | 2. I want to run my code when all devices/irqs are available. The
> | post_suspend looks like a good place to me. Did you get this
> | information via mere source code browsing or there is a reference to
> | it. It would be great for me to know where this is in migration stage
> | in terms of dom0 - Is it after dom0 declared migration finished?
> |
> | 3. Thanks a lot for your help.
> |
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.9 (GNU/Linux)
> Comment: GnuPT 2.7.2
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkiuPNEACgkQiD2svb/jCb7DyACfTmUoolUKYDjSWK+6MWWMGRoQ
> DAcAnR9D4LweqxryduJdpLRheROVqFEO
> =8mEz
> -----END PGP SIGNATURE-----
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-08-22 22:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-21 23:07 Trigger code in domU from dom0 Asim
2008-08-22 3:01 ` Christopher Head
[not found] ` <48AE2AA4.9000104@cs.ubc.ca>
[not found] ` <7ef321c10808212014n1db69d6ej124a13431ab13bfb@mail.gmail.com>
2008-08-22 4:13 ` Christopher Head
2008-08-22 22:02 ` Asim
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.