Skip to contentSkip to conversation

tools/libxc: Remove -DVALGRIND from libxc

PATCH In review Andrew Cooper 2 participants 2 messages Apr 11, 2014 – Apr 14, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/libxc: Remove -DVALGRIND from libxc

It is not used at all in tree, and its justifaction is out of date now that Xen hypercall support exists upstream in valgrind.

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
---
 tools/libxc/Makefile     |    4 ----
 tools/libxc/xc_private.c |    9 ---------
 tools/libxc/xc_private.h |   11 -----------
 tools/libxc/xc_tmem.c    |   10 ----------
 4 files changed, 34 deletions(-)
tools/libxc/Makefile +0 -4
index 2cca2b2..a74b19e 100644
@@ -95,10 +95,6 @@ CFLAGS-$(CONFIG_Linux) += -D_GNU_SOURCE
 
 CFLAGS	+= $(PTHREAD_CFLAGS)
 
-# Define this to make it possible to run valgrind on code linked with these
-# libraries.
-#CFLAGS   += -DVALGRIND -O0 -ggdb3
-
 CTRL_LIB_OBJS := $(patsubst %.c,%.o,$(CTRL_SRCS-y))
 CTRL_PIC_OBJS := $(patsubst %.c,%.opic,$(CTRL_SRCS-y))
 
tools/libxc/xc_private.c +0 -9
index 33ed15b..0e18892 100644
@@ -588,10 +588,6 @@ int xc_get_pfn_list(xc_interface *xch,
     DECLARE_HYPERCALL_BOUNCE(pfn_buf, max_pfns * sizeof(*pfn_buf), XC_HYPERCALL_BUFFER_BOUNCE_OUT);
     int ret;
 
-#ifdef VALGRIND
-    memset(pfn_buf, 0, max_pfns * sizeof(*pfn_buf));
-#endif
-
     if ( xc_hypercall_bounce_pre(xch, pfn_buf) )
     {
         PERROR("xc_get_pfn_list: pfn_buf bounce failed");
@@ -707,11 +703,6 @@ int xc_version(xc_interface *xch, int cmd, void *arg)
         return -ENOMEM;
     }
 
-#ifdef VALGRIND
-    if (sz != 0)
-        memset(hypercall_bounce_get(bounce), 0, sz);
-#endif
-
     rc = do_xen_version(xch, cmd, HYPERCALL_BUFFER(arg));
 
     if ( sz != 0 )
tools/libxc/xc_private.h +0 -11
index bd2eb86..670a82d 100644
@@ -34,22 +34,11 @@
 
 #include <xen/sys/privcmd.h>
 
-/* valgrind cannot see when a hypercall has filled in some values.  For this
-   reason, we must zero the privcmd_hypercall_t or domctl/sysctl instance
-   before a call, if using valgrind.  */
-#ifdef VALGRIND
-#define DECLARE_HYPERCALL privcmd_hypercall_t hypercall = { 0 }
-#define DECLARE_DOMCTL struct xen_domctl domctl = { 0 }
-#define DECLARE_SYSCTL struct xen_sysctl sysctl = { 0 }
-#define DECLARE_PHYSDEV_OP struct physdev_op physdev_op = { 0 }
-#define DECLARE_FLASK_OP struct xen_flask_op op = { 0 }
-#else
 #define DECLARE_HYPERCALL privcmd_hypercall_t hypercall
 #define DECLARE_DOMCTL struct xen_domctl domctl
 #define DECLARE_SYSCTL struct xen_sysctl sysctl
 #define DECLARE_PHYSDEV_OP struct physdev_op physdev_op
 #define DECLARE_FLASK_OP struct xen_flask_op op
-#endif
 
 #undef PAGE_SHIFT
 #undef PAGE_SIZE
tools/libxc/xc_tmem.c +0 -10
index 61e1549..3261e10 100644
@@ -70,11 +70,6 @@ int xc_tmem_control(xc_interface *xch,
     op.u.ctrl.oid[1] = 0;
     op.u.ctrl.oid[2] = 0;
 
-#ifdef VALGRIND
-    if (arg1 != 0)
-        memset(buf, 0, arg1);
-#endif
-
     if ( subop == TMEMC_LIST && arg1 != 0 )
     {
         if ( buf == NULL )
@@ -120,11 +115,6 @@ int xc_tmem_control_oid(xc_interface *xch,
     op.u.ctrl.oid[1] = oid.oid[1];
     op.u.ctrl.oid[2] = oid.oid[2];
 
-#ifdef VALGRIND
-    if (arg1 != 0)
-        memset(buf, 0, arg1);
-#endif
-
     if ( subop == TMEMC_LIST && arg1 != 0 )
     {
         if ( buf == NULL )
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 1 line · Andrew Cooper

It is not used at all in tree, and its justifaction is out of date now that

"justification"

Quoted 17 lines

Xen hypercall support exists upstream in valgrind.

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
---
 tools/libxc/Makefile     |    4 ----
 tools/libxc/xc_private.c |    9 ---------
 tools/libxc/xc_private.h |   11 -----------
 tools/libxc/xc_tmem.c    |   10 ----------
 4 files changed, 34 deletions(-)
tools/libxc/Makefile +0 -0
index 2cca2b2..a74b19e 100644

tools/libxc/Makefile CFLAGS-$(CONFIG_Linux) += -D_GNU_SOURCE · line 100

Quoted 6 lines
tools/libxc/Makefile +0 -3
@@ -95,10 +95,6 @@ CFLAGS-$(CONFIG_Linux) += -D_GNU_SOURCE
 
 CFLAGS	+= $(PTHREAD_CFLAGS)
 
-# Define this to make it possible to run valgrind on code linked with these
-# libraries.
-#CFLAGS   += -DVALGRIND -O0 -ggdb3

You are removing more than -DVALGRIND here.

Perhaps those removals are justified but the changelog should do so.