Skip to contentSkip to conversation

Patch "x86/mm/pat: Add support of non-default PAT MSR setting" has been added to the 4.6-stable tree

PATCH [email protected] 1 participant 1 message Aug 14, 2016

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

x86/mm/pat: Add support of non-default PAT MSR setting

to the 4.6-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
x86-mm-pat-add-support-of-non-default-pat-msr-setting.patch
and it can be found in the queue-4.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 02f037d641dc6672be5cfe7875a48ab99b95b154 Mon Sep 17 00:00:00 2001

From: Toshi Kani <[email protected]>
Date: Wed, 23 Mar 2016 15:41:57 -0600
Subject: x86/mm/pat: Add support of non-default PAT MSR setting

From: Toshi Kani <[email protected]>

commit 02f037d641dc6672be5cfe7875a48ab99b95b154 upstream.

In preparation for fixing a regression caused by:

9cd25aac1f44 ("x86/mm/pat: Emulate PAT when it is disabled")'

... PAT needs to support a case that PAT MSR is initialized with a non-default value.

When pat_init() is called and PAT is disabled, it initializes the PAT table with the BIOS default value. Xen, however, sets PAT MSR with a non-default value to enable WC. This causes inconsistency between the PAT table and PAT MSR when PAT is set to disable on Xen.

Change pat_init() to handle the PAT disable cases properly. Add init_cache_modes() to handle two cases when PAT is set to disable.

1. CPU supports PAT: Set PAT table to be consistent with PAT MSR.
2. CPU does not support PAT: Set PAT table to be consistent with PWT and PCD bits in a PTE.

Note, __init_cache_modes(), renamed from pat_init_cache_modes(), will be changed to a static function in a later patch.

---
 arch/x86/include/asm/pat.h |    2 -
 arch/x86/mm/pat.c          |   73 ++++++++++++++++++++++++++++++++-------------
 arch/x86/xen/enlighten.c   |    2 -
 3 files changed, 55 insertions(+), 22 deletions(-)
arch/x86/include/asm/pat.h +1 -1
@@ -6,7 +6,7 @@
 
 bool pat_enabled(void);
 extern void pat_init(void);
-void pat_init_cache_modes(u64);
+void __init_cache_modes(u64);
 
 extern int reserve_memtype(u64 start, u64 end,
 		enum page_cache_mode req_pcm, enum page_cache_mode *ret_pcm);
arch/x86/mm/pat.c +53 -20

112 lines not on this page · raw message

arch/x86/xen/enlighten.c +1 -1
@@ -1623,7 +1623,7 @@ asmlinkage __visible void __init xen_sta
 	 * configuration.
 	 */
 	rdmsrl(MSR_IA32_CR_PAT, pat);
-	pat_init_cache_modes(pat);
+	__init_cache_modes(pat);
 
 	/* keep using Xen gdt for now; no urgent need to change it */
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.6/x86-mm-pat-replace-cpu_has_pat-with-boot_cpu_has.patch queue-4.6/x86-mtrr-fix-xorg-crashes-in-qemu-sessions.patch queue-4.6/libnvdimm-pfn-dax-fix-initialization-vs-autodetect-for-mode-alignment.patch queue-4.6/x86-mm-pat-add-support-of-non-default-pat-msr-setting.patch queue-4.6/x86-xen-pat-remove-pat-table-init-code-from-xen.patch queue-4.6/x86-mtrr-fix-pat-init-handling-when-mtrr-is-disabled.patch queue-4.6/x86-mm-pat-add-pat_disable-interface.patch queue-4.6/x86-mm-pat-fix-bug_on-in-mmap_mem-on-qemu-i386.patch queue-4.6/x86-pat-document-the-pat-initialization-sequence.patch