Re: [kvm-devel] [PATCH] system_powerdown via acpi power button

2008-01-24 Thread Avi Kivity
Gerd Hoffmann wrote: > Avi Kivity wrote: > >> Agree, but should try a "quit" monitor command first. Signals are racy, >> like anything that deals with pids (qemu dies, another process is >> fork()ed with the same pid, libvirt kills it). >> > > There is no race in that specific case becau

Re: [kvm-devel] [PATCH] system_powerdown via acpi power button

2008-01-24 Thread Gerd Hoffmann
Avi Kivity wrote: > Agree, but should try a "quit" monitor command first. Signals are racy, > like anything that deals with pids (qemu dies, another process is > fork()ed with the same pid, libvirt kills it). There is no race in that specific case because qemu is started by libvirtd. libvirtd

Re: [kvm-devel] [PATCH] system_powerdown via acpi power button

2008-01-24 Thread Avi Kivity
Guido Guenther wrote: > If the guest can't do that, it simply can't. You can then SIGTERM the > guest after a timeout. Note that even an acpi system might not be able > to shut down since it hangs on a network unmount or it ignores the ACPI > interrupt via kernel commandline or whatever. You can't

Re: [kvm-devel] [PATCH] system_powerdown via acpi power button

2008-01-24 Thread Guido Guenther
On Tue, Jan 22, 2008 at 01:12:12PM +0100, Jan Kiszka wrote: > Guido Guenther wrote: > > On Tue, Jan 22, 2008 at 11:11:00AM +0100, Jan Kiszka wrote: > >> #if defined(TARGET_I386) > >> void qemu_system_powerdown(void) > >> { > >> +if (!pm_state) > >> +exit(0); > >> if(pm_state->pm

Re: [kvm-devel] [PATCH] system_powerdown via acpi power button

2008-01-22 Thread Jan Kiszka
Guido Guenther wrote: > On Tue, Jan 22, 2008 at 11:11:00AM +0100, Jan Kiszka wrote: >> #if defined(TARGET_I386) >> void qemu_system_powerdown(void) >> { >> +if (!pm_state) >> +exit(0); >> if(pm_state->pmen & PWRBTN_EN) { >> pm_state->pmsts |= PWRBTN_EN; >> pm_updat

Re: [kvm-devel] [PATCH] system_powerdown via acpi power button

2008-01-22 Thread Guido Guenther
On Tue, Jan 22, 2008 at 11:11:00AM +0100, Jan Kiszka wrote: > #if defined(TARGET_I386) > void qemu_system_powerdown(void) > { > +if (!pm_state) > +exit(0); > if(pm_state->pmen & PWRBTN_EN) { > pm_state->pmsts |= PWRBTN_EN; > pm_update_sci(pm_state); This totally d

Re: [kvm-devel] [PATCH] system_powerdown via acpi power button

2008-01-22 Thread Jan Kiszka
Guido Guenther wrote: > +#if defined(TARGET_I386) > +void qemu_system_powerdown(void) > +{ > +if(pm_state->pmen & PWRBTN_EN) { > + pm_state->pmsts |= PWRBTN_EN; > + pm_update_sci(pm_state); > +} > +} > +#endif This code should also care about !pm_state, ie. non-PCI systems. Jan -