Page MenuHomeFreeBSD

Move shared variables to the shared identcpu.c.
ClosedPublic

Authored by jhb on Dec 21 2015, 8:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Sep 29, 11:30 PM
Unknown Object (File)
Sun, Sep 29, 11:30 PM
Unknown Object (File)
Sun, Sep 29, 11:29 PM
Unknown Object (File)
Sun, Sep 29, 11:29 PM
Unknown Object (File)
Sun, Sep 29, 11:28 PM
Unknown Object (File)
Sep 12 2024, 2:45 AM
Unknown Object (File)
Sep 8 2024, 8:59 PM
Unknown Object (File)
Aug 19 2024, 5:19 PM
Subscribers

Details

Summary

Move shared variables from {amd64,i386}/initcpu.c to x86/identcpu.c.
While here, move the common bits of <machine/cputypes.h> to
<x86/cputypes.h> as well.

Test Plan
  • Build and boot in VMs.

Diff Detail

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

Event Timeline

jhb retitled this revision from to Move shared variables to the shared identcpu.c..
jhb updated this object.
jhb edited the test plan for this revision. (Show Details)
jhb added a reviewer: kib.

I still need to test this, but putting it in arc adds it to my TODO list so I won't forget.

sys/x86/include/cputypes.h
47 ↗(On Diff #11534)

This is cemetery. If keeping the shaft around, why not completely merge amd64 and i386 content into x86 cputypes.h ? I think that the only useful part is CPU_VENDOR_INTEL and CPU_VENDOR_AMD defines, everything else is really unused in the code, or is used in the code which we cannot and never will be able to test.

sys/x86/x86/identcpu.c
124 ↗(On Diff #11534)

Bruce prefers a formatting for SYSCTLs where the first line if filled to the 72 column, and where the description string always starts with a new line.

sys/x86/include/cputypes.h
47 ↗(On Diff #11534)

If I merged them I would just have #ifdef i386 blocks around the CPU_* and CPUCLASS_* bits. I actually wonder if we can axe cpu_class on amd64 entirely. The one usage in linprocfs.c is bogus (and mostly unused, even for i386).

Looking at the code, I think I can axe cpu_class from amd64 completely and it will simplify some things. The 'cpu' variable might also be prunable. In that case the amd64 cputypes.h would only include the x86 one, but the i386 one would stay as-is. If you want I can work on axeing cpu_class and cpu from amd64 first and then come back to this.

sys/x86/x86/identcpu.c
124 ↗(On Diff #11534)

This was just copied over from initcpu.c where it is formatted like this.

sys/x86/include/cputypes.h
47 ↗(On Diff #11534)

There is no harm of having e.g. CPU_VENDOR_UMC on amd64, it is useless but innocent.

I do not propose to start a detour with axing cpu and cpu_class, please commit this.

sys/x86/x86/identcpu.c
124 ↗(On Diff #11534)

I understand.

But since the lines are moved around anyway and would pop up in 'vcs blame' attributed to this commit, why not change style in one go ?

sys/x86/include/cputypes.h
47 ↗(On Diff #11534)

Oh, I just saw that I forgot to save the amd64 cputypes.h so it is missing the #include of the x86 file. I'll upload that in a second. The intention is to have all the CPU_VENDOR types shared, yes.

  • Forgot to add this include.
  • Style change for moved sysctls.
kib edited edge metadata.
This revision is now accepted and ready to land.Dec 22 2015, 8:42 PM
This revision was automatically updated to reflect the committed changes.