home *** CD-ROM | disk | FTP | other *** search
/ ftp.parl.clemson.edu / 2015-02-07.ftp.parl.clemson.edu.tar / ftp.parl.clemson.edu / pub / pvfs2 / orangefs-2.8.3-20110323.tar.gz / orangefs-2.8.3-20110323.tar / orangefs / doc / coding / valgrind < prev   
Text File  |  2004-04-13  |  4KB  |  99 lines

  1. #
  2. # 8 Dec 2003
  3. #
  4.  
  5. Using Valgrind with pvfs2-client and pvfs2-client-core
  6.  
  7. First, get PVFS2 ready:
  8.  
  9. . Build pvfs2 with the --with-kernel option
  10.  
  11. . Build pvfs2.ko
  12.  
  13. . load pvfs2.ko
  14.  
  15. Communication with the pvfs2 kernel module happens through ioctls, which
  16. valgrind will complain about.  To fix that, apply the patch at the end of this
  17. file.  
  18.  
  19.     cd /path/to/valgrind/src
  20.     patch -p1 < /path/to/this/file
  21.  
  22. Configure, build, and install valgrind as you normally would
  23.  
  24. pvfs2-client-core reads from a device node, so you'll have to run valgrind as
  25. root:
  26.  
  27.     cd /path/to/pvfs2/build/directory
  28.     valgrind --trace-children=yes \
  29.         ./src/apps/kernel/linux-2.6/pvfs2-client -f \
  30.         -p ./src/apps/kernel/linux-2.6/pvfs2-client-core
  31.  
  32.  
  33. As of this writing, things *still* won't work well.  you'll get a message about
  34. a "short message" from the device.   since we seem to run into this short read
  35. only when running under valgrind, we probably aren't going to spend a lot of
  36. time making the pvfs2 device handle short reads.  Patches accepted, though :>
  37.  
  38. Here's the valgrind patch:
  39.  
  40. diff -burpN valgrind-2.0.0/coregrind/vg_syscalls.c valgrind-2.0.0.pvfs_ioctl/coregrind/vg_syscalls.c
  41. --- valgrind-2.0.0/coregrind/vg_syscalls.c    Mon Nov  3 13:15:04 2003
  42. +++ valgrind-2.0.0.pvfs_ioctl/coregrind/vg_syscalls.c    Mon Dec  8 15:04:45 2003
  43. @@ -2465,6 +2465,32 @@ void VG_(perform_assumed_nonblocking_sys
  44.                 KERNEL_DO_SYSCALL(tid,res);
  45.                 break;
  46.  
  47. +
  48. +        case PVFS_DEV_GET_MAGIC:
  49. +           SYSCALL_TRACK(pre_mem_write, tid, "ioctl(PVFS_DEV_GET_MAGIC)", arg3, sizeof(int32_t));
  50. +           KERNEL_DO_SYSCALL(tid,res);
  51. +           if (!VG_(is_kerror)(res) && res == 0)
  52. +               VG_TRACK(post_mem_write,arg3, sizeof(int32_t));
  53. +               break;
  54. +        case PVFS_DEV_GET_MAX_UPSIZE:
  55. +           SYSCALL_TRACK(pre_mem_write, tid, "ioctl(PVFS_DEV_GET_MAX_UPSIZE)", arg3, sizeof(int32_t));
  56. +           KERNEL_DO_SYSCALL(tid,res);
  57. +           if (!VG_(is_kerror)(res) && res == 0)
  58. +               VG_TRACK(post_mem_write,arg3, sizeof(int32_t));
  59. +               break;
  60. +
  61. +        case PVFS_DEV_GET_MAX_DOWNSIZE:
  62. +           SYSCALL_TRACK(pre_mem_write, tid, "ioctl(PVFS_DEV_GET_MAX_DOWNSIZE)", arg3, sizeof(int32_t));
  63. +           KERNEL_DO_SYSCALL(tid,res);
  64. +           if (!VG_(is_kerror)(res) && res == 0)
  65. +               VG_TRACK(post_mem_write,arg3, sizeof(int32_t));
  66. +               break;
  67. +        case PVFS_DEV_MAP:
  68. +            SYSCALL_TRACK(pre_mem_write, tid, "ioctl(PVFS_DEV_MAP)", arg3, sizeof(struct PVFS_dev_map_desc));
  69. +           KERNEL_DO_SYSCALL(tid,res);
  70. +           if (!VG_(is_kerror)(res) && res == 0)
  71. +               VG_TRACK(post_mem_write,arg3, sizeof(struct PVFS_dev_map_desc));
  72. +               break;
  73.              /* We don't have any specific information on it, so
  74.                 try to do something reasonable based on direction and
  75.                 size bits.  The encoding scheme is described in
  76. diff -burpN valgrind-2.0.0/coregrind/vg_unsafe.h valgrind-2.0.0.pvfs_ioctl/coregrind/vg_unsafe.h
  77. --- valgrind-2.0.0/coregrind/vg_unsafe.h    Tue Nov  4 17:18:40 2003
  78. +++ valgrind-2.0.0.pvfs_ioctl/coregrind/vg_unsafe.h    Mon Dec  8 15:04:05 2003
  79. @@ -89,6 +89,19 @@
  80.  
  81.  #include <sys/poll.h>
  82.  
  83. +/* PVFS2: some defines lifed from the internal header files */
  84. +#define PVFS_DEV_GET_MAGIC                      1
  85. +#define PVFS_DEV_GET_MAX_UPSIZE                 2
  86. +#define PVFS_DEV_GET_MAX_DOWNSIZE               3
  87. +#define PVFS_DEV_MAP                            4
  88. +
  89. +/* describes memory regions to map in the PVFS_DEV_MAP ioctl */
  90. +struct PVFS_dev_map_desc
  91. +{   
  92. +    void* ptr;
  93. +    int size;
  94. +};
  95. +
  96.  
  97.  /*--------------------------------------------------------------------*/
  98.  /*--- end                                              vg_unsafe.h ---*/
  99.