diff mbox series

[for-4.18,5/5] xenalyze: Reduce warnings about leaving a vcpu in INIT

Message ID 20231009125137.1329146-6-george.dunlap@cloud.com (mailing list archive)
State New, archived
Headers show
Series xenalyze: Miscellaneous fixes | expand

Commit Message

George Dunlap Oct. 9, 2023, 12:51 p.m. UTC
We warn when we see data for a vcpu moving into a non-RUNNING state,
just so that people know why we're ignoring it.  On full traces, this
happens only once.  However, if the trace was limited to a subset of
pcpus, then this will happen every time the domain in question is
woken on that pcpu.

Add a 'delayed_init' flag to the vcpu struct to indicate when a vcpu
has experienced a delayed init.  Print a warning message once when
entering the state, and once when leaving it.

Signed-off-by: George Dunlap <george.dunlap@cloud.com>
---
Release justification: By removing extraneous output which makes the
tool annoying to use, this could be considered a bug fix; a minor one,
but also in a non-critical part of the code.

CC: Anthony Perard <anthony.perard@cloud.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Xenia Ragiodakou <xenia.ragiadakou@amd.com>
---
 tools/xentrace/xenalyze.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

Anthony PERARD Oct. 16, 2023, 10:56 a.m. UTC | #1
On Mon, Oct 09, 2023 at 01:51:37PM +0100, George Dunlap wrote:
> We warn when we see data for a vcpu moving into a non-RUNNING state,
> just so that people know why we're ignoring it.  On full traces, this
> happens only once.  However, if the trace was limited to a subset of
> pcpus, then this will happen every time the domain in question is
> woken on that pcpu.
> 
> Add a 'delayed_init' flag to the vcpu struct to indicate when a vcpu
> has experienced a delayed init.  Print a warning message once when
> entering the state, and once when leaving it.
> 
> Signed-off-by: George Dunlap <george.dunlap@cloud.com>

Acked-by: Anthony PERARD <anthony.perard@citrix.com>

Thanks,
diff mbox series

Patch

diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c
index 4b6db59d87..ce6a85d50b 100644
--- a/tools/xentrace/xenalyze.c
+++ b/tools/xentrace/xenalyze.c
@@ -1625,7 +1625,7 @@  struct vlapic_struct {
 struct vcpu_data {
     int vid;
     struct domain_data *d; /* up-pointer */
-    unsigned activated:1;
+    unsigned activated:1, delayed_init:1;
 
     int guest_paging_levels;
 
@@ -6979,10 +6979,17 @@  void vcpu_start(struct pcpu_info *p, struct vcpu_data *v,
      * bring a vcpu out of INIT until it's seen to be actually
      * running somewhere. */
     if ( new_runstate != RUNSTATE_RUNNING ) {
-        fprintf(warn, "First schedule for d%dv%d doesn't take us into a running state; leaving INIT\n",
-                v->d->did, v->vid);
+        if ( !v->delayed_init ) {
+            fprintf(warn, "First schedule for d%dv%d doesn't take us into a running state; leaving in INIT\n",
+                    v->d->did, v->vid);
+            v->delayed_init = 1;
+        }
 
         return;
+    } else if ( v->delayed_init ) {
+        fprintf(warn, "d%dv%d RUNSTATE_RUNNING detected, leaving INIT",
+                v->d->did, v->vid);
+        v->delayed_init = 0;
     }
 
     tsc = ri_tsc;