All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: xen-devel@lists.xen.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Ian Jackson <ian.jackson@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>
Subject: [PATCH 7/8] tools/xenalyze: Fix multiple instances of *HYPERCALL_MAX
Date: Thu, 25 Feb 2016 14:49:02 +0000	[thread overview]
Message-ID: <1456411743-17741-8-git-send-email-george.dunlap@eu.citrix.com> (raw)
In-Reply-To: <1456411743-17741-1-git-send-email-george.dunlap@eu.citrix.com>

We HYPERCALL_MAX defined as the maximum enumerated hypercall, and we
have PV_HYPERCALL_MAX defined as some other number (presumably based
on experience with actual hypercalls).  Both are used to size arrays
(hypercall_name[] and pv_data.hypercall_count[], respectively).

Rename PV_HYPERCALL_MAX to HYPERCALL_MAX, and use HYPERCALL_MAX to
size (and iterate over) all arrays.

While we're at it, print "(unknown)" for values not present in the
hypercall_name[] array.

CID 1306868

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
CC: Ian Jackson <ian.jackson@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
 tools/xentrace/xenalyze.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c
index 3e26a4c..4ae50b8 100644
--- a/tools/xentrace/xenalyze.c
+++ b/tools/xentrace/xenalyze.c
@@ -1068,9 +1068,10 @@ enum {
     HYPERCALL_sysctl,
     HYPERCALL_domctl,
     HYPERCALL_kexec_op,
-    HYPERCALL_MAX
 };
 
+#define HYPERCALL_MAX 38
+
 char *hypercall_name[HYPERCALL_MAX] = {
     [HYPERCALL_set_trap_table]="set_trap_table",
     [HYPERCALL_mmu_update]="mmu_update",
@@ -1509,13 +1510,12 @@ char *pv_name[PV_MAX] = {
     [PV_HYPERCALL_SUBCALL]="hypercall (subcall)",
 };
 
-#define PV_HYPERCALL_MAX 56
 #define PV_TRAP_MAX 20
 
 struct pv_data {
     unsigned summary_info:1;
     int count[PV_MAX];
-    int hypercall_count[PV_HYPERCALL_MAX];
+    int hypercall_count[HYPERCALL_MAX];
     int trap_count[PV_TRAP_MAX];
 };
 
@@ -6405,7 +6405,7 @@ void pv_hypercall_process(struct record_info *ri, struct pv_data *pv) {
     }
 
     if(opt.summary_info) {
-        if(eax < PV_HYPERCALL_MAX)
+        if(eax < HYPERCALL_MAX)
             pv->hypercall_count[eax]++;
     }
 
@@ -6566,10 +6566,10 @@ void pv_summary(struct pv_data *pv) {
         switch(i) {
         case PV_HYPERCALL:
         case PV_HYPERCALL_V2:
-            for(j=0; j<PV_HYPERCALL_MAX; j++) {
+            for(j=0; j<HYPERCALL_MAX; j++) {
                 if(pv->hypercall_count[j])
                     printf("    %-29s[%2d]: %6d\n",
-                           hypercall_name[j],
+                           hypercall_name[j]?:"(unknown)",
                            j,
                            pv->hypercall_count[j]);
             }
@@ -6677,7 +6677,7 @@ void pv_hypercall_v2_process(struct record_info *ri, struct pv_data *pv,
     int op = pv_hypercall_op(ri);
 
     if(opt.summary_info) {
-        if(op < PV_HYPERCALL_MAX)
+        if(op < HYPERCALL_MAX)
             pv->hypercall_count[op]++;
     }
 
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-02-25 14:49 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25 14:48 [PATCH 0/8] Fixes to Coverity issues reported on xenalyze George Dunlap
2016-02-25 14:48 ` [PATCH 1/8] tools/xenalyze: Close symbol_file after reading it George Dunlap
2016-02-26 12:22   ` Ian Jackson
2016-02-29 16:11     ` Konrad Rzeszutek Wilk
2016-02-25 14:48 ` [PATCH 2/8] tools/xenalyze: Avoid redundant check George Dunlap
2016-02-26 12:23   ` Ian Jackson
2016-02-29 16:15     ` Konrad Rzeszutek Wilk
2016-02-25 14:48 ` [PATCH 3/8] tools/xenalyze: Handle fstat errors properly George Dunlap
2016-02-26 12:25   ` Ian Jackson
2016-03-03 12:28     ` George Dunlap
2016-02-25 14:48 ` [PATCH 4/8] tools/xenalyze: Mark unreachable code as unreachable George Dunlap
2016-02-25 15:03   ` Ian Campbell
2016-02-25 15:09     ` George Dunlap
2016-02-25 15:28       ` Ian Campbell
2016-02-25 15:43         ` George Dunlap
2016-02-25 15:52           ` Ian Campbell
2016-02-26 12:28             ` Ian Jackson
2016-02-25 14:49 ` [PATCH 5/8] tools/xenalyze: Fix check for error return value George Dunlap
2016-02-26 12:29   ` Ian Jackson
2016-02-29 16:16     ` Konrad Rzeszutek Wilk
2016-02-25 14:49 ` [PATCH 6/8] tools/xenalyze: Fix off-by-one in MAX_CPUS range checks George Dunlap
2016-02-26 12:30   ` Ian Jackson
2016-02-29 16:58     ` George Dunlap
2016-03-03 12:44       ` George Dunlap
2016-02-25 14:49 ` George Dunlap [this message]
2016-02-26 12:33   ` [PATCH 7/8] tools/xenalyze: Fix multiple instances of *HYPERCALL_MAX Ian Jackson
2016-02-29 17:29     ` George Dunlap
2016-03-01 13:36       ` Ian Jackson
2016-02-25 14:49 ` [PATCH 8/8] tools/xenalyze: Actually handle case where number of ipi vectors exceeds static max George Dunlap
2016-02-26 12:34   ` Ian Jackson
2016-02-29 16:16     ` Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1456411743-17741-8-git-send-email-george.dunlap@eu.citrix.com \
    --to=george.dunlap@eu.citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=ian.jackson@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.