diff mbox series

[3/4] hw/watchdog: add trace events for watchdog action handling

Message ID 20221031131934.425448-4-berrange@redhat.com
State New
Headers show
Series hw: make TCO watchdog actually work by default for Q35 | expand

Commit Message

Daniel P. Berrangé Oct. 31, 2022, 1:19 p.m. UTC
The tracepoints aid in debugging the triggering of watchdog devices.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 hw/watchdog/trace-events | 4 ++++
 hw/watchdog/watchdog.c   | 4 ++++
 2 files changed, 8 insertions(+)

Comments

Richard W.M. Jones Oct. 31, 2022, 1:36 p.m. UTC | #1
On Mon, Oct 31, 2022 at 01:19:33PM +0000, Daniel P. Berrangé wrote:
> The tracepoints aid in debugging the triggering of watchdog devices.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  hw/watchdog/trace-events | 4 ++++
>  hw/watchdog/watchdog.c   | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/hw/watchdog/trace-events b/hw/watchdog/trace-events
> index 89ccbcfdfd..fc1d048702 100644
> --- a/hw/watchdog/trace-events
> +++ b/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_lpm(uint64_t caps) "caps=0x%" PRIx64
>  spapr_watchdog_expired(uint64_t num, unsigned action) "num=%" PRIu64 " action=%u"
> +
> +# watchdog.c
> +watchdog_perform_action(unsigned int action) "action=%d"
> +watchdog_set_action(unsigned int action) "action=%d"
> diff --git a/hw/watchdog/watchdog.c b/hw/watchdog/watchdog.c
> index 6c082a3263..955046161b 100644
> --- a/hw/watchdog/watchdog.c
> +++ b/hw/watchdog/watchdog.c
> @@ -30,6 +30,7 @@
>  #include "sysemu/watchdog.h"
>  #include "hw/nmi.h"
>  #include "qemu/help_option.h"
> +#include "trace.h"
>  
>  static WatchdogAction watchdog_action = WATCHDOG_ACTION_RESET;
>  
> @@ -43,6 +44,8 @@ WatchdogAction get_watchdog_action(void)
>   */
>  void watchdog_perform_action(void)
>  {
> +    trace_watchdog_perform_action(watchdog_action);
> +
>      switch (watchdog_action) {
>      case WATCHDOG_ACTION_RESET:     /* same as 'system_reset' in monitor */
>          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)
>  {
>      watchdog_action = action;
> +    trace_watchdog_set_action(watchdog_action);
>  }

Reviewed-by: Richard W.M. Jones <rjones@redhat.com>

Rich.
Philippe Mathieu-Daudé Oct. 31, 2022, 3:46 p.m. UTC | #2
On 31/10/22 14:19, Daniel P. Berrangé wrote:
> The tracepoints aid in debugging the triggering of watchdog devices.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   hw/watchdog/trace-events | 4 ++++
>   hw/watchdog/watchdog.c   | 4 ++++
>   2 files changed, 8 insertions(+)
> 
> diff --git a/hw/watchdog/trace-events b/hw/watchdog/trace-events
> index 89ccbcfdfd..fc1d048702 100644
> --- a/hw/watchdog/trace-events
> +++ b/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_lpm(uint64_t caps) "caps=0x%" PRIx64
>   spapr_watchdog_expired(uint64_t num, unsigned action) "num=%" PRIu64 " action=%u"
> +
> +# watchdog.c
> +watchdog_perform_action(unsigned int action) "action=%d"
> +watchdog_set_action(unsigned int action) "action=%d"

"%u", otherwise:

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/hw/watchdog/trace-events b/hw/watchdog/trace-events
index 89ccbcfdfd..fc1d048702 100644
--- a/hw/watchdog/trace-events
+++ b/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_lpm(uint64_t caps) "caps=0x%" PRIx64
 spapr_watchdog_expired(uint64_t num, unsigned action) "num=%" PRIu64 " action=%u"
+
+# watchdog.c
+watchdog_perform_action(unsigned int action) "action=%d"
+watchdog_set_action(unsigned int action) "action=%d"
diff --git a/hw/watchdog/watchdog.c b/hw/watchdog/watchdog.c
index 6c082a3263..955046161b 100644
--- a/hw/watchdog/watchdog.c
+++ b/hw/watchdog/watchdog.c
@@ -30,6 +30,7 @@ 
 #include "sysemu/watchdog.h"
 #include "hw/nmi.h"
 #include "qemu/help_option.h"
+#include "trace.h"
 
 static WatchdogAction watchdog_action = WATCHDOG_ACTION_RESET;
 
@@ -43,6 +44,8 @@  WatchdogAction get_watchdog_action(void)
  */
 void watchdog_perform_action(void)
 {
+    trace_watchdog_perform_action(watchdog_action);
+
     switch (watchdog_action) {
     case WATCHDOG_ACTION_RESET:     /* same as 'system_reset' in monitor */
         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)
 {
     watchdog_action = action;
+    trace_watchdog_set_action(watchdog_action);
 }