mbox series

[v2,00/17] Prepare for new Intel Family numbers

Message ID 20250211194407.2577252-1-sohil.mehta@intel.com
Headers show
Series Prepare for new Intel Family numbers | expand

Message

Sohil Mehta Feb. 11, 2025, 7:43 p.m. UTC
---Summary---
Mainstream Intel processors have been using Family 6 for a couple of decades.
Audit all the Intel Family-model checks to get ready for the upcoming Family 18
and 19 models.

Patch 1: Preparatory cleanup in smpboot.
Patch 2-7: Fixes in arch/x86 and drivers.
Patch 8-17: Cleanups in arch/x86 to convert x86_model checks to VFM ones.

This series does not include cleanups in drivers/.

Please feel free to pick up whichever patches seem ready. Most of the patches
can be applied out of order except patches 1 and 2 which should be applied
together.

---v2 changes---

* Improve commit messages.
* Split and reorder patches for better readability.
* Added a cleanup patch in the beginning.

RFC-v1: https://lore.kernel.org/lkml/20241220213711.1892696-1-sohil.mehta@intel.com/

---Background---
The last mainstream Intel processors that deviated from Family 6 were the
Netburst architecture based Pentium 4s that had a Family number of 15. Intel
has recently started to introduce extended Family numbers greater than 15, as
seen in commit d1fb034b75a8 ("x86/cpu: Add two Intel CPU model numbers").
Though newer CPUs can have any Family number, the currently planned CPUs lie in
Families 18 and 19.

Some kernel code assumes that the Family number would always remain 6.  There
are checks that apply to recent Family 6 models such as Lunar Lake and
Clearwater Forest but don't automatically extend to Family 19 models such as
Diamond Rapids. This series aims to fix and cleanup all of such Intel specific
checks (mainly in arch/x86) to avoid such issues in the future. It also
converts almost all of the x86_model checks in arch/x86 to the new VFM ones.

OTOH, x86_model usage in drivers/ is a huge mess. Some drivers might need to be
completely rewritten to make them future-proof. I have attempted a couple of
fixes in cpufreq and hwmon, but they are mostly superficial.  A more thorough
clean up of drivers is needed to replace all x86_model usage with the new VFM
checks.

---Assumptions and Trade-offs---
Newer CPUs will have model numbers only in Family 6 or after Family 15.  No new
processors would be added between Family 6 and 15.

As a convention, Intel Family numbers are referenced using decimals (Family 15,
19, etc.) even though the AMD-specific code might prefer hexadecimals in
similar situations.

It would be preferable to have simpler and more maintainable checks that might
in a rare situation change the behavior on really old platforms. If someone
pops up with an issue, the code would be fixed later.
For example, the check,
	c->x86_vfm >= INTEL_PENTIUM_PRO
is preferred over,
	c->x86 == 6 || c->x86 > 15
if the likelihood of adversely affecting Family 15 is low.

Also, the CPU defines in intel-family.h have been added as and when needed to
make reviewing and applying patches out of order easier.

Sohil Mehta (17):
  x86/smpboot: Remove confusing quirk usage in INIT delay
  x86/smpboot: Fix INIT delay optimization for extended Intel Families
  x86/apic: Fix 32-bit APIC initialization for extended Intel Families
  x86/cpu/intel: Fix the movsl alignment preference for extended
    Families
  x86/cpu/intel: Fix page copy performance for extended Families
  cpufreq: Fix the efficient idle check for Intel extended Families
  hwmon: Fix Intel Family-model checks to include extended Families
  x86/microcode: Update the Intel processor flag scan check
  x86/mtrr: Modify a x86_model check to an Intel VFM check
  x86/cpu/intel: Replace early Family 6 checks with VFM ones
  x86/cpu/intel: Replace Family 15 checks with VFM ones
  x86/cpu/intel: Replace Family 5 model checks with VFM ones
  x86/pat: Replace Intel x86_model checks with VFM ones
  x86/acpi/cstate: Improve Intel Family model checks
  x86/cpu/intel: Bound the non-architectural constant_tsc model checks
  perf/x86: Simplify P6 PMU initialization
  perf/x86/p4: Replace Pentium 4 model checks with VFM ones

 arch/x86/events/intel/p4.c            |  7 +--
 arch/x86/events/intel/p6.c            | 28 +++--------
 arch/x86/include/asm/intel-family.h   | 21 ++++++++-
 arch/x86/kernel/acpi/cstate.c         |  8 ++--
 arch/x86/kernel/apic/apic.c           |  4 +-
 arch/x86/kernel/cpu/intel.c           | 68 +++++++++++++--------------
 arch/x86/kernel/cpu/microcode/intel.c |  2 +-
 arch/x86/kernel/cpu/mtrr/generic.c    |  4 +-
 arch/x86/kernel/smpboot.c             | 17 ++++---
 arch/x86/mm/pat/memtype.c             |  7 +--
 drivers/cpufreq/cpufreq_ondemand.c    | 15 +++---
 drivers/hwmon/coretemp.c              | 26 ++++++----
 12 files changed, 111 insertions(+), 96 deletions(-)