[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Hardware watchdogs (patch for discussion only)
From: |
Daniel P. Berrange |
Subject: |
Re: [Qemu-devel] Hardware watchdogs (patch for discussion only) |
Date: |
Thu, 26 Feb 2009 10:51:06 +0000 |
User-agent: |
Mutt/1.4.1i |
On Wed, Feb 25, 2009 at 11:37:18PM +0000, Richard W.M. Jones wrote:
> Hi:
>
> I want to share an unfinished patch with the list just to make sure
> that I'm heading in the right direction.
>
> This patch aims to implement a virtual hardware watchdog device. A
> hardware watchdog in a real machine is a device that must be tickled
> periodically by a userspace process to prove that the machine's
> userspace is (in some sense) "alive". If the device isn't tickled
> then after some timeout, it reboots the machine.
>
> These devices are generally very simple. I picked two devices to
> emulate: the IBase 700, which is almost trivial, an ISA port to enable
> and set the timeout, and another ISA port to disable. And the Intel
> 6300ESB, a PCI device which represents a mid-high end range of
> features and is very well documented. Both have clean Linux device
> drivers:
>
> http://lxr.linux.no/linux+v2.6.28.5/drivers/watchdog/ib700wdt.c
> http://lxr.linux.no/linux+v2.6.28.5/drivers/watchdog/i6300esb.c
>
> (Both also come with Windows drivers which I haven't tested)
>
A quick note WRT the possible actions
> @@ -4072,6 +4073,8 @@
> "-old-param old param mode\n"
> #endif
> "-tb-size n set TB size\n"
> + "-watchdog ib700|i6300esb[,action=reboot|shutdown|pause|exit]\n"
> + " enable virtual hardware watchdog [default=none]\n"
> "-incoming p prepare for incoming migration, listen on port
> p\n"
> "\n"
> "During emulation, the following keys are useful:\n"
> +/* This actually performs the "action" once a watchdog has expired,
> + * ie. reboot, shutdown, exit, etc.
> + */
> +void
> +watchdog_perform_action (int action)
> +{
> + fprintf (stderr, "qemu: watchdog %s!\n", string_of_action (action));
> +
> + switch (action) {
> + case WDT_REBOOT:
> + qemu_system_reset ();
> + break;
This one shouldn't be called directly. qemu_system_reset_request()
sets a flag to interrupt the CPU, and then the main loop when
seeing the flag set, will call qemu_system_reset().
It also doesn't actally do a reboot. It hard resets the CPU and
devices. The guest OS doesn't do a controlled shutdown.
> + case WDT_REBOOTNICE:
> + qemu_system_reset_request ();
> + break;
> +
> + case WDT_SHUTDOWN:
> + qemu_system_powerdown ();
> + break;
Likewise here - this is called indirectly by the main loop after
qemu_system_powerdown_request() sets the powerdown flag.
> + case WDT_SHUTDOWNNICE:
> + qemu_system_powerdown_request ();
> + break;
> +
> + case WDT_PAUSE:
> + vm_stop (0);
> + break;
> +
> + case WDT_EXIT:
> + exit (0);
> + }
> +}
> +
> +The @var{action} controls what QEMU will do when the timer expires.
> +The default is
> address@hidden (forcefully reboot the guest).
> +Other possible actions are:
> address@hidden (attempt to gracefully reboot the guest).
> address@hidden (forcefully shutdown the guest),
> address@hidden (attempt to gracefully shutdown the guest),
> address@hidden (pause the guest), or
> address@hidden (immediately exit the QEMU process).
I think we can only support the following options
- shutdown - graceful shutdown of guest via ACPI event via
qemu_system_powerdown_request()
- poweroff - hard immediate power off of guest machine via
qemu_system_shutdown_request()
- reset - hard reset of the guest machine via
qemu_system_reset_request()
- pause - stop the guest CPU(s)
Don't think we ned an 'exit' event, because I believe 'poweroff' should
cause the emulator to exit
Regards,
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
- [Qemu-devel] Hardware watchdogs (patch for discussion only), Richard W.M. Jones, 2009/02/25
- Re: [Qemu-devel] Hardware watchdogs (patch for discussion only),
Daniel P. Berrange <=
- Re: [Qemu-devel] Hardware watchdogs (patch for discussion only), Richard W.M. Jones, 2009/02/26
- Re: [Qemu-devel] Hardware watchdogs (patch for discussion only), Steve Fosdick, 2009/02/26
- Re: [Qemu-devel] Hardware watchdogs (patch for discussion only), Jamie Lokier, 2009/02/26
- Re: [Qemu-devel] Hardware watchdogs (patch for discussion only), Steve Fosdick, 2009/02/27
- Re: [Qemu-devel] Hardware watchdogs (patch for discussion only), Paul Brook, 2009/02/27
- Re: [Qemu-devel] Hardware watchdogs (patch for discussion only), Jamie Lokier, 2009/02/28
- Re: [Qemu-devel] Hardware watchdogs (patch for discussion only), Andreas Färber, 2009/02/28