Add trace events to the PCH watchdog timer, it can be useful to see how
the guest is using it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/acpi/tco.c | 11 +++++++++--
hw/acpi/trace-events | 4 ++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/hw/acpi/tco.c b/hw/acpi/tco.c
index 05b9d7b..0032db4 100644
--- a/hw/acpi/tco.c
+++ b/hw/acpi/tco.c
@@ -12,6 +12,7 @@
#include "hw/i386/ich9.h"
#include "hw/acpi/tco.h"
+#include "trace.h"
//#define DEBUG
@@ -41,8 +42,11 @@ enum {
static inline void tco_timer_reload(TCOIORegs *tr)
{
- tr->expire_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
- ((int64_t)(tr->tco.tmr & TCO_TMR_MASK) * TCO_TICK_NSEC);
+ int ticks = tr->tco.tmr & TCO_TMR_MASK;
+ int64_t nsec = (int64_t)ticks * TCO_TICK_NSEC;
+
+ trace_tco_timer_reload(ticks, nsec / 1000000);
+ tr->expire_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + nsec;
timer_mod(tr->tco_timer, tr->expire_time);
}
@@ -59,6 +63,9 @@ static void tco_timer_expired(void *opaque)
ICH9LPCState *lpc = container_of(pm, ICH9LPCState, pm);
uint32_t gcs = pci_get_long(lpc->chip_config + ICH9_CC_GCS);
+ trace_tco_timer_expired(tr->timeouts_no,
+ lpc->pin_strap.spkr_hi,
+ !!(gcs & ICH9_CC_GCS_NO_REBOOT));
tr->tco.rld = 0;
tr->tco.sts1 |= TCO_TIMEOUT;
if (++tr->timeouts_no == 2) {
diff --git a/hw/acpi/trace-events b/hw/acpi/trace-events
index e3b41e9..df0024f 100644
--- a/hw/acpi/trace-events
+++ b/hw/acpi/trace-events
@@ -30,3 +30,7 @@ cpuhp_acpi_ejecting_invalid_cpu(uint32_t idx) "0x%"PRIx32
cpuhp_acpi_ejecting_cpu(uint32_t idx) "0x%"PRIx32
cpuhp_acpi_write_ost_ev(uint32_t slot, uint32_t ev) "idx[0x%"PRIx32"] OST EVENT: 0x%"PRIx32
cpuhp_acpi_write_ost_status(uint32_t slot, uint32_t st) "idx[0x%"PRIx32"] OST STATUS: 0x%"PRIx32
+
+# hw/acpi/tco.c
+tco_timer_reload(int ticks, int msec) "ticks=%d (%d ms)"
+tco_timer_expired(int timeouts_no, bool strap, bool no_reboot) "timeouts_no=%d no_reboot=%d/%d"
--
1.8.3.1
Hi, This series seems to have some coding style problems. See output below for more information: Type: series Message-id: 1507816448-86665-1-git-send-email-pbonzini@redhat.com Subject: [Qemu-devel] [PATCH] tco: add trace events === TEST SCRIPT BEGIN === #!/bin/bash BASE=base n=1 total=$(git log --oneline $BASE.. | wc -l) failed=0 git config --local diff.renamelimit 0 git config --local diff.renames True commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..." if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then failed=1 echo fi n=$((n+1)) done exit $failed === TEST SCRIPT END === Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 Switched to a new branch 'test' 1976413f8f tco: add trace events === OUTPUT BEGIN === Checking PATCH 1/1: tco: add trace events... ERROR: code indent should never use tabs #43: FILE: hw/acpi/tco.c:67: +^I^I^I lpc->pin_strap.spkr_hi,$ ERROR: code indent should never use tabs #44: FILE: hw/acpi/tco.c:68: +^I^I^I !!(gcs & ICH9_CC_GCS_NO_REBOOT));$ total: 2 errors, 0 warnings, 36 lines checked Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. === OUTPUT END === Test command exited with code: 1 --- Email generated automatically by Patchew [http://patchew.org/]. Please send your feedback to patchew-devel@freelists.org
Hi Paolo, On 10/12/2017 10:54 AM, Paolo Bonzini wrote: > Add trace events to the PCH watchdog timer, it can be useful to see how > the guest is using it. > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> > --- > hw/acpi/tco.c | 11 +++++++++-- > hw/acpi/trace-events | 4 ++++ > 2 files changed, 13 insertions(+), 2 deletions(-) > > diff --git a/hw/acpi/tco.c b/hw/acpi/tco.c > index 05b9d7b..0032db4 100644 > --- a/hw/acpi/tco.c > +++ b/hw/acpi/tco.c > @@ -12,6 +12,7 @@ > #include "hw/i386/ich9.h" > > #include "hw/acpi/tco.h" > +#include "trace.h" > > //#define DEBUG > > @@ -41,8 +42,11 @@ enum { > > static inline void tco_timer_reload(TCOIORegs *tr) > { > - tr->expire_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + > - ((int64_t)(tr->tco.tmr & TCO_TMR_MASK) * TCO_TICK_NSEC); > + int ticks = tr->tco.tmr & TCO_TMR_MASK; > + int64_t nsec = (int64_t)ticks * TCO_TICK_NSEC; > + > + trace_tco_timer_reload(ticks, nsec / 1000000); I'd use SCALE_MS here. > + tr->expire_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + nsec; > timer_mod(tr->tco_timer, tr->expire_time); > } > > @@ -59,6 +63,9 @@ static void tco_timer_expired(void *opaque) > ICH9LPCState *lpc = container_of(pm, ICH9LPCState, pm); > uint32_t gcs = pci_get_long(lpc->chip_config + ICH9_CC_GCS); > > + trace_tco_timer_expired(tr->timeouts_no, > + lpc->pin_strap.spkr_hi, > + !!(gcs & ICH9_CC_GCS_NO_REBOOT)); > tr->tco.rld = 0; > tr->tco.sts1 |= TCO_TIMEOUT; > if (++tr->timeouts_no == 2) { > diff --git a/hw/acpi/trace-events b/hw/acpi/trace-events > index e3b41e9..df0024f 100644 > --- a/hw/acpi/trace-events > +++ b/hw/acpi/trace-events > @@ -30,3 +30,7 @@ cpuhp_acpi_ejecting_invalid_cpu(uint32_t idx) "0x%"PRIx32 > cpuhp_acpi_ejecting_cpu(uint32_t idx) "0x%"PRIx32 > cpuhp_acpi_write_ost_ev(uint32_t slot, uint32_t ev) "idx[0x%"PRIx32"] OST EVENT: 0x%"PRIx32 > cpuhp_acpi_write_ost_status(uint32_t slot, uint32_t st) "idx[0x%"PRIx32"] OST STATUS: 0x%"PRIx32 > + > +# hw/acpi/tco.c > +tco_timer_reload(int ticks, int msec) "ticks=%d (%d ms)" > +tco_timer_expired(int timeouts_no, bool strap, bool no_reboot) "timeouts_no=%d no_reboot=%d/%d" Changing tabs by spaces to satisfy checkpatch: Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
© 2016 - 2024 Red Hat, Inc.