Re: Qemu-kvm is leaking my memory ???

Zdenek Kabelac
2008-03-24T21:42:17Z

2008/3/24, Avi Kivity <avi@qumranet.com>:
> Avi Kivity wrote:
> >>
> >>
> >> Tested - and actually seeing no difference in my case of memory leak.
> >> Still it looks like over 30M per execution of qemu is lost.
> >> (tested with fresh 2.6.25-rc6 with your patch)
> >>
> >>
> >
> > Can you double check? 2.6.25-rc6 definitely leaks without, and here it
> > doesn't with the patch.
> >
>
>
> btw, there's an additional patch I have queued up that might have an
> effect. please test the attached (which is my 2.6.25 queue).

Yep - I've made a quick short test - and it looks promising - so far I
can not see the leak
with your additional patch.

But I still have get my busy loop problem. Though now it's sometime
stack-back-traced on the leaveq - maybe this instruction might cause
some problems ??

Before this patch - I've always got the back-trace at the point of
copy_user_generic_string -
now its slightly different -- and still applies when I run the second
dmsetup status - it unblocks the looped one)

Call Trace:
[<ffffffff8803558d>] :dm_mod:dm_compat_ctl_ioctl+0xd/0x20
[<ffffffff802bd352>] compat_sys_ioctl+0x182/0x3d0
[<ffffffff80283d20>] vfs_write+0x130/0x170
[<ffffffff80221192>] sysenter_do_call+0x1b/0x66

Call Trace:
[<ffffffff88032100>] ? :dm_mod:table_status+0x0/0x90
[<ffffffff80436809>] ? error_exit+0x0/0x51
[<ffffffff88032100>] ? :dm_mod:table_status+0x0/0x90
[<ffffffff8032d157>] ? copy_user_generic_string+0x17/0x40
[<ffffffff880332d7>] ? :dm_mod:copy_params+0x87/0xb0
[<ffffffff80237b11>] ? __capable+0x11/0x30
[<ffffffff88033469>] ? :dm_mod:ctl_ioctl+0x169/0x260
[<ffffffff80340712>] ? tty_ldisc_deref+0x62/0x80
[<ffffffff8034320c>] ? tty_write+0x22c/0x260
[<ffffffff8803358d>] ? :dm_mod:dm_compat_ctl_ioctl+0xd/0x20
[<ffffffff802bd352>] ? compat_sys_ioctl+0x182/0x3d0
[<ffffffff80283d20>] ? vfs_write+0x130/0x170
[<ffffffff80221192>] ? sysenter_do_call+0x1b/0x66

Here is dissambled dm_compat_ctl_ioctl:

0000000000001fa0 <dm_compat_ctl_ioctl>:
return (long)ctl_ioctl(command, (struct dm_ioctl __user *)u);
}

#ifdef CONFIG_COMPAT
static long dm_compat_ctl_ioctl(struct file *file, uint command, ulong u)
{
1fa0: 55 push %rbp
1fa1: 89 f7 mov %esi,%edi
1fa3: 48 89 e5 mov %rsp,%rbp
return r;
}

static long dm_ctl_ioctl(struct file *file, uint command, ulong u)
{
return (long)ctl_ioctl(command, (struct dm_ioctl __user *)u);
1fa6: 89 d6 mov %edx,%esi
1fa8: e8 73 fd ff ff callq 1d20 <ctl_ioctl>

#ifdef CONFIG_COMPAT
static long dm_compat_ctl_ioctl(struct file *file, uint command, ulong u)
{
return (long)dm_ctl_ioctl(file, command, (ulong) compat_ptr(u));
}
1fad: c9 leaveq
return r;
}

static long dm_ctl_ioctl(struct file *file, uint command, ulong u)
{
return (long)ctl_ioctl(command, (struct dm_ioctl __user *)u);
1fae: 48 98 cltq

#ifdef CONFIG_COMPAT
static long dm_compat_ctl_ioctl(struct file *file, uint command, ulong u)
{
return (long)dm_ctl_ioctl(file, command, (ulong) compat_ptr(u));
}
1fb0: c3 retq

Zdenek