Skip to contentSkip to conversation

memory leak in block/xen_disk in qemu-3.x

Qemu-devel Olaf Hering 2 participants 4 messages Dec 11, 2018

lore
Share & tools
lore
#0 lore raw

What are the live time rules of ioreq->buf?

In my testing the memory usage of qemu is constantly growing from about 250MB to several GB after a few days.

Some debugging shows that ioreq_runio_qemu_aio() overwrites ioreq->buf, which contributes to the leak. In addition, ioreq_reset() also just globbers iorew->buf. While this was observed with a backport of xen_disk changes to qemu-2.9, the code in xen_disk.c did not change in this regard. I changed the code to call qemu_vfree(ioreq->buf) in the few places that globber the pointer, that fixes the leak for me.

Right now neither qemu-3.0 nor 3.1 for me, so I can not test qemu.git#master if it eventually behaves different than qemu.git#stable-2.9+backport.

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#1 lore raw
Quoted 11 lines

-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of Olaf Hering
Sent: 11 December 2018 15:31
To: [email protected]; [email protected]
Subject: [Xen-devel] memory leak in block/xen_disk in qemu-3.x

What are the live time rules of ioreq->buf?

In my testing the memory usage of qemu is constantly growing from about 250MB to several GB after a few days.

Are you perhaps running into the problem addressed by this patch?

https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg00244.html

Paul

Quoted 8 lines

Some debugging shows that ioreq_runio_qemu_aio() overwrites ioreq->buf, which contributes to the leak. In addition, ioreq_reset() also just globbers iorew->buf. While this was observed with a backport of xen_disk changes to qemu-2.9, the code in xen_disk.c did not change in this regard. I changed the code to call qemu_vfree(ioreq->buf) in the few places that globber the pointer, that fixes the leak for me.

Quoted 5 lines

Right now neither qemu-3.0 nor 3.1 for me, so I can not test qemu.git#master if it eventually behaves different than qemu.git#stable-2.9+backport.

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 7 lines · Paul Durrant
Quoted 7 lines

-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of Olaf Hering
Sent: 11 December 2018 15:31
To: [email protected]; [email protected]
Subject: [Xen-devel] memory leak in block/xen_disk in qemu-3.x

Quoted 5 lines
Quoted 3 lines

What are the live time rules of ioreq->buf?
In my testing the memory usage of qemu is constantly growing from about 250MB to several GB after a few days.

Are you perhaps running into the problem addressed by this patch?
https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg00244.html

This looks like a fix, rather than an improvement.
More than a month passed already, why is it not yet in qemu.git#master?

Olaf

#3 lore raw
Quoted 19 lines

-----Original Message-----
From: Olaf Hering [mailto:[email protected]]
Sent: 11 December 2018 16:08
To: Paul Durrant <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] memory leak in block/xen_disk in qemu-3.x

Quoted 2 lines · Paul Durrant
Quoted 2 lines

-----Original Message-----
From: Xen-devel [mailto:[email protected]] On

Behalf

Quoted 7 lines
Quoted 7 lines

Of Olaf Hering
Sent: 11 December 2018 15:31
To: [email protected]; [email protected]
Subject: [Xen-devel] memory leak in block/xen_disk in qemu-3.x

What are the live time rules of ioreq->buf?
In my testing the memory usage of qemu is constantly growing from

Quoted 8 lines

about

Quoted 3 lines
Quoted 1 line

250MB to several GB after a few days.

Are you perhaps running into the problem addressed by this patch?
https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg00244.html

This looks like a fix, rather than an improvement.
More than a month passed already, why is it not yet in qemu.git#master?

It was nacked on the basis that xen_disk is legacy. I have re-based it on my series re-working xen_disk and, as soon as that is all acked, I will post the re-based patch.

Paul

Quoted 1 line

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel