Browse Source

hw/watchdog: add trace events for watchdog action handling

The tracepoints aid in debugging the triggering of watchdog devices.

Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20221216125749.596075-4-berrange@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Daniel P. Berrangé 2 years ago
parent
commit
6f10a29e76
2 changed files with 8 additions and 0 deletions
  1. 4 0
      hw/watchdog/trace-events
  2. 4 0
      hw/watchdog/watchdog.c

+ 4 - 0
hw/watchdog/trace-events

@@ -16,3 +16,7 @@ spapr_watchdog_stop(uint64_t num, uint64_t ret) "num=%" PRIu64 " ret=%" PRId64
 spapr_watchdog_query(uint64_t caps) "caps=0x%" PRIx64
 spapr_watchdog_query(uint64_t caps) "caps=0x%" PRIx64
 spapr_watchdog_query_lpm(uint64_t caps) "caps=0x%" PRIx64
 spapr_watchdog_query_lpm(uint64_t caps) "caps=0x%" PRIx64
 spapr_watchdog_expired(uint64_t num, unsigned action) "num=%" PRIu64 " action=%u"
 spapr_watchdog_expired(uint64_t num, unsigned action) "num=%" PRIu64 " action=%u"
+
+# watchdog.c
+watchdog_perform_action(unsigned int action) "action=%u"
+watchdog_set_action(unsigned int action) "action=%u"

+ 4 - 0
hw/watchdog/watchdog.c

@@ -30,6 +30,7 @@
 #include "sysemu/watchdog.h"
 #include "sysemu/watchdog.h"
 #include "hw/nmi.h"
 #include "hw/nmi.h"
 #include "qemu/help_option.h"
 #include "qemu/help_option.h"
+#include "trace.h"
 
 
 static WatchdogAction watchdog_action = WATCHDOG_ACTION_RESET;
 static WatchdogAction watchdog_action = WATCHDOG_ACTION_RESET;
 
 
@@ -43,6 +44,8 @@ WatchdogAction get_watchdog_action(void)
  */
  */
 void watchdog_perform_action(void)
 void watchdog_perform_action(void)
 {
 {
+    trace_watchdog_perform_action(watchdog_action);
+
     switch (watchdog_action) {
     switch (watchdog_action) {
     case WATCHDOG_ACTION_RESET:     /* same as 'system_reset' in monitor */
     case WATCHDOG_ACTION_RESET:     /* same as 'system_reset' in monitor */
         qapi_event_send_watchdog(WATCHDOG_ACTION_RESET);
         qapi_event_send_watchdog(WATCHDOG_ACTION_RESET);
@@ -89,4 +92,5 @@ void watchdog_perform_action(void)
 void qmp_watchdog_set_action(WatchdogAction action, Error **errp)
 void qmp_watchdog_set_action(WatchdogAction action, Error **errp)
 {
 {
     watchdog_action = action;
     watchdog_action = action;
+    trace_watchdog_set_action(watchdog_action);
 }
 }