Page MenuHomeFreeBSD

Revert r332735 and fix MSI-X to properly fail allocations when full.
ClosedPublic

Authored by jhb on Nov 13 2018, 6:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 20 2023, 4:28 AM
Unknown Object (File)
Nov 9 2023, 5:32 AM
Unknown Object (File)
Oct 8 2023, 4:30 AM
Unknown Object (File)
Sep 19 2023, 11:50 PM
Unknown Object (File)
Sep 18 2023, 12:59 AM
Unknown Object (File)
Jun 27 2023, 10:49 PM
Unknown Object (File)
Jun 22 2023, 5:49 PM
Unknown Object (File)
Dec 19 2022, 7:06 AM
Subscribers

Details

Summary

The off-by-one errors in 332735 weren't actual errors and were
preventing the last MSI interrupt source from being used. Instead,
the issue is that when all MSI interrupt sources were allocated, the
loop in msix_alloc() would terminate with 'msi' still set to non-null.
The only check for 'i' overflowing was in the 'msi' == NULL case, so
msix_alloc() would try to reuse the last MSI interrupt source instead
of failing.

Fix by moving the check for all sources being in use to just after the
loop.

Test Plan
  • booted a bhyve VM with 2 virtio devices and hpet. hpet used 8 MSI IRQs, virtio_pci0 (vtnet) used 3, virtio_pci1 (vtblk) used 2. Tested with NUM_MSI_INTS set to 11 and with the fix, hpet gets 8, vtnet gets 3, and vtblk uses INT#. Without the fix, vtnet was only getting 2.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable