All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/10] x86: make pat and mtrr independent from each other
@ 2022-09-08  8:49 Juergen Gross
  2022-09-08  8:49 ` [PATCH v3 01/10] x86/mtrr: add comment for set_mtrr_state() serialization Juergen Gross
                   ` (9 more replies)
  0 siblings, 10 replies; 41+ messages in thread
From: Juergen Gross @ 2022-09-08  8:49 UTC (permalink / raw)
  To: xen-devel, x86, linux-kernel, 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

While working on that I discovered two minor bugs in MTRR code, which
are fixed, too.

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 (10):
  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: move some code out of arch/x86/kernel/cpu/mtrr
  x86/mtrr: split generic_set_all()
  x86/mtrr: remove set_all callback from struct mtrr_ops
  x86/mtrr: simplify mtrr_bp_init()
  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

 arch/x86/include/asm/cacheinfo.h   |  14 +++
 arch/x86/include/asm/memtype.h     |   5 +-
 arch/x86/include/asm/mtrr.h        |  12 +--
 arch/x86/kernel/cpu/cacheinfo.c    | 159 +++++++++++++++++++++++++++++
 arch/x86/kernel/cpu/common.c       |   3 +-
 arch/x86/kernel/cpu/mtrr/cyrix.c   |  34 ------
 arch/x86/kernel/cpu/mtrr/generic.c | 107 ++-----------------
 arch/x86/kernel/cpu/mtrr/mtrr.c    | 158 +++++-----------------------
 arch/x86/kernel/cpu/mtrr/mtrr.h    |   5 -
 arch/x86/kernel/setup.c            |  14 +--
 arch/x86/kernel/smpboot.c          |   9 +-
 arch/x86/mm/pat/memtype.c          | 127 +++++++----------------
 arch/x86/power/cpu.c               |   3 +-
 13 files changed, 265 insertions(+), 385 deletions(-)

-- 
2.35.3


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

end of thread, other threads:[~2022-09-30 13:26 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-08  8:49 [PATCH v3 00/10] x86: make pat and mtrr independent from each other Juergen Gross
2022-09-08  8:49 ` [PATCH v3 01/10] x86/mtrr: add comment for set_mtrr_state() serialization Juergen Gross
2022-09-08  8:49 ` [PATCH v3 02/10] x86/mtrr: remove unused cyrix_set_all() function Juergen Gross
2022-09-08  8:49 ` [PATCH v3 03/10] x86/mtrr: replace use_intel() with a local flag Juergen Gross
2022-09-11 10:16   ` Borislav Petkov
2022-09-12  9:10     ` Juergen Gross
2022-09-19 19:10       ` Borislav Petkov
2022-09-28 10:17       ` Juergen Gross
2022-09-08  8:49 ` [PATCH v3 04/10] x86: move some code out of arch/x86/kernel/cpu/mtrr Juergen Gross
2022-09-11 11:02   ` Borislav Petkov
2022-09-12  9:11     ` Juergen Gross
2022-09-08  8:49 ` [PATCH v3 05/10] x86/mtrr: split generic_set_all() Juergen Gross
2022-09-19 19:25   ` Borislav Petkov
2022-09-08  8:49 ` [PATCH v3 06/10] x86/mtrr: remove set_all callback from struct mtrr_ops Juergen Gross
2022-09-08  8:49 ` [PATCH v3 07/10] x86/mtrr: simplify mtrr_bp_init() Juergen Gross
2022-09-26 18:40   ` Borislav Petkov
2022-09-08  8:49 ` [PATCH v3 08/10] x86/mtrr: let cache_aps_delayed_init replace mtrr_aps_delayed_init Juergen Gross
2022-09-26 21:11   ` Borislav Petkov
2022-09-27  8:57     ` Juergen Gross
2022-09-27 10:10       ` Borislav Petkov
2022-09-27 10:14         ` Juergen Gross
2022-09-27 11:19           ` Borislav Petkov
2022-09-27 11:25             ` Juergen Gross
2022-09-27 12:13               ` Borislav Petkov
2022-09-27 12:21                 ` Juergen Gross
2022-09-27 23:16                   ` Borislav Petkov
2022-09-28  5:30                     ` Juergen Gross
2022-09-28  6:16                       ` Juergen Gross
2022-09-28 10:48                         ` Borislav Petkov
2022-09-28 11:14                           ` Juergen Gross
2022-09-28 11:22                             ` Borislav Petkov
2022-09-28 13:43                               ` Juergen Gross
2022-09-28 16:12                                 ` Borislav Petkov
2022-09-28 16:32                                   ` Juergen Gross
2022-09-28 16:39                                     ` Borislav Petkov
2022-09-29  8:26                                     ` Juergen Gross
2022-09-30 11:55                                       ` Borislav Petkov
2022-09-30 13:11                                         ` Juergen Gross
2022-09-30 13:25                                           ` Borislav Petkov
2022-09-08  8:49 ` [PATCH v3 09/10] x86/mtrr: add a stop_machine() handler calling only cache_cpu_init() Juergen Gross
2022-09-08  8:49 ` [PATCH v3 10/10] x86: decouple pat and mtrr handling 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.