From: Edwin Zhai Subject: Re: [PATCH] - add symmetry to para and fully virtualized domain shutdown/reboot Date: Tue, 4 Apr 2006 23:15:59 +0800 Message-ID: <20060404151559.GA14606@edwin-gen.ccr> References: <443145FF.5050800@virtualiron.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <443145FF.5050800@virtualiron.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: Ben Thomas Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org thomas, your patch is reasonable. as my understanding, destroy is totally different from shutdown. destroy just issues a hyper-call(DOM0_OP), while shutdown writes xenstore and waits the guest handling almost everything( use sched_op hypercall for itself). so, qemu's destroy command(kill hvm dom immediately when hang) should use the original destroy hyper-call to take place of "xm destroy". On Mon, Apr 03, 2006 at 11:57:51AM -0400, Ben Thomas wrote: > Add code to make handling domain poweroff/reboot symmetrical > between paravirtualized and fully virtualized. > > A paravirtualized domain uses sched_op to shut down and set the > reason code. This will send a VIRQ_DOM_EXC, which can be > handled in dom0 by control software. In some ways, this resembles > SIGCHILD/waitpid, and is a reasonable model. > > The fully virtualized case has qemu invoke xm directly. This is a > different path than paravirtualized. It also removes > decision and policy making choices from the rest of the control > software and places it within qemu. When any dom0 logic > eventually gets a VIRQ_DOM_EXC, the information about the > domain is gone having been destroyed by xm. > > It would be useful if all shutdown/reboot operations were > symmetrical from domain 0's point of view. One approach > would be to redefine sched_op to handle other domains than > the current domain, but this seemed excessive. Another > approach, which is what this patch implements, adds > a DOM0 hypervisor call very similar to the existing > DOM0_DESTROYDOMAIN, called DOM0_SHUTDOWNDOMAIN, which handles > the shutdown and reason -- basically, just like a > paravirtualized system. > > Like DOM0_DESTROYDOMAIN, add a xenctrl wrapper, and have qemu > call it. > > With this change, both domain types shutdown/reboot using > the same dom0 management logic. All control decisions are > removed from qemu, which now simply handles the request > and reason. At a very high level, the flow is "notify of > shutdown and reason", "send VIRQ_DOM_EXC", process, and > destroy domain. Paravirtualized and fully-virtualized > domains would differ slightly in the first step of > notification. Paravirtualized continues to use sched_op, > fully virtualized uses DOM0_SHUTDOWNDOMAIN. The rest > of the steps would be identical in both cases. > > Or, back to the opening sentence, make the operations as > symmetrical as possible. > > (As a freebie, #if 0 some very verbose logging code in qemu. > Totally unrelated, but as long as I was there...) > > Signed-off-by: Ben Thomas (ben@virtualiron.com) > > > -- > ------------------------------------------------------------------------ > Ben Thomas Virtual Iron Software > bthomas@virtualiron.com Tower 1, Floor 2 > 978-849-1214 900 Chelmsford Street > Lowell, MA 01851 > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel -- thanks, edwin