Page MenuHomeFreeBSD

Convert the number of MSI IRQs on x86 from a constant to a tunable.
ClosedPublic

Authored by jhb on Nov 13 2018, 6:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 21, 10:58 AM
Unknown Object (File)
Fri, Nov 15, 2:16 PM
Unknown Object (File)
Oct 6 2024, 4:08 AM
Unknown Object (File)
Oct 1 2024, 1:10 PM
Unknown Object (File)
Sep 30 2024, 9:05 AM
Unknown Object (File)
Sep 29 2024, 10:58 PM
Unknown Object (File)
Sep 27 2024, 9:13 PM
Unknown Object (File)
Sep 27 2024, 11:58 AM
Subscribers

Details

Summary

The number of MSI IRQs still defaults to 512, but it can now be changed at
boot time via the machdep.num_msi_irqs tunable.

Test Plan
  • booted a bhyve VM similar to the setup described in D17976. With machdep.num_msi_irqs=11 it had the same correct behavior described in the test plan for D17976.

Note, xen_msi might need it's own validation as it doesn't seem prepared
to cope with num_msi_irqs == 0, for example. I have not tested XEN.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 20811
Build 20205: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Nov 14 2018, 7:28 AM
markj added inline comments.
sys/x86/x86/msi.c
158

We have SYSCTL_UINT.

sys/x86/xen/xen_msi.c
79

Get rid of redundant parens while here?

I plan to get rid of the Xen specific MSI implementation soon.

jhb marked 3 inline comments as done.Nov 14 2018, 7:16 PM
jhb added inline comments.
sys/x86/x86/msi.c
343–345

I think at a minimum I should add an overflow check here actually.

  • Fixes from markj.
  • Add overflow checks.
This revision now requires review to proceed.Nov 14 2018, 7:16 PM
jhb marked an inline comment as done.Nov 14 2018, 7:18 PM
jhb added inline comments.
sys/x86/xen/xen_intr.c
693

So sadly clang omits this overflow check though it keeps the one in msi.c. I was testing by setting machdep.num_msi_irqs to 0xfffffff00 which panicked in msi.c and then tried 0xfffffeff which should have panicked here but didn't and just overflowed num_io_irqs to 4095.

sys/x86/xen/xen_intr.c
693

Do you need to cast NR_EVENT_CHANNELS to u_int?

  • Rework the Xen overflow check due to size_t promotion.
This revision is now accepted and ready to land.Nov 14 2018, 7:43 PM
jhb marked an inline comment as done.Nov 14 2018, 7:43 PM
jhb added inline comments.
sys/x86/xen/xen_intr.c
693

Thanks to Mark for noticing that NR_EVENT_CHANNELS ends up being a size_t which is why the original expression was always false. This one works. Note that trying to boot with a large number of interrupts that didn't overflow wasn't very productive as the interrupt_sources[] array can be nearly 4GB and that's an awfully large size to pass to malloc().

sys/x86/xen/xen_msi.c
61–63

Hmm, it'd be consistent to convert this to if (num_msi_irqs > UINT_MAX - first_msi_irqs).

  • Adjust other overflow checks.
This revision now requires review to proceed.Nov 14 2018, 8:22 PM
jhb marked an inline comment as done.Nov 14 2018, 8:22 PM
This revision is now accepted and ready to land.Nov 14 2018, 8:23 PM
This revision was automatically updated to reflect the committed changes.