* [Qemu-devel] [PATCH][STABLE] Call missing qemu_bh_delete at the end of raw_aio_em_cb callback.
@ 2009-06-01 8:43 Dor Laor
2009-06-24 12:25 ` Dor Laor
0 siblings, 1 reply; 2+ messages in thread
From: Dor Laor @ 2009-06-01 8:43 UTC (permalink / raw)
To: qemu-devel, Glauber Costa
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 0001--Call-missing-qemu_bh_delete-at-the-end-of-raw_aio_.patch --]
[-- Type: text/plain, Size: 2287 bytes --]
>From 8e2e406e1220f9eedb042919c431c963af1433e4 Mon Sep 17 00:00:00 2001
From: Dor Laor <dor@redhat.com>
Date: Mon, 1 Jun 2009 00:22:28 +0300
Subject: [PATCH] [PATCH] Call missing qemu_bh_delete at the end of raw_aio_em_cb callback.
Without it, these cb's does not get cleaned and it slows
down qemu more and more. (to test, the # of bh->next chain
is huge when using cache=off).
Thanks Avi for helping with the debug.
Signed-off-by: Dor Laor <dor@redhat.com>
---
block-raw-posix.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/block-raw-posix.c b/block-raw-posix.c
index 85ca704..8fce9e6 100644
--- a/block-raw-posix.c
+++ b/block-raw-posix.c
@@ -439,6 +439,7 @@ typedef struct RawAIOCB {
BlockDriverAIOCB common;
struct qemu_paiocb aiocb;
struct RawAIOCB *next;
+ QEMUBH *bh;
int ret;
} RawAIOCB;
@@ -593,6 +594,8 @@ static void raw_aio_em_cb(void* opaque)
{
RawAIOCB *acb = opaque;
acb->common.cb(acb->common.opaque, acb->ret);
+ qemu_bh_delete(acb->bh);
+ acb->bh = NULL;
qemu_aio_release(acb);
}
@@ -628,11 +631,12 @@ static BlockDriverAIOCB *raw_aio_read(BlockDriverState *bs,
BDRVRawState *s = bs->opaque;
if (unlikely(s->aligned_buf != NULL && ((uintptr_t) buf % 512))) {
- QEMUBH *bh;
acb = qemu_aio_get(bs, cb, opaque);
acb->ret = raw_pread(bs, 512 * sector_num, buf, 512 * nb_sectors);
- bh = qemu_bh_new(raw_aio_em_cb, acb);
- qemu_bh_schedule(bh);
+ acb->bh = qemu_bh_new(raw_aio_em_cb, acb);
+ if (!acb->bh)
+ return NULL;
+ qemu_bh_schedule(acb->bh);
return &acb->common;
}
@@ -659,11 +663,12 @@ static BlockDriverAIOCB *raw_aio_write(BlockDriverState *bs,
BDRVRawState *s = bs->opaque;
if (unlikely(s->aligned_buf != NULL && ((uintptr_t) buf % 512))) {
- QEMUBH *bh;
acb = qemu_aio_get(bs, cb, opaque);
acb->ret = raw_pwrite(bs, 512 * sector_num, buf, 512 * nb_sectors);
- bh = qemu_bh_new(raw_aio_em_cb, acb);
- qemu_bh_schedule(bh);
+ acb->bh = qemu_bh_new(raw_aio_em_cb, acb);
+ if (!acb->bh)
+ return NULL;
+ qemu_bh_schedule(acb->bh);
return &acb->common;
}
--
1.5.6.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH][STABLE] Call missing qemu_bh_delete at the end of raw_aio_em_cb callback.
2009-06-01 8:43 [Qemu-devel] [PATCH][STABLE] Call missing qemu_bh_delete at the end of raw_aio_em_cb callback Dor Laor
@ 2009-06-24 12:25 ` Dor Laor
0 siblings, 0 replies; 2+ messages in thread
From: Dor Laor @ 2009-06-24 12:25 UTC (permalink / raw)
Cc: qemu-devel, Glauber Costa
[-- Attachment #1: Type: text/plain, Size: 2839 bytes --]
Now that Avi found an issue with the qemu_bh_delete patch,
I checkout the stable branch and this one was forgotten.
Actually this one does the right thing, when forward porting of it
to master I dropped the acb->bh =null.
On the stable it is a real issue, so please commit it.
Thanks,
Dor
On 06/01/2009 11:43 AM, Dor Laor wrote:
>
> ------------------------------------------------------------------------
>
> From 8e2e406e1220f9eedb042919c431c963af1433e4 Mon Sep 17 00:00:00 2001
> From: Dor Laor<dor@redhat.com>
> Date: Mon, 1 Jun 2009 00:22:28 +0300
> Subject: [PATCH] [PATCH] Call missing qemu_bh_delete at the end of raw_aio_em_cb callback.
>
> Without it, these cb's does not get cleaned and it slows
> down qemu more and more. (to test, the # of bh->next chain
> is huge when using cache=off).
> Thanks Avi for helping with the debug.
>
> Signed-off-by: Dor Laor<dor@redhat.com>
> ---
> block-raw-posix.c | 17 +++++++++++------
> 1 files changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/block-raw-posix.c b/block-raw-posix.c
> index 85ca704..8fce9e6 100644
> --- a/block-raw-posix.c
> +++ b/block-raw-posix.c
> @@ -439,6 +439,7 @@ typedef struct RawAIOCB {
> BlockDriverAIOCB common;
> struct qemu_paiocb aiocb;
> struct RawAIOCB *next;
> + QEMUBH *bh;
> int ret;
> } RawAIOCB;
>
> @@ -593,6 +594,8 @@ static void raw_aio_em_cb(void* opaque)
> {
> RawAIOCB *acb = opaque;
> acb->common.cb(acb->common.opaque, acb->ret);
> + qemu_bh_delete(acb->bh);
> + acb->bh = NULL;
> qemu_aio_release(acb);
> }
>
> @@ -628,11 +631,12 @@ static BlockDriverAIOCB *raw_aio_read(BlockDriverState *bs,
> BDRVRawState *s = bs->opaque;
>
> if (unlikely(s->aligned_buf != NULL&& ((uintptr_t) buf % 512))) {
> - QEMUBH *bh;
> acb = qemu_aio_get(bs, cb, opaque);
> acb->ret = raw_pread(bs, 512 * sector_num, buf, 512 * nb_sectors);
> - bh = qemu_bh_new(raw_aio_em_cb, acb);
> - qemu_bh_schedule(bh);
> + acb->bh = qemu_bh_new(raw_aio_em_cb, acb);
> + if (!acb->bh)
> + return NULL;
> + qemu_bh_schedule(acb->bh);
> return&acb->common;
> }
>
> @@ -659,11 +663,12 @@ static BlockDriverAIOCB *raw_aio_write(BlockDriverState *bs,
> BDRVRawState *s = bs->opaque;
>
> if (unlikely(s->aligned_buf != NULL&& ((uintptr_t) buf % 512))) {
> - QEMUBH *bh;
> acb = qemu_aio_get(bs, cb, opaque);
> acb->ret = raw_pwrite(bs, 512 * sector_num, buf, 512 * nb_sectors);
> - bh = qemu_bh_new(raw_aio_em_cb, acb);
> - qemu_bh_schedule(bh);
> + acb->bh = qemu_bh_new(raw_aio_em_cb, acb);
> + if (!acb->bh)
> + return NULL;
> + qemu_bh_schedule(acb->bh);
> return&acb->common;
> }
>
> -- 1.5.6.6
[-- Attachment #2: Type: text/html, Size: 3570 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-24 12:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-01 8:43 [Qemu-devel] [PATCH][STABLE] Call missing qemu_bh_delete at the end of raw_aio_em_cb callback Dor Laor
2009-06-24 12:25 ` Dor Laor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).