Re: [PATCH 2/2] amd: uncore: Get correct number of cores sharing last level cache

2017-06-06 Thread Janakarajan Natarajan
On 06/06/2017 12:45 PM, Borislav Petkov wrote: On Tue, Jun 06, 2017 at 12:15:30PM +0200, Peter Zijlstra wrote: Maybe something like: for (cache_level = 0; cache_level < 3; cache_level++) { cpuid_count(0x801d, cache_level, , , , ); if ((eax & 0x1f)

Re: [PATCH 2/2] amd: uncore: Get correct number of cores sharing last level cache

2017-06-06 Thread Janakarajan Natarajan
On 06/06/2017 12:45 PM, Borislav Petkov wrote: On Tue, Jun 06, 2017 at 12:15:30PM +0200, Peter Zijlstra wrote: Maybe something like: for (cache_level = 0; cache_level < 3; cache_level++) { cpuid_count(0x801d, cache_level, , , , ); if ((eax & 0x1f)

Re: [PATCH 2/2] amd: uncore: Get correct number of cores sharing last level cache

2017-06-06 Thread Borislav Petkov
On Tue, Jun 06, 2017 at 12:15:30PM +0200, Peter Zijlstra wrote: > Maybe something like: > > for (cache_level = 0; cache_level < 3; cache_level++) { > cpuid_count(0x801d, cache_level, , , , ); > > if ((eax & 0x1f) == 0) /* EAX[0:4] gives cache type */

Re: [PATCH 2/2] amd: uncore: Get correct number of cores sharing last level cache

2017-06-06 Thread Borislav Petkov
On Tue, Jun 06, 2017 at 12:15:30PM +0200, Peter Zijlstra wrote: > Maybe something like: > > for (cache_level = 0; cache_level < 3; cache_level++) { > cpuid_count(0x801d, cache_level, , , , ); > > if ((eax & 0x1f) == 0) /* EAX[0:4] gives cache type */

Re: [PATCH 2/2] amd: uncore: Get correct number of cores sharing last level cache

2017-06-06 Thread Peter Zijlstra
On Mon, Jun 05, 2017 at 11:13:19AM -0500, Janakarajan Natarajan wrote: > + /* > + * Iterate over Cache Topology Definition leaves until no > + * more cache descriptions are available > + */ > + while (1) { > +

Re: [PATCH 2/2] amd: uncore: Get correct number of cores sharing last level cache

2017-06-06 Thread Peter Zijlstra
On Mon, Jun 05, 2017 at 11:13:19AM -0500, Janakarajan Natarajan wrote: > + /* > + * Iterate over Cache Topology Definition leaves until no > + * more cache descriptions are available > + */ > + while (1) { > +

[PATCH 2/2] amd: uncore: Get correct number of cores sharing last level cache

2017-06-05 Thread Janakarajan Natarajan
In Family 17h, the number of cores sharing a cache level is obtained from the Cache Properties CPUID leaf (0x801d) by passing in the cache level in ECX. In prior families, a cache level of 2 was used to determine this information. To get the right information, irrespective of Family, iterate

[PATCH 2/2] amd: uncore: Get correct number of cores sharing last level cache

2017-06-05 Thread Janakarajan Natarajan
In Family 17h, the number of cores sharing a cache level is obtained from the Cache Properties CPUID leaf (0x801d) by passing in the cache level in ECX. In prior families, a cache level of 2 was used to determine this information. To get the right information, irrespective of Family, iterate