Page MenuHomeFreeBSD

msi: report error for attempt to use CPU > 255
ClosedPublic

Authored by emaste on Aug 9 2023, 4:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 4 2024, 3:34 AM
Unknown Object (File)
Sep 25 2024, 10:59 PM
Unknown Object (File)
Sep 25 2024, 8:50 PM
Unknown Object (File)
Sep 25 2024, 1:32 PM
Unknown Object (File)
Sep 25 2024, 6:35 AM
Unknown Object (File)
Sep 24 2024, 11:19 PM
Unknown Object (File)
Sep 17 2024, 8:44 PM
Unknown Object (File)
Sep 17 2024, 1:31 AM
Subscribers

Details

Summary

The MSI/MSI-X address includes 8 bits to encode the Destination ID (CPU/APIC ID). Previously IDs over 255 overlapped with the fixed portion of the address, resulting in an invalid value. Instead, print an error message and return EINVAL.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

emaste requested review of this revision.Aug 9 2023, 4:41 PM
emaste created this revision.

My hope here is to provide a bread-crumb if anyone tries running on systems with high CPU counts. Ideally I think this would become a KASSERT, with higher levels either relying on IOMMU or not assigning to CPUs > 255.

I suggested something like this on IRC yesterday, yes. I think it's fine to just fail here rather than panicking as it is a bit nicer to the user.

sys/x86/x86/msi.c
634
This revision is now accepted and ready to land.Aug 9 2023, 5:30 PM
sys/x86/x86/msi.c
634

I was a bit surprised that it was msi_cpu, is this historical leftovers? (I.e., would we use msi_apic_id if writing this anew?)