Re: aio: compat_ioctl issue?

From: Michael Tokarev
Date: Mon Mar 08 2010 - 16:50:36 EST


Jeff Moyer wrote:
> Michael Tokarev <mjt@xxxxxxxxxx> writes:
>
>> Hello.
>>
>> I just come across a situation (next in a long row :)
>> when on x86, 32bit userspace does not work with 64bit
>> kernel. This time this is about aio requests.
>>
>> An application submits some aio job, and it is returned
>> immediately (from io_getevents()) with EINVAL error.
[]
> Can you post the program, please?

The program which I'm trying is quite big - it's qemu-kvm
v. 0.12.3 compiled with --enable-linux-aio. I bugged
kvm folks about non-working aio support but immediately
realized it's 32/64bit issue in the kernel, since 64bit
kvm works just fine on the same kernel (which is 64bits).
So I added 2 printfs into its linux-aio.c and re-run it.

The diff against upstream qemu-kvm is this one:

---- cut -----
diff --git a/linux-aio.c b/linux-aio.c
index 5e892b0..e856873 100644
--- a/linux-aio.c
+++ b/linux-aio.c
@@ -60,6 +60,9 @@ static void qemu_laio_process_completion(struct qemu_laio_state *s,

ret = laiocb->ret;
if (ret != -ECANCELED) {
+if (ret != laiocb->nbytes)
+fprintf(stderr, "io_getevents: exp %d got %d %s\n", laiocb->nbytes, ret,
+strerror(ret));
if (ret == laiocb->nbytes)
ret = 0;
else if (ret >= 0)
@@ -223,6 +226,12 @@ BlockDriverAIOCB *laio_submit(BlockDriverState *bs, void *aio_ctx, int fd,
io_set_eventfd(&laiocb->iocb, s->efd);
s->count++;

+{ struct iovec *v = (struct iovec*)iocbs->u.c.buf;
+printf("io_submit: lio_opcode=%d reqprio=%d iov=%p{%p,%d}, niov=%lu, offset=%Ld\n",
+iocbs->aio_lio_opcode, iocbs->aio_reqprio, iocbs->u.c.buf,
+v->iov_base, v->iov_len,
+iocbs->u.c.nbytes, iocbs->u.c.offset);
+}
if (io_submit(s->ctx, 1, &iocbs) < 0)
goto out_dec_count;
return &laiocb->common;
---- cut -----

I'm not sure if it's useful or not.

Qemu-kvm git tree is at
git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git

I never dealt with aio before, so I'll need to familiarize
myself with it before trying to create a smaller testcase.

Thanks!

/mjt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/