From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Head Subject: Re: Trigger code in domU from dom0 Date: Thu, 21 Aug 2008 20:01:34 -0700 Message-ID: <48AE2C0E.8060204@cs.ubc.ca> References: <7ef321c10808211607j2d561064rfdcbd56aee589b66@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <7ef321c10808211607j2d561064rfdcbd56aee589b66@mail.gmail.com> 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 List-Id: xen-devel@lists.xenproject.org -----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-----