Re: [Qemu-devel] [PATCH] block/file-posix: add bdrv_attach_aio_context callback for host dev and cdrom

2018-07-20 Thread Nishanth Aravamudan via Qemu-devel
On 20.07.2018 [15:11:14 -0400], Farhan Ali wrote: > I am seeing another issue pop up, in a different test. Even though it's a > different assertion, it might be related based on the call trace. Just to be clear, this does not happen if you revert the original patch (i.e., the one you bisected to b

Re: [Qemu-devel] [qemu-s390x] [BUG?] aio_get_linux_aio: Assertion `ctx->linux_aio' failed

2018-07-19 Thread Nishanth Aravamudan via Qemu-devel
Hi Christian, On 19.07.2018 [08:55:20 +0200], Christian Borntraeger wrote: > > > On 07/18/2018 08:52 PM, Nishanth Aravamudan wrote: > > On 18.07.2018 [11:10:27 -0400], Farhan Ali wrote: > >> > >> > >> On 07/18/2018 09:42 AM, Farhan Ali wrote: > >> I am not too familiar with block device code

[Qemu-devel] [PATCH] block/file-posix: add bdrv_attach_aio_context callback for host dev and cdrom

2018-07-18 Thread Nishanth Aravamudan via Qemu-devel
In ed6e2161 ("linux-aio: properly bubble up errors from initialzation"), I only added a bdrv_attach_aio_context callback for the bdrv_file driver. There are several other drivers that use the shared aio_plug callback, though, and they will trip the assertion added to aio_get_linux_aio because they

Re: [Qemu-devel] [BUG?] aio_get_linux_aio: Assertion `ctx->linux_aio' failed

2018-07-18 Thread Nishanth Aravamudan via Qemu-devel
On 18.07.2018 [11:10:27 -0400], Farhan Ali wrote: > > > On 07/18/2018 09:42 AM, Farhan Ali wrote: > > > > > > On 07/17/2018 04:52 PM, Nishanth Aravamudan wrote: > > > iiuc, this possibly implies AIO was not actually used previously on this > > > guest (it might have silently been falling back t

Re: [Qemu-devel] [BUG?] aio_get_linux_aio: Assertion `ctx->linux_aio' failed

2018-07-17 Thread Nishanth Aravamudan via Qemu-devel
On 17.07.2018 [13:25:53 -0400], Farhan Ali wrote: > Hi, > > I am seeing some strange QEMU assertion failures for qemu on s390x, > which prevents a guest from starting. > > Git bisecting points to the following commit as the source of the error. > > commit ed6e2161715c527330f936d44af4c547f25f687e

[Qemu-devel] [PATCH v4] linux-aio: properly bubble up errors from initialization

2018-06-22 Thread Nishanth Aravamudan via Qemu-devel
laio_init() can fail for a couple of reasons, which will lead to a NULL pointer dereference in laio_attach_aio_context(). To solve this, add a aio_setup_linux_aio() function which is called early in raw_open_common. If this fails, propagate the error up. The signature of aio_get_linux_aio() was no

Re: [Qemu-devel] [PATCH v3 2/2] block/file-posix: reconfigure aio on iothread start

2018-06-22 Thread Nishanth Aravamudan via Qemu-devel
On 22.06.2018 [11:02:06 +0200], Kevin Wolf wrote: > Am 22.06.2018 um 04:25 hat Fam Zheng geschrieben: > > On Thu, 06/21 15:21, Nishanth Aravamudan wrote: > > > When the AioContext changes, we need to associate a LinuxAioState with > > > the new AioContext. Use the bdrv_attach_aio_context callback a

Re: [Qemu-devel] [PATCH v3 1/2] linux-aio: properly bubble up errors from initialization

2018-06-22 Thread Nishanth Aravamudan via Qemu-devel
On 22.06.2018 [10:21:19 +0800], Fam Zheng wrote: > On Thu, 06/21 15:21, Nishanth Aravamudan wrote: > > laio_init() can fail for a couple of reasons, which will lead to a NULL > > pointer dereference in laio_attach_aio_context(). > > > > To solve this, add a aio_setup_linux_aio() function which is

[Qemu-devel] [PATCH v3 1/2] linux-aio: properly bubble up errors from initialization

2018-06-21 Thread Nishanth Aravamudan via Qemu-devel
laio_init() can fail for a couple of reasons, which will lead to a NULL pointer dereference in laio_attach_aio_context(). To solve this, add a aio_setup_linux_aio() function which is called early in raw_open_common. If this fails, propagate the error up. The signature of aio_get_linux_aio() was no

[Qemu-devel] [PATCH v3 0/2] linux-aio: fix two NULL pointer dereferences failure paths

2018-06-21 Thread Nishanth Aravamudan via Qemu-devel
laio_init() can fail for a couple of reasons, which will lead to a NULL pointer dereference in laio_attach_aio_context(), called from aio_get_linux_aio(). Test case 1: Set /proc/sys/fs/max-aio-nr to 0. Start a guest with an aio=native disk. Result: laio_init() returns NULL due to not

[Qemu-devel] [PATCH v3 2/2] block/file-posix: reconfigure aio on iothread start

2018-06-21 Thread Nishanth Aravamudan via Qemu-devel
When the AioContext changes, we need to associate a LinuxAioState with the new AioContext. Use the bdrv_attach_aio_context callback and call the new aio_setup_linux_aio(), which will allocate a new AioContext if needed, and return errors on failures. If it fails for any reason, fallback to threaded

Re: [Qemu-devel] [Qemu-block] [PATCH] [RFC v2] aio: properly bubble up errors from initialization

2018-06-21 Thread Nishanth Aravamudan via Qemu-devel
ishanth Aravamudan geschrieben: > > > > > On 19.06.2018 [15:35:57 -0700], Nishanth Aravamudan wrote: > > > > > > On 19.06.2018 [13:14:51 -0700], Nishanth Aravamudan wrote: > > > > > > > On 19.06.2018 [14:35:33 -0500], Eric Bla

Re: [Qemu-devel] [Qemu-block] [PATCH] [RFC v2] aio: properly bubble up errors from initialization

2018-06-20 Thread Nishanth Aravamudan via Qemu-devel
018 [13:14:51 -0700], Nishanth Aravamudan wrote: > > > > > On 19.06.2018 [14:35:33 -0500], Eric Blake wrote: > > > > > > On 06/15/2018 12:47 PM, Nishanth Aravamudan via Qemu-devel wrote: > > > > > > > > > > > > > > > >

Re: [Qemu-devel] [Qemu-block] [PATCH] [RFC v2] aio: properly bubble up errors from initialization

2018-06-20 Thread Nishanth Aravamudan via Qemu-devel
35:33 -0500], Eric Blake wrote: > > > > > On 06/15/2018 12:47 PM, Nishanth Aravamudan via Qemu-devel wrote: > > > > > > > > > > > > > > > } else if (s->use_linux_aio) { > > > > > > +int rc; &g

Re: [Qemu-devel] [PATCH] [RFC v2] aio: properly bubble up errors from initialization

2018-06-19 Thread Nishanth Aravamudan via Qemu-devel
On 19.06.2018 [15:35:57 -0700], Nishanth Aravamudan wrote: > On 19.06.2018 [13:14:51 -0700], Nishanth Aravamudan wrote: > > On 19.06.2018 [14:35:33 -0500], Eric Blake wrote: > > > On 06/15/2018 12:47 PM, Nishanth Aravamudan via Qemu-devel wrote: > > > >

Re: [Qemu-devel] [PATCH] [RFC v2] aio: properly bubble up errors from initialization

2018-06-19 Thread Nishanth Aravamudan via Qemu-devel
On 19.06.2018 [13:14:51 -0700], Nishanth Aravamudan wrote: > On 19.06.2018 [14:35:33 -0500], Eric Blake wrote: > > On 06/15/2018 12:47 PM, Nishanth Aravamudan via Qemu-devel wrote: > > > } else if (s->use_linux_aio) { > > > +

Re: [Qemu-devel] [PATCH] [RFC v2] aio: properly bubble up errors from initialization

2018-06-19 Thread Nishanth Aravamudan via Qemu-devel
On 19.06.2018 [14:35:33 -0500], Eric Blake wrote: > On 06/15/2018 12:47 PM, Nishanth Aravamudan via Qemu-devel wrote: > > laio_init() can fail for a couple of reasons, which will lead to a NULL > > pointer dereference in laio_attach_aio_context(). > > > > To solve this

[Qemu-devel] [PATCH] [RFC v2] aio: properly bubble up errors from initialization

2018-06-15 Thread Nishanth Aravamudan via Qemu-devel
laio_init() can fail for a couple of reasons, which will lead to a NULL pointer dereference in laio_attach_aio_context(). To solve this, add a aio_setup_linux_aio() function which is called before aio_get_linux_aio() where it is called currently, and which propogates setup errors up. The signature

Re: [Qemu-devel] [Qemu-block] [PATCH] [RFC] aio: properly bubble up errors from initialization

2018-06-15 Thread Nishanth Aravamudan via Qemu-devel
Hi Kevin, On 15.06.2018 [10:41:26 +0200], Kevin Wolf wrote: > Am 15.06.2018 um 01:21 hat Nishanth Aravamudan geschrieben: > > laio_init() can fail for a couple of reasons, which will lead to a NULL > > pointer dereference in laio_attach_aio_context(). > > > > To solve this, add a aio_linux_aio_se

[Qemu-devel] [PATCH] [RFC] aio: properly bubble up errors from initialization

2018-06-14 Thread Nishanth Aravamudan via Qemu-devel
laio_init() can fail for a couple of reasons, which will lead to a NULL pointer dereference in laio_attach_aio_context(). To solve this, add a aio_linux_aio_setup() path which is called where aio_get_linux_aio() is called currently, but can propogate errors up. virtio-block and virtio-scsi call t

Re: [Qemu-devel] AIO error case

2018-05-23 Thread Nishanth Aravamudan via Qemu-devel
On Wed, May 23, 2018 at 10:53 AM, John Snow wrote: > > > > On 05/22/2018 06:01 PM, Nishanth Aravamudan via Qemu-devel wrote: > > Hi! > > > > Hi! CCing qemu-bl...@nongnu.org; > > > I'm tracking an error case in the native AIO path, and was wondering if

[Qemu-devel] AIO error case

2018-05-22 Thread Nishanth Aravamudan via Qemu-devel
Hi! I'm tracking an error case in the native AIO path, and was wondering if there was a latent (albeit possibly hard to hit) bug. Specifically util/async.c::aio_get_linux_aio: #ifdef CONFIG_LINUX_AIO LinuxAioState *aio_get_linux_aio(AioContext *ctx) { if (!ctx->linux_aio) { ctx->linux