Skip to contentSkip to conversation

x86: adjust default caching mode translation tables

PATCH In review Jan Beulich 3 participants 11 messages Jul 20, 2015 – Jul 26, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: adjust default caching mode translation tables

Make WT really mean WT (rather than UC).

I can't see why commit 9cd25aac1f ("x86/mm/pat: Emulate PAT when it is disabled") didn't make this match its changes to pat_init().

Cc Borislav Petkov <[email protected]>
Cc Toshi Kani <[email protected]>
---
 arch/x86/mm/init.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/mm/init.c +3 -3
@@ -43,18 +43,18 @@ uint16_t __cachemode2pte_tbl[_PAGE_CACHE
 	[_PAGE_CACHE_MODE_WC      ]	= 0         | _PAGE_PCD,
 	[_PAGE_CACHE_MODE_UC_MINUS]	= 0         | _PAGE_PCD,
 	[_PAGE_CACHE_MODE_UC      ]	= _PAGE_PWT | _PAGE_PCD,
-	[_PAGE_CACHE_MODE_WT      ]	= 0         | _PAGE_PCD,
+	[_PAGE_CACHE_MODE_WT      ]	= _PAGE_PWT | 0,
 	[_PAGE_CACHE_MODE_WP      ]	= 0         | _PAGE_PCD,
 };
 EXPORT_SYMBOL(__cachemode2pte_tbl);
 
 uint8_t __pte2cachemode_tbl[8] = {
 	[__pte2cm_idx( 0        | 0         | 0        )] = _PAGE_CACHE_MODE_WB,
-	[__pte2cm_idx(_PAGE_PWT | 0         | 0        )] = _PAGE_CACHE_MODE_UC_MINUS,
+	[__pte2cm_idx(_PAGE_PWT | 0         | 0        )] = _PAGE_CACHE_MODE_WT,
 	[__pte2cm_idx( 0        | _PAGE_PCD | 0        )] = _PAGE_CACHE_MODE_UC_MINUS,
 	[__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | 0        )] = _PAGE_CACHE_MODE_UC,
 	[__pte2cm_idx( 0        | 0         | _PAGE_PAT)] = _PAGE_CACHE_MODE_WB,
-	[__pte2cm_idx(_PAGE_PWT | 0         | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC_MINUS,
+	[__pte2cm_idx(_PAGE_PWT | 0         | _PAGE_PAT)] = _PAGE_CACHE_MODE_WT,
 	[__pte2cm_idx(0         | _PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC_MINUS,
 	[__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC,
 };
#1 lore raw

[tip:x86/urgent] x86/mm/pat: Adjust default caching mode translation tables

x86/mm/pat: Adjust default caching mode translation tables
Commit-ID:  ca1fec58bc6a90be96a59b4769e951156846c6ca
Gitweb:     http://git.kernel.org/tip/ca1fec58bc6a90be96a59b4769e951156846c6ca
Author:     Jan Beulich <[email protected]>
AuthorDate: Mon, 20 Jul 2015 08:46:14 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 21 Jul 2015 08:23:06 +0200

x86/mm/pat: Adjust default caching mode translation tables

Make WT really mean WT (rather than UC).

I can't see why commit 9cd25aac1f ("x86/mm/pat: Emulate PAT when it is disabled") didn't make this to match its changes to pat_init().

Cc Andy Lutomirski <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Toshi Kani <[email protected]>
---
 arch/x86/mm/init.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/mm/init.c +3 -3
index 8533b46..7a45322 100644
@@ -43,18 +43,18 @@ uint16_t __cachemode2pte_tbl[_PAGE_CACHE_MODE_NUM] = {
 	[_PAGE_CACHE_MODE_WC      ]	= 0         | _PAGE_PCD,
 	[_PAGE_CACHE_MODE_UC_MINUS]	= 0         | _PAGE_PCD,
 	[_PAGE_CACHE_MODE_UC      ]	= _PAGE_PWT | _PAGE_PCD,
-	[_PAGE_CACHE_MODE_WT      ]	= 0         | _PAGE_PCD,
+	[_PAGE_CACHE_MODE_WT      ]	= _PAGE_PWT | 0,
 	[_PAGE_CACHE_MODE_WP      ]	= 0         | _PAGE_PCD,
 };
 EXPORT_SYMBOL(__cachemode2pte_tbl);
 
 uint8_t __pte2cachemode_tbl[8] = {
 	[__pte2cm_idx( 0        | 0         | 0        )] = _PAGE_CACHE_MODE_WB,
-	[__pte2cm_idx(_PAGE_PWT | 0         | 0        )] = _PAGE_CACHE_MODE_UC_MINUS,
+	[__pte2cm_idx(_PAGE_PWT | 0         | 0        )] = _PAGE_CACHE_MODE_WT,
 	[__pte2cm_idx( 0        | _PAGE_PCD | 0        )] = _PAGE_CACHE_MODE_UC_MINUS,
 	[__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | 0        )] = _PAGE_CACHE_MODE_UC,
 	[__pte2cm_idx( 0        | 0         | _PAGE_PAT)] = _PAGE_CACHE_MODE_WB,
-	[__pte2cm_idx(_PAGE_PWT | 0         | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC_MINUS,
+	[__pte2cm_idx(_PAGE_PWT | 0         | _PAGE_PAT)] = _PAGE_CACHE_MODE_WT,
 	[__pte2cm_idx(0         | _PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC_MINUS,
 	[__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC,
 };
#2 lore raw

Re: [tip:x86/urgent] x86/mm/pat: Adjust default caching mode translation tables

Ingo,

Please drop this change as I explained below.
http://marc.info/?l=linux-kernel&m=143751782107284&w=2

Thanks,
-Toshi

Quoted 67 lines · tip-bot for Jan Beulich

Commit-ID: ca1fec58bc6a90be96a59b4769e951156846c6ca Gitweb:
http://git.kernel.org/tip/ca1fec58bc6a90be96a59b4769e951156846c6ca

Author:     Jan Beulich <[email protected]>
AuthorDate: Mon, 20 Jul 2015 08:46:14 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 21 Jul 2015 08:23:06 +0200

x86/mm/pat: Adjust default caching mode translation tables

Make WT really mean WT (rather than UC).

I can't see why commit 9cd25aac1f ("x86/mm/pat: Emulate PAT when it is disabled") didn't make this to match its changes to pat_init().

Cc Andy Lutomirski <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Toshi Kani <[email protected]>

Link:
http://lkml.kernel.org/r/[email protected]

---
 arch/x86/mm/init.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/mm/init.c +2 -2
index 8533b46..7a45322 100644
@@ -43,18 +43,18 @@ uint16_t __cachemode2pte_tbl[_PAGE_CACHE_MODE_NUM] = 
 {
 	[_PAGE_CACHE_MODE_WC      ]	= 0         | _PAGE_PCD,
 	[_PAGE_CACHE_MODE_UC_MINUS]	= 0         | _PAGE_PCD,
 	[_PAGE_CACHE_MODE_UC      ]	= _PAGE_PWT | _PAGE_PCD,
-	[_PAGE_CACHE_MODE_WT      ]	= 0         | _PAGE_PCD,
+	[_PAGE_CACHE_MODE_WT      ]	= _PAGE_PWT | 0,
 	[_PAGE_CACHE_MODE_WP      ]	= 0         | _PAGE_PCD,
 };
 EXPORT_SYMBOL(__cachemode2pte_tbl);
 
 uint8_t __pte2cachemode_tbl[8] = {
 	[__pte2cm_idx( 0        | 0         | 0        )] = 
 _PAGE_CACHE_MODE_WB,
-	[__pte2cm_idx(_PAGE_PWT | 0         | 0        )] = 
 _PAGE_CACHE_MODE_UC_MINUS,
+	[__pte2cm_idx(_PAGE_PWT | 0         | 0        )] = 
 _PAGE_CACHE_MODE_WT,
 	[__pte2cm_idx( 0        | _PAGE_PCD | 0        )] = 
 _PAGE_CACHE_MODE_UC_MINUS,
 	[__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | 0        )] = 

_PAGE_CACHE_MODE_UC,
[__pte2cm_idx( 0 | 0 | _PAGE_PAT)] =
_PAGE_CACHE_MODE_WB,

arch/x86/mm/init.c +0 -1
-	[__pte2cm_idx(_PAGE_PWT | 0         | _PAGE_PAT)] = 

_PAGE_CACHE_MODE_UC_MINUS,

arch/x86/mm/init.c +1 -0
+	[__pte2cm_idx(_PAGE_PWT | 0         | _PAGE_PAT)] = 

_PAGE_CACHE_MODE_WT,
[__pte2cm_idx(0 | _PAGE_PCD | _PAGE_PAT)] =
_PAGE_CACHE_MODE_UC_MINUS,
[__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)] =
_PAGE_CACHE_MODE_UC,
};

#3 lore raw

[tip:x86/urgent] x86/mm/pat: Revert ' Adjust default caching mode translation tables'

x86/mm/pat: Revert 'Adjust default caching mode translation tables'
Commit-ID:  1a4e8795711f474b31ff6eac37f3efd304ed8a93
Gitweb:     http://git.kernel.org/tip/1a4e8795711f474b31ff6eac37f3efd304ed8a93
Author:     Thomas Gleixner <[email protected]>
AuthorDate: Sun, 26 Jul 2015 10:27:37 +0200
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Sun, 26 Jul 2015 10:27:37 +0200

x86/mm/pat: Revert 'Adjust default caching mode translation tables'

Toshi explains:

"No, the default values need to be set to the fallback types,
i.e. minimal supported mode. For WC and WT, UC is the fallback type.

When PAT is disabled, pat_init() does update the tables below to enable WT per the default BIOS setup. However, when PAT is enabled, but CPU has PAT -errata, WT falls back to UC per the default values."

Revert: ca1fec58bc6a 'x86/mm/pat: Adjust default caching mode translation tables'

---
 arch/x86/mm/init.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/mm/init.c +3 -3
index 7a45322..8533b46 100644
@@ -43,18 +43,18 @@ uint16_t __cachemode2pte_tbl[_PAGE_CACHE_MODE_NUM] = {
 	[_PAGE_CACHE_MODE_WC      ]	= 0         | _PAGE_PCD,
 	[_PAGE_CACHE_MODE_UC_MINUS]	= 0         | _PAGE_PCD,
 	[_PAGE_CACHE_MODE_UC      ]	= _PAGE_PWT | _PAGE_PCD,
-	[_PAGE_CACHE_MODE_WT      ]	= _PAGE_PWT | 0,
+	[_PAGE_CACHE_MODE_WT      ]	= 0         | _PAGE_PCD,
 	[_PAGE_CACHE_MODE_WP      ]	= 0         | _PAGE_PCD,
 };
 EXPORT_SYMBOL(__cachemode2pte_tbl);
 
 uint8_t __pte2cachemode_tbl[8] = {
 	[__pte2cm_idx( 0        | 0         | 0        )] = _PAGE_CACHE_MODE_WB,
-	[__pte2cm_idx(_PAGE_PWT | 0         | 0        )] = _PAGE_CACHE_MODE_WT,
+	[__pte2cm_idx(_PAGE_PWT | 0         | 0        )] = _PAGE_CACHE_MODE_UC_MINUS,
 	[__pte2cm_idx( 0        | _PAGE_PCD | 0        )] = _PAGE_CACHE_MODE_UC_MINUS,
 	[__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | 0        )] = _PAGE_CACHE_MODE_UC,
 	[__pte2cm_idx( 0        | 0         | _PAGE_PAT)] = _PAGE_CACHE_MODE_WB,
-	[__pte2cm_idx(_PAGE_PWT | 0         | _PAGE_PAT)] = _PAGE_CACHE_MODE_WT,
+	[__pte2cm_idx(_PAGE_PWT | 0         | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC_MINUS,
 	[__pte2cm_idx(0         | _PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC_MINUS,
 	[__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC,
 };
#4 lore raw
In reply to Jan Beulich
Quoted 4 lines · Jan Beulich

Make WT really mean WT (rather than UC).

I can't see why commit 9cd25aac1f ("x86/mm/pat: Emulate PAT when it is disabled") didn't make this match its changes to pat_init().

No, the default values need to be set to the fallback types, i.e. minimal supported mode. For WC and WT, UC is the fallback type.

When PAT is disabled, pat_init() does update the tables below to enable WT per the default BIOS setup. However, when PAT is enabled, but CPU has PAT -errata, WT falls back to UC per the default values.

Thanks,
-Toshi

Quoted 45 lines
Cc Borislav Petkov <[email protected]>
Cc Toshi Kani <[email protected]>
---
 arch/x86/mm/init.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/mm/init.c +2 -2
@@ -43,18 +43,18 @@ uint16_t __cachemode2pte_tbl[_PAGE_CACHE
 	[_PAGE_CACHE_MODE_WC      ]	= 0         | _PAGE_PCD,
 	[_PAGE_CACHE_MODE_UC_MINUS]	= 0         | _PAGE_PCD,
 	[_PAGE_CACHE_MODE_UC      ]	= _PAGE_PWT | _PAGE_PCD,
-	[_PAGE_CACHE_MODE_WT      ]	= 0         | _PAGE_PCD,
+	[_PAGE_CACHE_MODE_WT      ]	= _PAGE_PWT | 0,
 	[_PAGE_CACHE_MODE_WP      ]	= 0         | _PAGE_PCD,
 };
 EXPORT_SYMBOL(__cachemode2pte_tbl);
 
 uint8_t __pte2cachemode_tbl[8] = {
 	[__pte2cm_idx( 0        | 0         | 0        )] = 
 _PAGE_CACHE_MODE_WB,
-	[__pte2cm_idx(_PAGE_PWT | 0         | 0        )] = 
 _PAGE_CACHE_MODE_UC_MINUS,
+	[__pte2cm_idx(_PAGE_PWT | 0         | 0        )] = 
 _PAGE_CACHE_MODE_WT,
 	[__pte2cm_idx( 0        | _PAGE_PCD | 0        )] = 
 _PAGE_CACHE_MODE_UC_MINUS,
 	[__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | 0        )] = 
 _PAGE_CACHE_MODE_UC,

[__pte2cm_idx( 0 | 0 | _PAGE_PAT)] =
_PAGE_CACHE_MODE_WB,

arch/x86/mm/init.c +0 -1
-	[__pte2cm_idx(_PAGE_PWT | 0         | _PAGE_PAT)] = 

_PAGE_CACHE_MODE_UC_MINUS,

arch/x86/mm/init.c +1 -0
+	[__pte2cm_idx(_PAGE_PWT | 0         | _PAGE_PAT)] = 

_PAGE_CACHE_MODE_WT,
[__pte2cm_idx(0 | _PAGE_PCD | _PAGE_PAT)] =
_PAGE_CACHE_MODE_UC_MINUS,
[__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)] =
_PAGE_CACHE_MODE_UC,
};

#5 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 22.07.15 at 00:29, <[email protected]> wrote:
Quoted 4 lines · Jan Beulich

Make WT really mean WT (rather than UC).

I can't see why commit 9cd25aac1f ("x86/mm/pat: Emulate PAT when it is disabled") didn't make this match its changes to pat_init().

No, the default values need to be set to the fallback types, i.e. minimal supported mode. For WC and WT, UC is the fallback type.

But why would that be?

Quoted 3 lines

When PAT is disabled, pat_init() does update the tables below to enable WT per the default BIOS setup. However, when PAT is enabled, but CPU has PAT -errata, WT falls back to UC per the default values.

PAT related errata I'm aware of are related to either page size or the number of bits used to index into the PAT MSR, but never to a particular memory type. Are you saying there are errata which make use of WT or WC impossible altogether? Otherwise I would have thought (even more so in the absence of any comment saying otherwise - "minimal supported modes" doesn't really say on what basis the set is the minimal one) that the mode systems come up in (compatible with pre-PAT) ought to be what the tables express.

Jan

#6 lore raw
Quoted 21 lines · Jan Beulich
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines · On 22.07.15 at 00:29, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich

Make WT really mean WT (rather than UC).

Quoted 7 lines
Quoted 3 lines

I can't see why commit 9cd25aac1f ("x86/mm/pat: Emulate PAT when it is
disabled") didn't make this match its changes to pat_init().

No, the default values need to be set to the fallback types, i.e. minimal
supported mode. For WC and WT, UC is the fallback type.

But why would that be?

Quoted 5 lines

When PAT is disabled, pat_init() does update the tables below to enable WT
per the default BIOS setup. However, when PAT is enabled, but CPU has PAT
-errata, WT falls back to UC per the default values.

Quoted 9 lines

PAT related errata I'm aware of are related to either page size or the number of bits used to index into the PAT MSR, but never to a particular memory type. Are you saying there are errata which make use of WT or WC impossible altogether? Otherwise I would have thought (even more so in the absence of any comment saying otherwise - "minimal supported modes" doesn't really say on what basis the set is the minimal one) that the mode systems come up in (compatible with pre-PAT) ought to be what the tables express.

Please take a look at the comments in pat_init(). WT uses slot 7 (not slot
1) in the regular case. We need to use the PAT bit in order to support both WC and WT. The PAT errata causes the PAT bit ineffective.

Thanks,
-Toshi

#7 lore raw
Quoted 33 lines
Quoted 1 line
Quoted 1 line · On 22.07.15 at 17:23, <[email protected]> wrote:
Quoted 21 lines · Jan Beulich
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines · On 22.07.15 at 00:29, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich

Make WT really mean WT (rather than UC).

Quoted 7 lines
Quoted 3 lines

I can't see why commit 9cd25aac1f ("x86/mm/pat: Emulate PAT when it is
disabled") didn't make this match its changes to pat_init().

No, the default values need to be set to the fallback types, i.e. minimal
supported mode. For WC and WT, UC is the fallback type.

But why would that be?

Quoted 5 lines

When PAT is disabled, pat_init() does update the tables below to enable WT
per the default BIOS setup. However, when PAT is enabled, but CPU has PAT
-errata, WT falls back to UC per the default values.

Quoted 9 lines

PAT related errata I'm aware of are related to either page size or the number of bits used to index into the PAT MSR, but never to a particular memory type. Are you saying there are errata which make use of WT or WC impossible altogether? Otherwise I would have thought (even more so in the absence of any comment saying otherwise - "minimal supported modes" doesn't really say on what basis the set is the minimal one) that the mode systems come up in (compatible with pre-PAT) ought to be what the tables express.

Quoted 2 lines

Please take a look at the comments in pat_init(). WT uses slot 7 (not slot
1) in the regular case.

But that is an adjustment Linux makes to the default the system comes up in. And again - in my opinion the pre-initialized table values should reflect the mode the system comes up in (i.e. correct prior to execution reaching pat_init()), and be updated (which as it seems happens in all three possible cases) once the MSR gets fiddled with.

Jan

#8 lore raw
Quoted 41 lines · Jan Beulich
Quoted 37 lines
Quoted 2 lines
Quoted 2 lines · On 22.07.15 at 17:23, <[email protected]> wrote:
Quoted 24 lines · Jan Beulich
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines · On 22.07.15 at 00:29, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich

Make WT really mean WT (rather than UC).

Quoted 8 lines
Quoted 4 lines

I can't see why commit 9cd25aac1f ("x86/mm/pat: Emulate PAT when it
is
disabled") didn't make this match its changes to pat_init().

No, the default values need to be set to the fallback types, i.e. minimal
supported mode. For WC and WT, UC is the fallback type.

But why would that be?

Quoted 7 lines

When PAT is disabled, pat_init() does update the tables below to enable
WT
per the default BIOS setup. However, when PAT is enabled, but CPU has
PAT
-errata, WT falls back to UC per the default values.

Quoted 9 lines

PAT related errata I'm aware of are related to either page size or the number of bits used to index into the PAT MSR, but never to a particular memory type. Are you saying there are errata which make use of WT or WC impossible altogether? Otherwise I would have thought (even more so in the absence of any comment saying otherwise - "minimal supported modes" doesn't really say on what basis the set is the minimal one) that the mode systems come up in (compatible with pre-PAT) ought to be what the tables express.

Quoted 3 lines

Please take a look at the comments in pat_init(). WT uses slot 7 (not slot
1) in the regular case.

Quoted 6 lines

But that is an adjustment Linux makes to the default the system comes up in. And again - in my opinion the pre-initialized table values should reflect the mode the system comes up in (i.e. correct prior to execution reaching pat_init()), and be updated (which as it seems happens in all three possible cases) once the MSR gets fiddled with.

'enum page_cache_mode' thru __cachemode2pte_tbl[] is a high-level abstraction that can be used after pat_init(). For early boot-time, __early_ioremap() takes pgprot_t directly.

Do you have a need to use __cachemode2pte_tbl[] before pat_init()?

Thanks,
-Toshi

#9 lore raw
Quoted 50 lines
Quoted 1 line
Quoted 1 line · On 22.07.15 at 18:06, <[email protected]> wrote:
Quoted 41 lines · Jan Beulich
Quoted 37 lines
Quoted 2 lines
Quoted 2 lines · On 22.07.15 at 17:23, <[email protected]> wrote:
Quoted 24 lines · Jan Beulich
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines · On 22.07.15 at 00:29, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich

Make WT really mean WT (rather than UC).

Quoted 8 lines
Quoted 4 lines

I can't see why commit 9cd25aac1f ("x86/mm/pat: Emulate PAT when it
is
disabled") didn't make this match its changes to pat_init().

No, the default values need to be set to the fallback types, i.e. minimal
supported mode. For WC and WT, UC is the fallback type.

But why would that be?

Quoted 7 lines

When PAT is disabled, pat_init() does update the tables below to enable
WT
per the default BIOS setup. However, when PAT is enabled, but CPU has
PAT
-errata, WT falls back to UC per the default values.

Quoted 9 lines

PAT related errata I'm aware of are related to either page size or the number of bits used to index into the PAT MSR, but never to a particular memory type. Are you saying there are errata which make use of WT or WC impossible altogether? Otherwise I would have thought (even more so in the absence of any comment saying otherwise - "minimal supported modes" doesn't really say on what basis the set is the minimal one) that the mode systems come up in (compatible with pre-PAT) ought to be what the tables express.

Quoted 3 lines

Please take a look at the comments in pat_init(). WT uses slot 7 (not slot
1) in the regular case.

Quoted 6 lines

But that is an adjustment Linux makes to the default the system comes up in. And again - in my opinion the pre-initialized table values should reflect the mode the system comes up in (i.e. correct prior to execution reaching pat_init()), and be updated (which as it seems happens in all three possible cases) once the MSR gets fiddled with.

Quoted 5 lines

'enum page_cache_mode' thru __cachemode2pte_tbl[] is a high-level abstraction that can be used after pat_init(). For early boot-time, __early_ioremap() takes pgprot_t directly.

Do you have a need to use __cachemode2pte_tbl[] before pat_init()?

No. I just noticed the (apparent?) inconsistency.

Jan

#10 lore raw
Quoted 57 lines · Jan Beulich
Quoted 57 lines
Quoted 2 lines
Quoted 2 lines · On 22.07.15 at 18:06, <[email protected]> wrote:
Quoted 53 lines · Jan Beulich
Quoted 42 lines
Quoted 2 lines
Quoted 2 lines · On 22.07.15 at 17:23, <[email protected]> wrote:
Quoted 28 lines · Jan Beulich
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines · On 22.07.15 at 00:29, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich

Make WT really mean WT (rather than UC).

I can't see why commit 9cd25aac1f ("x86/mm/pat: Emulate PAT when
it
is
disabled") didn't make this match its changes to pat_init().

Quoted 4 lines

No, the default values need to be set to the fallback types, i.e.
minimal
supported mode. For WC and WT, UC is the fallback type.

But why would that be?

Quoted 9 lines

When PAT is disabled, pat_init() does update the tables below to
enable
WT
per the default BIOS setup. However, when PAT is enabled, but CPU
has
PAT
-errata, WT falls back to UC per the default values.

Quoted 10 lines

PAT related errata I'm aware of are related to either page size or
the number of bits used to index into the PAT MSR, but never to a particular memory type. Are you saying there are errata which make use of WT or WC impossible altogether? Otherwise I would have thought (even more so in the absence of any comment saying otherwise - "minimal supported modes" doesn't really say on what basis the set is the minimal one) that the mode systems come up in (compatible with pre-PAT) ought to be what the tables express.

Quoted 4 lines

Please take a look at the comments in pat_init(). WT uses slot 7 (not
slot
1) in the regular case.

But that is an adjustment Linux makes to the default the system comes up in. And again - in my opinion the pre-initialized table values should reflect the mode the system comes up in (i.e. correct prior to execution reaching pat_init()), and be updated (which as it seems happens in all three possible cases) once the MSR gets fiddled with.

Quoted 7 lines
Quoted 5 lines

'enum page_cache_mode' thru __cachemode2pte_tbl[] is a high-level abstraction that can be used after pat_init(). For early boot-time, __early_ioremap() takes pgprot_t directly.

Do you have a need to use __cachemode2pte_tbl[] before pat_init()?

No. I just noticed the (apparent?) inconsistency.

I will update the comment of __cachemode2pte_tbl[] to avoid such confusion.

Thanks,
-Toshi