This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] How to use valgrind to detect xen hypervisor's memory le

To: hellokitty <zhuce5555@xxxxxxx>
Subject: Re: [Xen-devel] How to use valgrind to detect xen hypervisor's memory leak
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Fri, 15 Jul 2011 08:19:42 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 15 Jul 2011 00:20:34 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1310697774774-4589174.post@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Citrix Systems, Inc.
References: <1310697774774-4589174.post@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Fri, 2011-07-15 at 03:42 +0100, hellokitty wrote:
> Hi all,
>       Thanks to Ian Campbell, I am a student and now i am doing a research
> about using valgrind to detect xen hypervisor's memory leak .
>       The procedure of my detection is as follows:
>       First I follow the patch
> http://xen.1045712.n5.nabble.com/PATCHv2-valgrind-support-for-Xen-privcmd-ioctls-hypercalls-tc2640861.html#a4568310
> to let valgrind support Xen privcmd/hypercall.
>       Second I compile the source code of valgrind (have patched the upper
> patch) 

Please post your modified version of the patch.

>       Third I use the valgrind tool to detect the hypervisor's memory leak .
>       And the issues now i have are as follows:
>       1 , Now i come to second step , and i run the commands to compile the
> source code :

You seem to have missed step 0) which is to regenerate configure and
Makefile.* using autoconf/automake as I described in a previous mail.

>             1)     ./configure --with-xen=/usr/include/xen/
>             2)     make && make install
>             here i encounter the following error messages, how to fix it ?
> --------------------------------------------------------------------------------------
>               gcc: @XEN_CFLAGS@doesn't exist the file or directory

The configure script should have substituted this out, but if you didn't
regenerate it after apply the patch then it won't know to do this.

> [...]

> --------------------------------------------------------------------------------------
>       2, Suppose that i come to the third step, is it right to use the command
> to do the detection ?
>         "valgrind --tool=memcheck --leak-check=yes ./xen" (here xen is the
> binary file compiled by the source code of xen_4.0.1)

Wait, are you trying to use valgrind on the hypervisor itself?

The Xen hypervisor is an "Operating System" and runs on bare metal --
you can't run it as a process under Linux and therefore you cannot run a
tool like valgrind on it.

The valgrind support in my patch is useful for debugging the Xen
toolstack (e.g. "xl"), but not the hypervisor itself.

>         3,Does anyone here ever detect the xen hypervisor's memory leak
> before ?  Does someone have the valgrind tool support for hypervisor well ,
> can you send me one ?

Either Valgrind or Xen does not work how you seem to think it works. I
think you should consult with your advisor before trying to progress
this approach any further.

You might want to investigate the Linux kernel's "kmemleak" stuff, I
suppose something like that could be ported to Xen (although I expect it
to be a non-trivial amount of work).


Xen-devel mailing list