Skip to contentSkip to conversation

Fix regression introduced by 6398

PATCH In review Eduardo Felipe 1 participant 2 messages Jan 30, 2009 – Feb 1, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix regression introduced by 6398

Hi,

After commit 6398 some of my guests started to SEGFAULT at boot time. Reverting these two lines fixes the problem for me:

hw/ide.c Fri Jan 30 21:13:49 2009 renamed from hw/ide.c Fri Jan 30 21:15:15 2009 +2 -2
@@ -1084,7 +1084,7 @@
 #ifdef DEBUG_AIO
     printf("aio_read: sector_num=%" PRId64 " n=%d\n", sector_num, n);
 #endif
-    bm->aiocb = bdrv_aio_readv(s->bs, sector_num, &s->iovec, n,
+    bm->aiocb = bdrv_aio_read(s->bs, sector_num, s->io_buffer, n,
                                ide_read_dma_cb, bm);
     ide_dma_submit_check(s, ide_read_dma_cb, bm);
 }
@@ -1212,7 +1212,7 @@
 #ifdef DEBUG_AIO
     printf("aio_write: sector_num=%" PRId64 " n=%d\n", sector_num, n);
 #endif
-    bm->aiocb = bdrv_aio_writev(s->bs, sector_num, &s->iovec, n,
+    bm->aiocb = bdrv_aio_write(s->bs, sector_num, s->io_buffer, n,
                                 ide_write_dma_cb, bm);
     ide_dma_submit_check(s, ide_write_dma_cb, bm);
 }

Can anybody take a look at it?

Thanks,
Edu

#1 lore raw

2009/1/30 Eduardo Felipe <[email protected]>:

Quoted 29 lines

Hi,

After commit 6398 some of my guests started to SEGFAULT at boot time. Reverting these two lines fixes the problem for me:

hw/ide.c Fri Jan 30 21:13:49 2009 renamed from hw/ide.c Fri Jan 30 21:15:15 2009 +2 -2
@@ -1084,7 +1084,7 @@
 #ifdef DEBUG_AIO
    printf("aio_read: sector_num=%" PRId64 " n=%d\n", sector_num, n);
 #endif
-    bm->aiocb = bdrv_aio_readv(s->bs, sector_num, &s->iovec, n,
+    bm->aiocb = bdrv_aio_read(s->bs, sector_num, s->io_buffer, n,
                               ide_read_dma_cb, bm);
    ide_dma_submit_check(s, ide_read_dma_cb, bm);
 }
@@ -1212,7 +1212,7 @@
 #ifdef DEBUG_AIO
    printf("aio_write: sector_num=%" PRId64 " n=%d\n", sector_num, n);
 #endif
-    bm->aiocb = bdrv_aio_writev(s->bs, sector_num, &s->iovec, n,
+    bm->aiocb = bdrv_aio_write(s->bs, sector_num, s->io_buffer, n,
                                ide_write_dma_cb, bm);
    ide_dma_submit_check(s, ide_write_dma_cb, bm);
 }
Quoted 5 lines

Can anybody take a look at it?

Thanks,
Edu

Please, ignore my previous mail.

I traced the problem to the qemu_free call in bdrv_aio_rw_vector_cb. It fails when s->bounce is exactly 65536 bytes long (128 sectors). This change seems to do the trick:

block.c +1 -1
@@ -1286,7 +1286,7 @@
 
     s->this_aiocb = aiocb;
     s->iov = iov;
-    s->bounce = qemu_memalign(512, nb_sectors * 512);
+    s->bounce = qemu_memalign(512, nb_sectors * 512 + 4);
     s->is_write = is_write;
     if (is_write) {
         qemu_iovec_to_buffer(s->iov, s->bounce);

I've seen a similar hack in ide_init2 when calling qemu_memalign. Are these four bytes used in any way or it's just a way to avoid allocating exactly a 64k multiple buffer?

My host is Win32. Can anybody confirm if this happens in any other platform?

Regards,
Edu