git: c8077ccd70cf - main - acpi_cpu: Make device unit numbers match OS CPU IDs.

Alexander Motin mav at FreeBSD.org
Sat Sep 25 17:20:21 UTC 2021


On 25.09.2021 12:30, John Baldwin wrote:
> On 9/24/21 6:24 PM, Alexander Motin wrote:
>> The branch main has been updated by mav:
>>
>> URL:
>> https://cgit.FreeBSD.org/src/commit/?id=c8077ccd70cfcbcccb752e89b848f098abcb9309
>>
>>
>> commit c8077ccd70cfcbcccb752e89b848f098abcb9309
>> Author:     Alexander Motin <mav at FreeBSD.org>
>> AuthorDate: 2021-09-25 01:03:02 +0000
>> Commit:     Alexander Motin <mav at FreeBSD.org>
>> CommitDate: 2021-09-25 01:24:19 +0000
>>
>>      acpi_cpu: Make device unit numbers match OS CPU IDs.
>>           There are already APIC ID, ACPI ID and OS ID for each CPU. 
>> In perfect
>>      world all of those may match, but at least for SuperMicro server
>> boards
>>      none of them do.  Plus none of them match the CPU devices listing
>> order
>>      by ACPI.  Previous code used the ACPI device listing order to number
>>      cpuX devices.  It looked nice from NewBus perspective, but
>> introduced
>>      4th different set of IDs. Extremely confusing one, since in some
>> places
>>      the device unit numbers were treated as OS CPU IDs (coretemp),
>> but not
>>      in others (sysctl dev.cpu.X.%location).
> 
> FWIW, the "normal" way to force specific device unit numbers is via
> bus_hint_device_unit, but perhaps that is specific to when hints
> exits whereas this is specific to a bus property.  Perhaps though this
> can't have the unit number assigned by the bus at the BUS_ADD_CHILD
> call?  That would be the other way to handle this perhaps vs trying to
> change the unit in the probe routine.

Doing it in any of proposed ways would require bus to know about the
device specifics much more than it should.  I've found it better done
this way.  Setting device unit number by the driver during the probe is
not much worse than setting description, and definitely much better than
during attach as done by xen/blkfront, which should probably be changed
to probe way too.

-- 
Alexander Motin


More information about the dev-commits-src-main mailing list