All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 00/16] x86: make PAT and MTRR independent from each other
@ 2022-11-02  7:46 Juergen Gross
  2022-11-02  7:46 ` [PATCH v5 01/16] x86/mtrr: add comment for set_mtrr_state() serialization Juergen Gross
                   ` (16 more replies)
  0 siblings, 17 replies; 46+ messages in thread
From: Juergen Gross @ 2022-11-02  7:46 UTC (permalink / raw)
  To: linux-kernel, x86, linux-pm
  Cc: Juergen Gross, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Rafael J. Wysocki, Pavel Machek,
	Andy Lutomirski, Peter Zijlstra

Today PAT can't be used without MTRR being available, unless MTRR is at
least configured via CONFIG_MTRR and the system is running as Xen PV
guest. In this case PAT is automatically available via the hypervisor,
but the PAT MSR can't be modified by the kernel and MTRR is disabled.

The same applies to a kernel built with no MTRR support: it won't
allow to use the PAT MSR, even if there is no technical reason for
that, other than setting up PAT on all CPUs the same way (which is a
requirement of the processor's cache management) is relying on some
MTRR specific code.

Fix all of that by:

- moving the function needed by PAT from MTRR specific code one level
  up
- reworking the init sequences of MTRR and PAT to be more similar to
  each other without calling PAT from MTRR code
- removing the dependency of PAT on MTRR

There is some more cleanup done reducing code size.

Note that patches 1+2 have already been applied to tip.git x86/cpu.
They are included in this series only for reference.

Changes in V5:
- addressed comments

Changes in V4:
- new patches 10, 14, 15, 16
- split up old patch 4 into 3 patches
- addressed comments

Changes in V3:
- replace patch 1 by just adding a comment

Changes in V2:
- complete rework of the patches based on comments by Boris Petkov
- added several patches to the series

Juergen Gross (16):
  x86/mtrr: add comment for set_mtrr_state() serialization
  x86/mtrr: remove unused cyrix_set_all() function
  x86/mtrr: replace use_intel() with a local flag
  x86/mtrr: rename prepare_set() and post_set()
  x86/mtrr: split MTRR specific handling from cache dis/enabling
  x86: move some code out of arch/x86/kernel/cpu/mtrr
  x86/mtrr: Disentangle MTRR init from PAT init.
  x86/mtrr: remove set_all callback from struct mtrr_ops
  x86/mtrr: simplify mtrr_bp_init()
  x86/mtrr: get rid of __mtrr_enabled bool
  x86/mtrr: let cache_aps_delayed_init replace mtrr_aps_delayed_init
  x86/mtrr: add a stop_machine() handler calling only cache_cpu_init()
  x86: decouple PAT and MTRR handling
  x86: switch cache_ap_init() to hotplug callback
  x86: do MTRR/PAT setup on all secondary CPUs in parallel
  x86/mtrr: simplify mtrr_ops initialization

 arch/x86/include/asm/cacheinfo.h   |  19 ++++
 arch/x86/include/asm/memtype.h     |   5 +-
 arch/x86/include/asm/mtrr.h        |  17 +--
 arch/x86/kernel/cpu/cacheinfo.c    | 173 +++++++++++++++++++++++++++++
 arch/x86/kernel/cpu/common.c       |   2 +-
 arch/x86/kernel/cpu/mtrr/amd.c     |   8 +-
 arch/x86/kernel/cpu/mtrr/centaur.c |   8 +-
 arch/x86/kernel/cpu/mtrr/cyrix.c   |  42 +------
 arch/x86/kernel/cpu/mtrr/generic.c | 127 ++++-----------------
 arch/x86/kernel/cpu/mtrr/mtrr.c    | 171 ++++------------------------
 arch/x86/kernel/cpu/mtrr/mtrr.h    |  15 +--
 arch/x86/kernel/setup.c            |  14 +--
 arch/x86/kernel/smpboot.c          |   9 +-
 arch/x86/mm/pat/memtype.c          | 152 +++++++++----------------
 arch/x86/power/cpu.c               |   3 +-
 include/linux/cpuhotplug.h         |   1 +
 16 files changed, 308 insertions(+), 458 deletions(-)

-- 
2.35.3


^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2022-12-05 12:21 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-02  7:46 [PATCH v5 00/16] x86: make PAT and MTRR independent from each other Juergen Gross
2022-11-02  7:46 ` [PATCH v5 01/16] x86/mtrr: add comment for set_mtrr_state() serialization Juergen Gross
2022-11-02  7:46 ` [PATCH v5 02/16] x86/mtrr: remove unused cyrix_set_all() function Juergen Gross
2022-11-02  7:47 ` [PATCH v5 03/16] x86/mtrr: replace use_intel() with a local flag Juergen Gross
2022-11-10 12:21   ` [tip: x86/cpu] x86/mtrr: Replace " tip-bot2 for Juergen Gross
2022-11-02  7:47 ` [PATCH v5 04/16] x86/mtrr: rename prepare_set() and post_set() Juergen Gross
2022-11-10 12:21   ` [tip: x86/cpu] x86/mtrr: Rename " tip-bot2 for Juergen Gross
2022-11-02  7:47 ` [PATCH v5 05/16] x86/mtrr: split MTRR specific handling from cache dis/enabling Juergen Gross
2022-11-10 12:21   ` [tip: x86/cpu] x86/mtrr: Split MTRR-specific " tip-bot2 for Juergen Gross
2022-11-02  7:47 ` [PATCH v5 06/16] x86: move some code out of arch/x86/kernel/cpu/mtrr Juergen Gross
2022-11-10 12:21   ` [tip: x86/cpu] x86/mtrr: Move cache control code to cacheinfo.c tip-bot2 for Juergen Gross
2022-11-02  7:47 ` [PATCH v5 07/16] x86/mtrr: Disentangle MTRR init from PAT init Juergen Gross
2022-11-10 12:21   ` [tip: x86/cpu] " tip-bot2 for Juergen Gross
2022-11-02  7:47 ` [PATCH v5 08/16] x86/mtrr: remove set_all callback from struct mtrr_ops Juergen Gross
2022-11-10 12:21   ` [tip: x86/cpu] x86/mtrr: Remove " tip-bot2 for Juergen Gross
2022-11-02  7:47 ` [PATCH v5 09/16] x86/mtrr: simplify mtrr_bp_init() Juergen Gross
2022-11-10 12:21   ` [tip: x86/cpu] x86/mtrr: Simplify mtrr_bp_init() tip-bot2 for Juergen Gross
2022-11-02  7:47 ` [PATCH v5 10/16] x86/mtrr: get rid of __mtrr_enabled bool Juergen Gross
2022-11-10 12:21   ` [tip: x86/cpu] x86/mtrr: Get " tip-bot2 for Juergen Gross
2022-11-02  7:47 ` [PATCH v5 11/16] x86/mtrr: let cache_aps_delayed_init replace mtrr_aps_delayed_init Juergen Gross
2022-11-10 12:21   ` [tip: x86/cpu] x86/mtrr: Let " tip-bot2 for Juergen Gross
2022-11-02  7:47 ` [PATCH v5 12/16] x86/mtrr: add a stop_machine() handler calling only cache_cpu_init() Juergen Gross
2022-11-10 12:21   ` [tip: x86/cpu] x86/mtrr: Add " tip-bot2 for Juergen Gross
2022-11-02  7:47 ` [PATCH v5 13/16] x86: decouple PAT and MTRR handling Juergen Gross
2022-11-10 12:21   ` [tip: x86/cpu] x86: Decouple " tip-bot2 for Juergen Gross
2022-12-01 16:26   ` [PATCH v5 13/16] x86: decouple " Kirill A. Shutemov
2022-12-01 16:33     ` Juergen Gross
2022-12-01 23:57       ` Kirill A. Shutemov
2022-12-02  5:56         ` Juergen Gross
2022-12-02 13:27           ` Kirill A. Shutemov
2022-12-02 13:39             ` Juergen Gross
2022-12-02 14:33               ` Kirill A. Shutemov
2022-12-02 14:56                 ` Juergen Gross
2022-12-05  7:40                   ` Juergen Gross
2022-12-05 12:21                     ` Kirill A. Shutemov
2022-12-02 13:55           ` Borislav Petkov
2022-11-02  7:47 ` [PATCH v5 14/16] x86: switch cache_ap_init() to hotplug callback Juergen Gross
2022-11-10 12:21   ` [tip: x86/cpu] x86/cacheinfo: Switch " tip-bot2 for Juergen Gross
2022-11-02  7:47 ` [PATCH v5 15/16] x86: do MTRR/PAT setup on all secondary CPUs in parallel Juergen Gross
2022-11-02  7:47 ` [PATCH v5 16/16] x86/mtrr: simplify mtrr_ops initialization Juergen Gross
2022-11-10 12:21   ` [tip: x86/cpu] x86/mtrr: Simplify " tip-bot2 for Juergen Gross
2022-11-02 18:04 ` [PATCH v5 00/16] x86: make PAT and MTRR independent from each other Borislav Petkov
2022-11-03  8:40   ` Juergen Gross
2022-11-03 16:15     ` Borislav Petkov
2022-11-07 19:25       ` Borislav Petkov
2022-11-08  7:30         ` Juergen Gross

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.