[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 1/2] xentrace: allow sparse cpu list



Modify the xentrace utility to allow sparse cpu list resulting in not
all possible cpus having a trace buffer allocated.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 tools/xentrace/xentrace.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c
index 364a6fdad5..590a91e091 100644
--- a/tools/xentrace/xentrace.c
+++ b/tools/xentrace/xentrace.c
@@ -500,12 +500,14 @@ static struct t_struct *map_tbufs(unsigned long 
tbufs_mfn, unsigned int num,
 
     for(i=0; i<num; i++)
     {
-        
-        const uint32_t *mfn_list = (const uint32_t *)tbufs.t_info
-                                   + tbufs.t_info->mfn_offset[i];
+        const uint32_t *mfn_list;
         int j;
         xen_pfn_t pfn_list[tbufs.t_info->tbuf_size];
 
+        if ( !tbufs.t_info->mfn_offset[i] )
+            continue;
+
+        mfn_list = (const uint32_t *)tbufs.t_info + 
tbufs.t_info->mfn_offset[i];
         for ( j=0; j<tbufs.t_info->tbuf_size; j++)
             pfn_list[j] = (xen_pfn_t)mfn_list[j];
 
@@ -702,7 +704,8 @@ static int monitor_tbufs(void)
 
     if ( opts.discard )
         for ( i = 0; i < num; i++ )
-            meta[i]->cons = meta[i]->prod;
+            if ( meta[i] )
+                meta[i]->cons = meta[i]->prod;
 
     /* now, scan buffers for events */
     while ( 1 )
@@ -710,7 +713,10 @@ static int monitor_tbufs(void)
         for ( i = 0; i < num; i++ )
         {
             unsigned long start_offset, end_offset, window_size, cons, prod;
-                
+
+            if ( !meta[i] )
+                continue;
+
             /* Read window information only once. */
             cons = meta[i]->cons;
             prod = meta[i]->prod;
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.