zhanghao1 <zhangh...@kylinos.cn> writes:
> Each vcpu creates a corresponding timer task. The watchdog > is driven by a timer according to a certain period. Each time > the timer expires, the counter is decremented. When the counter > is "0", the watchdog considers the vcpu to be stalling and resets > the VM. To avoid watchdog expiration, the guest kernel driver > needs to periodically send a pet event to update the counter. > > Signed-off-by: zhanghao1 <zhangh...@kylinos.cn> > --- > v2: > - change the function name and remove the redundant word 'stall' > - add trace-events to replace DPRINTF and qemu_log > - call 'watchdog_perform_action()' to reset vm > - update g_new0 to replace malloc > - update only use '.generic_name' > - update the bool variable 'is_initialized' to uint32_t > > v1: > https://lore.kernel.org/qemu-devel/20230615061302.301754-1-zhangh...@kylinos.cn/ <snip> > +static void virtio_vcpu_watchdog_device_realize(DeviceState *dev, Error > **errp) > +{ > + VirtIODevice *vdev = VIRTIO_DEVICE(dev); > + vwdt = VIRTIO_VCPU_WATCHDOG(dev); > + > + virtio_init(vdev, VIRTIO_ID_WATCHDOG, 0); This will never compile because VIRTIO_ID_WATCHDOG isn't defined anywhere. Next time you post you need to also include a link to the kernel side of the driver and the virtio specification (or inflight patch for it). -- Alex Bennée Virtualisation Tech Lead @ Linaro