Skip to contentSkip to conversation

fix qemu memory leak

PATCH In review Stefano Stabellini 5 participants 10 messages Aug 12, 2009 – Aug 16, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix qemu memory leak

Hi all,
the qemu block interface leaks memory every time a read or write request is issued, this patch fixes it.
This is also the bug that is causing stubdomains to crash under high disk IO.

---

block.c +1 -0
index 36f5eb9..6ce453c 100644
@@ -1378,6 +1378,7 @@ static void bdrv_aio_rw_vector_cb(void *opaque, int ret)
     qemu_vfree(s->bounce);
     s->this_aiocb->cb(s->this_aiocb->opaque, ret);
     qemu_aio_release(s->this_aiocb);
+    qemu_free(s);
 }
 
 static BlockDriverAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs,
#1 lore raw
Quoted 5 lines · Stefano Stabellini

Hi all,
the qemu block interface leaks memory every time a read or write request is issued, this patch fixes it.
This is also the bug that is causing stubdomains to crash under high disk IO.

I forgot to say that this patch should be backported to 3.4 too.

Quoted 22 lines

---

block.c +1 -0
index 36f5eb9..6ce453c 100644
@@ -1378,6 +1378,7 @@ static void bdrv_aio_rw_vector_cb(void *opaque, int ret)
     qemu_vfree(s->bounce);
     s->this_aiocb->cb(s->this_aiocb->opaque, ret);
     qemu_aio_release(s->this_aiocb);
+    qemu_free(s);
 }
 
 static BlockDriverAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs,

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw

Is this just for stubdom, or is it a generic qemu problem? (Your patch just gives the filename, no path to it.)

Quoted 48 lines

-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: Wednesday, August 12, 2009 10:12 AM
To: Stefano Stabellini
Cc: [email protected]
Subject: Re: [Xen-devel] [PATCH] fix qemu memory leak

Quoted 2 lines · Stefano Stabellini

Hi all,
the qemu block interface leaks memory every time a read or

write request

Quoted 3 lines

is issued, this patch fixes it.
This is also the bug that is causing stubdomains to crash under high disk IO.

I forgot to say that this patch should be backported to 3.4 too.

block.c static void

Quoted 9 lines

---

block.c +0 -0
index 36f5eb9..6ce453c 100644
@@ -1378,6 +1378,7 @@ static void 

bdrv_aio_rw_vector_cb(void *opaque, int ret)

Quoted 8 lines
block.c +1 -0
     qemu_vfree(s->bounce);
     s->this_aiocb->cb(s->this_aiocb->opaque, ret);
     qemu_aio_release(s->this_aiocb);
+    qemu_free(s);
 }
 
 static BlockDriverAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs,
Quoted 5 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
Quoted 2 lines · Dan Magenheimer

Is this just for stubdom, or is it a generic qemu problem? (Your patch just gives the filename, no path to it.)

It is a qemu bug, the path is the root directory of the qemu-xen repository.

#4 lore raw

Tools for tracing process switching in dom0

We are putting a heavy load on dom0 and some occasions we see cases where processes appear to stall (based on timestamp information in their log files). I have not been able to determine what causes these processes to starve for CPU cycles but I'm guessing some other higher priority process/service may be coming in periodically and disrupting our process.

I'm wondering if there are any Linux tracing/probing tools that work in dom0 that would allow me to capture (with a timestamp) all process context switches.

Thanks
Roger

#5 lore raw

Re: Tools for tracing process switching in dom0

Is this in 2.6.18, or 2.6.27 (pv-ops)?

I'm not familiar with Linux tracing, but I think whatever is available in either of those kernels should work in a similar way that it does on bare metal.

If you want to see what Xen is doing, you can use xentrace. Real Soon Now (hopefully this week) I'll be releasing xenalyze, which is a pretty powerful tool for extracting information from trace files.

-George

Quoted 22 lines · Roger Cruz

We are putting a heavy load on dom0 and some occasions we see cases where processes appear to stall (based on timestamp information in their log files).  I have not been able to determine what causes these processes to starve for CPU cycles but I'm guessing some other higher priority process/service may be coming in periodically and disrupting our process.

I'm wondering if there are any Linux tracing/probing tools that work in dom0 that would allow me to capture (with a timestamp) all process context switches.

Thanks
Roger

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#6 lore raw
In reply to Stefano Stabellini

Ah, no wonder the two files named block.c in my xen-unstable tree didn't match the patch!

This seems like a very serious bug then. Any idea if its been around a long time or is a recent regression?

Quoted 16 lines

-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: Wednesday, August 12, 2009 11:19 AM
To: Dan Magenheimer
Cc: Stefano Stabellini; [email protected]
Subject: RE: [Xen-devel] [PATCH] fix qemu memory leak

Quoted 2 lines · Dan Magenheimer

Is this just for stubdom, or is it a generic qemu problem? (Your patch just gives the filename, no path to it.)

It is a qemu bug, the path is the root directory of the qemu-xen repository.

#7 lore raw
Quoted 6 lines · Dan Magenheimer

Ah, no wonder the two files named block.c in my xen-unstable tree didn't match the patch!

This seems like a very serious bug then. Any idea if its been around a long time or is a recent regression?

It was introduced on qemu by:

3b69e4b9ad3483bafcc3adc948703dc78e84ed33

and made its way into qemu-xen at the end of January during the following merge.

#8 lore raw
In reply to Stefano Stabellini
Quoted 5 lines · Stefano Stabellini

Hi all,
the qemu block interface leaks memory every time a read or write request is issued, this patch fixes it.
This is also the bug that is causing stubdomains to crash under high disk IO.

Thanks, I'll retest stubdomains.

Keith Coleman

#9 lore raw
Quoted 8 lines · Keith Coleman
Quoted 5 lines · Stefano Stabellini

Hi all,
the qemu block interface leaks memory every time a read or write request is issued, this patch fixes it.
This is also the bug that is causing stubdomains to crash under high disk IO.

Quoted 5 lines

Thanks, I'll retest stubdomains.

Keith Coleman

The disk IO tests that previously crashed my stubdoms within minutes have been running successfully for several days with no signs of trouble.

Keith Coleman