Bug #12511

vioblk should preallocate virtio chains

Added by Joshua M. Clulow 3 months ago. Updated 4 days ago.

driver - device drivers
Start date:
Due date:
% Done:


Estimated time:
Gerrit CR:


In vioblk_alloc_reqs(), vioblk makes an effort to preallocate a set of buffers for I/O requests. Unfortunately, in vioblk_common_start() we call the virtio_chain_alloc() routine to allocate memory for the descriptor chain we need to submit these requests into the virtqueue; this routine does dynamic allocations that can fail. We should follow the pattern established in vioif, and allocate the chains when we're initially populating the vib_reqs free list, using virtio_chain_clear() to reset them upon return to the free list.



Updated by Patrick Mooney 4 days ago

I have a build VM (running OmniOSce 151034) which has been hit by this recently. An illumos-gate build will place the machine under memory pressure, at which point DMA allocations for swap IO fails and the machine locks up hard.


Updated by Electric Monk 4 days ago

  • Gerrit CR set to 786

Updated by Patrick Mooney 4 days ago

  • Status changed from New to In Progress
  • Assignee set to Patrick Mooney

Updated by Patrick Mooney 4 days ago

I have a test VM using a virtio-block device to back its root (and only) zpool. I booted it up with this change and incurred some various IO:
- cloning a git repo
- scrubbing the pool
- trimming the pool (with the newly landed #12506)
All of these seemed to work without issue. I also NMIed the machine to make sure dump works, which it did. After it came back up, I savecore-ed the crash dump to make sure it looked OK.


Updated by Electric Monk 4 days ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit 3decf16814408c6b0b69d8df1e56e01cd3313a4f

commit  3decf16814408c6b0b69d8df1e56e01cd3313a4f
Author: Patrick Mooney <>
Date:   2020-07-10T18:09:44.000Z

    12511 vioblk should preallocate virtio chains
    Reviewed by: Jason King <>
    Reviewed by: Toomas Soome <>
    Reviewed by: Andy Fiddaman <>
    Approved by: Joshua M. Clulow <>

Also available in: Atom PDF