[PATCH v4 0/4] cacheinfo: Correctly fallback to using clidr_el1's information

Pierre Gondois posted 4 patches 2 years, 8 months ago
drivers/base/arch_topology.c |  7 +++---
drivers/base/cacheinfo.c     | 49 ++++++++++++++++++++++++++++++++----
include/linux/cacheinfo.h    |  6 +++++
3 files changed, 54 insertions(+), 8 deletions(-)
[PATCH v4 0/4] cacheinfo: Correctly fallback to using clidr_el1's information
Posted by Pierre Gondois 2 years, 8 months ago
v4:
arch_topology: Remove early cacheinfo error message:
- Only remove the error message if the error code is -ENOENT
cacheinfo: Add use_arch[|_cache]_info field/function:
- Use a static variable instead of a per-leaf 'use_arch_info'
- Reformat the use_arch_cache_info() define

v3:
cacheinfo: Check sib_leaf in cache_leaves_are_shared():
- Reformulate commit message
- Fix rebase issue and move '&&' condition which was in the last patch
  to this patch.
cacheinfo: Add use_arch[|_cache]_info field/function:
- Put the function declaration in one line.
arch_topology: Remove early cacheinfo error message:
- New patch.

v2:
cacheinfo: Check sib_leaf in cache_leaves_are_shared()
- Reformulate commit message
- Add 'Fixes: f16d1becf96f ("cacheinfo: Use cache identifiers [...]'
cacheinfo: Check cache properties are present in DT
- Use of_property_present()
- Add 'Reported-by: Alexandre Ghiti <alexghiti@rivosinc.com>'
cacheinfo: Add use_arch[|_cache]_info field/function:
- Make use_arch_cache_info() a static inline function

The cache information can be extracted from either a Device
Tree (DT), the PPTT ACPI table, or arch registers (clidr_el1
for arm64).

When the DT is used but no cache properties are advertised,
the current code doesn't correctly fallback to using arch information.

Correct this. Also use the assumption that L1 data/instruction caches
are private and L2/higher caches are shared when the cache information
is coming form clidr_el1.

As suggested by Alexandre, this serie should ideally go to 6.3 fixes.

Pierre Gondois (4):
  cacheinfo: Check sib_leaf in cache_leaves_are_shared()
  cacheinfo: Check cache properties are present in DT
  arch_topology: Remove early cacheinfo error message if -ENOENT
  cacheinfo: Add use_arch[|_cache]_info field/function

 drivers/base/arch_topology.c |  7 +++---
 drivers/base/cacheinfo.c     | 49 ++++++++++++++++++++++++++++++++----
 include/linux/cacheinfo.h    |  6 +++++
 3 files changed, 54 insertions(+), 8 deletions(-)

-- 
2.25.1
Re: [PATCH v4 0/4] cacheinfo: Correctly fallback to using clidr_el1's information
Posted by Sudeep Holla 2 years, 8 months ago
On Fri, 14 Apr 2023 10:14:48 +0200, Pierre Gondois wrote:
> v4:
> arch_topology: Remove early cacheinfo error message:
> - Only remove the error message if the error code is -ENOENT
> cacheinfo: Add use_arch[|_cache]_info field/function:
> - Use a static variable instead of a per-leaf 'use_arch_info'
> - Reformat the use_arch_cache_info() define
> 
> [...]

Applied to sudeep.holla/linux (for-next/cacheinfo), thanks!

[1/4] cacheinfo: Check sib_leaf in cache_leaves_are_shared()
      https://git.kernel.org/sudeep.holla/c/7a306e3eabf2
[2/4] cacheinfo: Check cache properties are present in DT
      https://git.kernel.org/sudeep.holla/c/cde0fbff07ef
[3/4] arch_topology: Remove early cacheinfo error message if -ENOENT
      https://git.kernel.org/sudeep.holla/c/3522340199cc
[4/4] cacheinfo: Add use_arch[|_cache]_info field/function
      https://git.kernel.org/sudeep.holla/c/ef9f643a9f8b

--
Regards,
Sudeep
Re: [PATCH v4 0/4] cacheinfo: Correctly fallback to using clidr_el1's information
Posted by Florian Fainelli 2 years, 8 months ago
On 4/14/23 01:14, Pierre Gondois wrote:
> v4:
> arch_topology: Remove early cacheinfo error message:
> - Only remove the error message if the error code is -ENOENT
> cacheinfo: Add use_arch[|_cache]_info field/function:
> - Use a static variable instead of a per-leaf 'use_arch_info'
> - Reformat the use_arch_cache_info() define
> 
> v3:
> cacheinfo: Check sib_leaf in cache_leaves_are_shared():
> - Reformulate commit message
> - Fix rebase issue and move '&&' condition which was in the last patch
>    to this patch.
> cacheinfo: Add use_arch[|_cache]_info field/function:
> - Put the function declaration in one line.
> arch_topology: Remove early cacheinfo error message:
> - New patch.
> 
> v2:
> cacheinfo: Check sib_leaf in cache_leaves_are_shared()
> - Reformulate commit message
> - Add 'Fixes: f16d1becf96f ("cacheinfo: Use cache identifiers [...]'
> cacheinfo: Check cache properties are present in DT
> - Use of_property_present()
> - Add 'Reported-by: Alexandre Ghiti <alexghiti@rivosinc.com>'
> cacheinfo: Add use_arch[|_cache]_info field/function:
> - Make use_arch_cache_info() a static inline function
> 
> The cache information can be extracted from either a Device
> Tree (DT), the PPTT ACPI table, or arch registers (clidr_el1
> for arm64).
> 
> When the DT is used but no cache properties are advertised,
> the current code doesn't correctly fallback to using arch information.
> 
> Correct this. Also use the assumption that L1 data/instruction caches
> are private and L2/higher caches are shared when the cache information
> is coming form clidr_el1.
> 
> As suggested by Alexandre, this serie should ideally go to 6.3 fixes.

FWIW:

Tested-by: Florian Fainelli <f.fainelli@gmail.com>

Thanks!
-- 
Florian