)]}'
{
  "commit": "2ae361ef1d7d526b07ff88d854552e2d009bfb1b",
  "tree": "738bcf9e959802e6cc1346505be7a488deed9bdd",
  "parents": [
    "07f97d5da04a9f97e273de85c76f5017d8135a6e"
  ],
  "author": {
    "name": "Jens Axboe",
    "email": "axboe@kernel.dk",
    "time": "Wed Feb 18 15:09:58 2026 -0500"
  },
  "committer": {
    "name": "Stefan Hajnoczi",
    "email": "stefanha@redhat.com",
    "time": "Mon Feb 23 08:49:51 2026 -0500"
  },
  "message": "aio-posix: notify main loop when SQEs are queued\n\nWhen a vCPU thread handles MMIO (holding BQL), aio_co_enter() runs the\nblock I/O coroutine inline on the vCPU thread because\nqemu_get_current_aio_context() returns the main AioContext when BQL is\nheld. The coroutine calls luring_co_submit() which queues an SQE via\nfdmon_io_uring_add_sqe(), but the actual io_uring_submit() only happens\nin gsource_prepare() on the main loop thread.\n\nSince the coroutine ran inline (not via aio_co_schedule()), no BH is\nscheduled and aio_notify() is never called. The main loop remains asleep\nin ppoll() with up to a 499ms timeout, leaving the SQE unsubmitted until\nthe next timer fires.\n\nFix this by calling aio_notify() after queuing the SQE. This wakes the\nmain loop via the eventfd so it can run gsource_prepare() and submit the\npending SQE promptly.\n\nThis is a generic fix that benefits all devices using aio\u003dio_uring.\nWithout it, AHCI/SATA devices see MUCH worse I/O latency since they use\nMMIO (not ioeventfd like virtio) and have no other mechanism to wake the\nmain loop after queuing block I/O.\n\nThis is usually a bit hard to detect, as it also relies on the ppoll\nloop not waking up for other activity, and micro benchmarks tend not to\nsee it because they don\u0027t have any real processing time. With a\nsynthetic test case that has a few usleep() to simulate processing of\nread data, it\u0027s very noticeable. The below example reads 128MB with\nO_DIRECT in 128KB chunks in batches of 16, and has a 1ms delay before\neach batch submit, and a 1ms delay after processing each completion.\nRunning it on /dev/sda yields:\n\ntime sudo ./iotest /dev/sda\n\n________________________________________________________\nExecuted in   25.76 secs\t  fish           external\n   usr time    6.19 millis  783.00 micros    5.41 millis\n   sys time   12.43 millis  642.00 micros   11.79 millis\n\nwhile on a virtio-blk or NVMe device we get:\n\ntime sudo ./iotest /dev/vdb\n\n________________________________________________________\nExecuted in    1.25 secs      fish           external\n   usr time    1.40 millis    0.30 millis    1.10 millis\n   sys time   17.61 millis    1.43 millis   16.18 millis\n\ntime sudo ./iotest /dev/nvme0n1\n\n________________________________________________________\nExecuted in    1.26 secs      fish           external\n   usr time    6.11 millis    0.52 millis    5.59 millis\n   sys time   13.94 millis    1.50 millis   12.43 millis\n\nwhere the latter are consistent. If we run the same test but keep the\nsocket for the ssh connection active by having activity there, then\nthe sda test looks as follows:\n\ntime sudo ./iotest /dev/sda\n\n________________________________________________________\nExecuted in    1.23 secs      fish           external\n   usr time    2.70 millis   39.00 micros    2.66 millis\n   sys time    4.97 millis  977.00 micros    3.99 millis\n\nas now the ppoll loop is woken all the time anyway.\n\nAfter this fix, on an idle system:\n\ntime sudo ./iotest /dev/sda\n\n________________________________________________________\nExecuted in    1.30 secs      fish           external\n   usr time    2.14 millis    0.14 millis    2.00 millis\n   sys time   16.93 millis    1.16 millis   15.76 millis\n\nSigned-off-by: Jens Axboe \u003caxboe@kernel.dk\u003e\nMessage-Id: \u003c07d701b9-3039-4f9b-99a2-abeae51146a5@kernel.dk\u003e\nReviewed-by: Kevin Wolf \u003ckwolf@redhat.com\u003e\n[Generalize the comment since this applies to all vCPU thread activity,\nnot just coroutines, as suggested by Kevin Wolf \u003ckwolf@redhat.com\u003e.\n--Stefan]\nSigned-off-by: Stefan Hajnoczi \u003cstefanha@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "e24b955fd91a671354a46755e73da1c74ba01e43",
      "old_mode": 33188,
      "old_path": "util/aio-posix.c",
      "new_id": "488d964611bbdb75790326a2ca04be4ddb73ac0c",
      "new_mode": 33188,
      "new_path": "util/aio-posix.c"
    }
  ]
}
