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)
Wed, May 22, 8:47 AM
Unknown Object (File)
Wed, May 22, 7:58 AM
Unknown Object (File)
Jan 5 2024, 10:30 PM
Unknown Object (File)
Jan 5 2024, 4:56 AM
Unknown Object (File)
Dec 25 2023, 5:17 PM
Unknown Object (File)
Dec 20 2023, 8:25 AM
Unknown Object (File)
Dec 12 2023, 4:41 PM
Unknown Object (File)
Nov 30 2023, 1:39 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

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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
624
This revision is now accepted and ready to land.Aug 9 2023, 5:30 PM
sys/x86/x86/msi.c
624

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?)