|
| From: | Paolo Bonzini |
| Subject: | Re: [PATCH] ide: Explicitly poll for BHs on cancel |
| Date: | Wed, 19 Jan 2022 12:11:12 +0100 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 |
On 1/5/22 12:13, Hanna Reitz wrote:
- assert(s->bus->dma->aiocb == NULL);
+
+ /*
+ * Wait for potentially still-scheduled BHs, like ide_trim_bh_cb()
+ * (blk_drain() will only poll if there are in-flight requests on the
+ * BlockBackend, which there may not necessarily be, e.g. when the
+ * guest has issued a zero-length TRIM request)
+ */
+ while (s->bus->dma->aiocb) {
+ bool progress = aio_poll(qemu_get_aio_context(), true);
+ assert(progress);
+ }
I think the right way to do this is to do blk_inc_in_flight before scheduling the bottom half and blk_dec_in_flight in the BH callback. See virtio_blk_dma_restart_cb for an example.
Paolo
| [Prev in Thread] | Current Thread | [Next in Thread] |