Re: [PATCH] x86: adjust default caching mode translation tables

2015-07-22 Thread Toshi Kani
On Wed, 2015-07-22 at 10:36 -0600, Jan Beulich wrote:
> > 
> > > > On 22.07.15 at 18:06,  wrote:
> > On Wed, 2015-07-22 at 09:41 -0600, Jan Beulich wrote:
> > > > 
> > > > > > On 22.07.15 at 17:23,  wrote:
> > > > On Wed, 2015-07-22 at 09:17 -0600, Jan Beulich wrote:
> > > > > > 
> > > > > > > > On 22.07.15 at 00:29,  wrote:
> > > > > > On Mon, 2015-07-20 at 08:46 +0100, Jan Beulich wrote:
> > > > > > > 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?
> > > > > 
> > > > > > 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.
> > > > 
> > > > 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.
> > 
> > '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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86: adjust default caching mode translation tables

2015-07-22 Thread Jan Beulich
>>> On 22.07.15 at 18:06,  wrote:
> On Wed, 2015-07-22 at 09:41 -0600, Jan Beulich wrote:
>> > 
>> > > > On 22.07.15 at 17:23,  wrote:
>> > On Wed, 2015-07-22 at 09:17 -0600, Jan Beulich wrote:
>> > > > 
>> > > > > > On 22.07.15 at 00:29,  wrote:
>> > > > On Mon, 2015-07-20 at 08:46 +0100, Jan Beulich wrote:
>> > > > > 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?
>> > > 
>> > > > 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.
>> > 
>> > 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.
> 
> '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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86: adjust default caching mode translation tables

2015-07-22 Thread Toshi Kani
On Wed, 2015-07-22 at 09:41 -0600, Jan Beulich wrote:
> > 
> > > > On 22.07.15 at 17:23,  wrote:
> > On Wed, 2015-07-22 at 09:17 -0600, Jan Beulich wrote:
> > > > 
> > > > > > On 22.07.15 at 00:29,  wrote:
> > > > On Mon, 2015-07-20 at 08:46 +0100, Jan Beulich wrote:
> > > > > 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?
> > > 
> > > > 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.
> > 
> > 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.

'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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86: adjust default caching mode translation tables

2015-07-22 Thread Jan Beulich
>>> On 22.07.15 at 17:23,  wrote:
> On Wed, 2015-07-22 at 09:17 -0600, Jan Beulich wrote:
>> > 
>> > > > On 22.07.15 at 00:29,  wrote:
>> > On Mon, 2015-07-20 at 08:46 +0100, Jan Beulich wrote:
>> > > 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?
>> 
>> > 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.
> 
> 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86: adjust default caching mode translation tables

2015-07-22 Thread Jan Beulich
>>> On 22.07.15 at 00:29,  wrote:
> On Mon, 2015-07-20 at 08:46 +0100, Jan Beulich wrote:
>> 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?

> 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86: adjust default caching mode translation tables

2015-07-22 Thread Toshi Kani
On Wed, 2015-07-22 at 09:17 -0600, Jan Beulich wrote:
> > 
> > > > On 22.07.15 at 00:29,  wrote:
> > On Mon, 2015-07-20 at 08:46 +0100, Jan Beulich wrote:
> > > 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?
> 
> > 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.

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86: adjust default caching mode translation tables

2015-07-22 Thread Toshi Kani
On Wed, 2015-07-22 at 09:41 -0600, Jan Beulich wrote:
  
On 22.07.15 at 17:23, toshi.k...@hp.com wrote:
  On Wed, 2015-07-22 at 09:17 -0600, Jan Beulich wrote:

  On 22.07.15 at 00:29, toshi.k...@hp.com wrote:
On Mon, 2015-07-20 at 08:46 +0100, Jan Beulich wrote:
 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?
   
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.
  
  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.

'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
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86: adjust default caching mode translation tables

2015-07-22 Thread Jan Beulich
 On 22.07.15 at 00:29, toshi.k...@hp.com wrote:
 On Mon, 2015-07-20 at 08:46 +0100, Jan Beulich wrote:
 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?

 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

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86: adjust default caching mode translation tables

2015-07-22 Thread Jan Beulich
 On 22.07.15 at 17:23, toshi.k...@hp.com wrote:
 On Wed, 2015-07-22 at 09:17 -0600, Jan Beulich wrote:
  
On 22.07.15 at 00:29, toshi.k...@hp.com wrote:
  On Mon, 2015-07-20 at 08:46 +0100, Jan Beulich wrote:
   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?
 
  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.
 
 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

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86: adjust default caching mode translation tables

2015-07-22 Thread Jan Beulich
 On 22.07.15 at 18:06, toshi.k...@hp.com wrote:
 On Wed, 2015-07-22 at 09:41 -0600, Jan Beulich wrote:
  
On 22.07.15 at 17:23, toshi.k...@hp.com wrote:
  On Wed, 2015-07-22 at 09:17 -0600, Jan Beulich wrote:

  On 22.07.15 at 00:29, toshi.k...@hp.com wrote:
On Mon, 2015-07-20 at 08:46 +0100, Jan Beulich wrote:
 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?
   
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.
  
  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.
 
 '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

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86: adjust default caching mode translation tables

2015-07-22 Thread Toshi Kani
On Wed, 2015-07-22 at 09:17 -0600, Jan Beulich wrote:
  
On 22.07.15 at 00:29, toshi.k...@hp.com wrote:
  On Mon, 2015-07-20 at 08:46 +0100, Jan Beulich wrote:
   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?
 
  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.

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
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86: adjust default caching mode translation tables

2015-07-22 Thread Toshi Kani
On Wed, 2015-07-22 at 10:36 -0600, Jan Beulich wrote:
  
On 22.07.15 at 18:06, toshi.k...@hp.com wrote:
  On Wed, 2015-07-22 at 09:41 -0600, Jan Beulich wrote:

  On 22.07.15 at 17:23, toshi.k...@hp.com wrote:
On Wed, 2015-07-22 at 09:17 -0600, Jan Beulich wrote:
  
On 22.07.15 at 00:29, toshi.k...@hp.com wrote:
  On Mon, 2015-07-20 at 08:46 +0100, Jan Beulich wrote:
   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?
 
  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.

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.
  
  '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
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86: adjust default caching mode translation tables

2015-07-21 Thread Toshi Kani
On Mon, 2015-07-20 at 08:46 +0100, Jan Beulich wrote:
> 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

> 
> Signed-off-by: Jan Beulich 
> Cc: Borislav Petkov 
> Cc: Toshi Kani  
> ---
>  arch/x86/mm/init.c |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> --- 4.2-rc3/arch/x86/mm/init.c
> +++ 4.2-rc3-x86-default-cache-mode/arch/x86/mm/init.c
> @@ -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,
>  };
> 
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86: adjust default caching mode translation tables

2015-07-21 Thread Toshi Kani
On Mon, 2015-07-20 at 08:46 +0100, Jan Beulich wrote:
 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

 
 Signed-off-by: Jan Beulich jbeul...@suse.com
 Cc: Borislav Petkov b...@suse.de
 Cc: Toshi Kani toshi.k...@hp.com 
 ---
  arch/x86/mm/init.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
 
 --- 4.2-rc3/arch/x86/mm/init.c
 +++ 4.2-rc3-x86-default-cache-mode/arch/x86/mm/init.c
 @@ -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,
  };
 
 
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/