Upstream A64FX cache driver
RFC PATCH 1/1 Upstream A64FX cache driver
From: "tan.shaopeng" <[email protected]>
Hello,
This driver enables Fujitsu A64FX's cache function.
[Driver Description]
A64FX CPU has several functions for HPC workload and this driver is for cache functions.
Loading this cache driver, control registers will be set to enable these functions, and advanced settings registers will be set by default values. After loading this driver, you can use the default values of the advanced settings registers or set custom values to the advanced settings registers from EL0. Unloading this driver, control registers will be clear to disable these functions.
These functions include sector cache function and hardware prefetch assistance function.
- Sector cache function:
Cache partitioning function which can control virtual cache capacity for each characteristics of data such as temporal locality.
- Hardware prefetch assistance function:
Software can provide the hint for hardware prefetch mechanism to reduce the penalty of the memory access. By providing the access pattern through that function in advance, hardware prefetch mechanism can access the complex pattern.
These functions can be executed according to the default values of the registers which are set by the driver. Or they can be executed according to a tag which is the upper 8 bits of the load/store address of application to customize hardware prefetch and sector cache.
For more details of these functions,
see A64FX HPC extension specification in
https://github.com/fujitsu/A64FX
The driver is based on v5.11-rc2 and tested on FX1000 environment.
[RFC]
This function only performs register initialization for A64FX. At first, I wanted to insert it to kernel initialization code, but there is no initialization code except errata, so I made this driver. I'd like to know if this approach is OK? Would you give me some advice?
Best regards,
Tan Shaopeng
tan.shaopeng (1):
soc: fujitsu: Add cache driver code
MAINTAINERS | 6 ++ arch/arm64/Kconfig.platforms | 5 + drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/fujitsu/Kconfig | 26 +++++ drivers/soc/fujitsu/fujitsu_cache.c | 183 ++++++++++++++++++++++++++++++++++++ 6 files changed, 222 insertions(+) create mode 100644 drivers/soc/fujitsu/Kconfig create mode 100644 drivers/soc/fujitsu/fujitsu_cache.c
Signature · 1 line
1.8.3.1
RFC PATCH 1/1 soc: fujitsu: Add cache driver code
From: "tan.shaopeng" <[email protected]>
This driver offers cache functions(including hardware prefetch function and sector cache function) for A64FX system.
When built as a module, this will be called as "fujitsu_cache".
--- MAINTAINERS | 6 ++ arch/arm64/Kconfig.platforms | 5 + drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/fujitsu/Kconfig | 26 +++++ drivers/soc/fujitsu/fujitsu_cache.c | 183 ++++++++++++++++++++++++++++++++++++ 6 files changed, 222 insertions(+) create mode 100644 drivers/soc/fujitsu/Kconfig create mode 100644 drivers/soc/fujitsu/fujitsu_cache.c
MAINTAINERS +6 -0
@@ -1508,6 +1508,12 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git F: arch/arm/mach-*/ F: arch/arm/plat-*/ +ARM/A64FX SOC SUPPORT +M: SHAOPENG TAN <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Maintained +F: drivers/soc/fujitsu/ + ARM/ACTIONS SEMI ARCHITECTURE M: Andreas Färber <[email protected]> M: Manivannan Sadhasivam <[email protected]>
arch/arm64/Kconfig.platforms +5 -0
@@ -1,6 +1,11 @@ # SPDX-License-Identifier: GPL-2.0-only menu "Platform selection" +config ARCH_A64FX + bool "Fujitsu A64FX Platforms" + help + This enables support for Fujitsu A64FX SoC family. + config ARCH_ACTIONS bool "Actions Semi Platforms" select OWL_TIMER
drivers/soc/Kconfig +1 -0
@@ -7,6 +7,7 @@ source "drivers/soc/aspeed/Kconfig" source "drivers/soc/atmel/Kconfig" source "drivers/soc/bcm/Kconfig" source "drivers/soc/fsl/Kconfig" +source "drivers/soc/fujitsu/Kconfig" source "drivers/soc/imx/Kconfig" source "drivers/soc/ixp4xx/Kconfig" source "drivers/soc/litex/Kconfig"
drivers/soc/Makefile +1 -0
@@ -10,6 +10,7 @@ obj-y += bcm/ obj-$(CONFIG_ARCH_DOVE) += dove/ obj-$(CONFIG_MACH_DOVE) += dove/ obj-y += fsl/ +obj-y += fujitsu/ obj-$(CONFIG_ARCH_GEMINI) += gemini/ obj-y += imx/ obj-$(CONFIG_ARCH_IXP4XX) += ixp4xx/
drivers/soc/fujitsu/Kconfig new file +26 -0
@@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# FUJITSU SoC drivers +# +menuconfig SOC_FUJITSU + bool "FUJITSU SoC drivers" + depends on ARCH_A64FX || COMPILE_TEST + +if SOC_FUJITSU + +config FUJITSU_CACHE + tristate "FUJITSU Cache Driver" + depends on ARM64_VHE || COMPILE_TEST + help + FUJITSU Cache Driver + + This driver offers cache functions for A64FX system. + Loading this cache driver, control registers will be set to enable + these functions, and advanced settings registers will be set by default + values. After loading this driver, you can use the default values of the + advanced settings registers or set the advanced settings registers + from EL0. Unloading this driver, control registers will be clear to + disable these functions. + When built as a module, this will be called as "fujitsu_cache". + +endif # SOC_FUJITSU
drivers/soc/fujitsu/fujitsu_cache.c new file +183 -0
183 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [PATCH RFC] soc: fujitsu: Add cache driver code
Quoted 5 lines · tan.shaopeng
drivers/soc/fujitsu/Kconfig new file +5
-0+ +config FUJITSU_CACHE + tristate "FUJITSU Cache Driver" + depends on ARM64_VHE || COMPILE_TEST + help
drivers/soc/fujitsu/Kconfig line 24
Quoted 10 lines
drivers/soc/fujitsu/Kconfig new file +10
-0+ FUJITSU Cache Driver + + This driver offers cache functions for A64FX system. + Loading this cache driver, control registers will be set to enable + these functions, and advanced settings registers will be set by default + values. After loading this driver, you can use the default values of the + advanced settings registers or set the advanced settings registers + from EL0. Unloading this driver, control registers will be clear to + disable these functions. + When built as a module, this will be called as "fujitsu_cache".
My feeling is that this code should be in arch/arm64/, as the cache is generally considered part of the CPU, rather than part of the wider SoC design, or something that can be controlled separately from the core kernel and memory management code.
drivers/soc/fujitsu/fujitsu_cache.c line 81
Quoted 12 lines
drivers/soc/fujitsu/fujitsu_cache.c new file +12
-0+module_param (tagaddr_ctrl_reg, ulong,0444 ); +MODULE_PARM_DESC (tagaddr_ctrl_reg,"HPC tag address override control register" ); +module_param (hwpf_ctrl_reg, ulong,0444 ); +MODULE_PARM_DESC (hwpf_ctrl_reg,"hardware prefetch assist control register" ); +module_param (sec_ctrl_reg, ulong,0444 ); +MODULE_PARM_DESC (sec_ctrl_reg,"sector cache control register" ); +module_param (sec_assign_reg, ulong,0444 ); +MODULE_PARM_DESC (sec_assign_reg,"sector cache assign register" ); +module_param (sec_set0_l2_reg, ulong,0444 ); +MODULE_PARM_DESC (sec_set0_l2_reg,"sector cache L2 way register(sector=0,1)" ); +module_param (sec_set1_l2_reg, ulong,0444 ); +MODULE_PARM_DESC (sec_set1_l2_reg,"sector cache L2 way register(sector=2,3)" );
My feeling is that the actual settings need to be on a higher level, not tied to the specific register-level implementation of this chip. Normally, the L2 cache is set up by the firmware according to local policy, and the settings can either be read by the kernel from registers or passed down through the device tree. It sounds like you want to control the policy at runtime in the operating system rather than at boot time, so for each setting you wish to override, there should be description of what the setting does and what the purpose of overriding the firmware setting is.
Looking at the first one in the list, I see the specification mentions multiple distinct features that can be enabled or disabled, so these should probably get controlled individually. I also see that it is possible to control this for TTBR1 and TTBR0 separately, and we probably cannot allow user space (through module parameters or any other interface) to control TTBR1, which is where the kernel resides.
The TTBR0 settings in turn would seem to interact with CONFIG_ARM64_MTE, and should not be controlled independently but through the same interfaces as that if we find that it does need to be controlled at all.
I have not looked at any further details, but that should help get an idea of what I think would happen with the other registers.
drivers/soc/fujitsu/fujitsu_cache.c line 156
Quoted 8 lines
drivers/soc/fujitsu/fujitsu_cache.c new file +8
-0+static int __init fujitsu_drv_init (void ) +{ +int ret; + +if (read_cpuid_implementor () !=ARM_CPU_IMP_FUJITSU ) +return -ENODEV ; +if (read_cpuid_part_number () !=FUJITSU_CPU_PART_A64FX ) +return -ENODEV ;
The module_init function should not return an error when it is running on incompatible hardware, please just change this to silently return success to avoid warning about the failed initcall if the driver is built into a generic kernel.
Arnd
RE: [PATCH RFC] soc: fujitsu: Add cache driver code
Hi,
Thanks for your comments
Quoted 20 lines
drivers/soc/fujitsu/Kconfig
Quoted 10 lines · tan.shaopeng
drivers/soc/fujitsu/Kconfig new file +10
-0+ +config FUJITSU_CACHE + tristate "FUJITSU Cache Driver" + depends on ARM64_VHE || COMPILE_TEST + help + FUJITSU Cache Driver + + This driver offers cache functions for A64FX system. + Loading this cache driver, control registers will be set to enable + these functions, and advanced settings registers will be set bydefault
Quoted 1 line
+ values. After loading this driver, you can use the default values of
the
drivers/soc/fujitsu/Kconfig line 24
Quoted 4 lines
drivers/soc/fujitsu/Kconfig new file +4
-0+ advanced settings registers or set the advanced settings registers + from EL0. Unloading this driver, control registers will be clear to + disable these functions. + When built as a module, this will be called as "fujitsu_cache".
Quoted 4 lines
My feeling is that this code should be in
arch/arm64/, as the cache is generally considered part of the CPU, rather than part of the wider SoC design, or something that can be controlled separately from the core kernel and memory management code.
Thanks for your advice. I also would like to hear the opinions from other soc&arm maintainers, and then consider whether to add this to arch/arm64/.
Quoted 17 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+module_param(tagaddr_ctrl_reg, ulong, 0444); +MODULE_PARM_DESC(tagaddr_ctrl_reg, "HPC tag address overridecontrol register");
Review
Quoted 2 lines
(quoted diff) +2
-0+module_param(hwpf_ctrl_reg, ulong, 0444); +MODULE_PARM_DESC(hwpf_ctrl_reg, "hardware prefetch assist controlregister");
drivers/soc/fujitsu/fujitsu_cache.c
Quoted 6 lines
drivers/soc/fujitsu/fujitsu_cache.c new file +6
-0+module_param (sec_ctrl_reg, ulong,0444 ); +MODULE_PARM_DESC (sec_ctrl_reg,"sector cache control register" ); +module_param (sec_assign_reg, ulong,0444 ); +MODULE_PARM_DESC (sec_assign_reg,"sector cache assign register" ); +module_param (sec_set0_l2_reg, ulong,0444 ); +MODULE_PARM_DESC(sec_set0_l2_reg, "sector cache L2 way
register(sector=0,1)");Review
Quoted 2 lines
(quoted diff) +2
-0+module_param(sec_set1_l2_reg, ulong, 0444); +MODULE_PARM_DESC(sec_set1_l2_reg, "sector cache L2 way
register(sector=2,3)");
Quoted 8 lines
My feeling is that the actual settings need to be on a higher level, not tied to the specific register-level implementation of this chip. Normally, the L2 cache is set up by the firmware according to local policy, and the settings can either be read by the kernel from registers or passed down through the device tree. It sounds like you want to control the policy at runtime in the operating system rather than at boot time, so for each setting you wish to override, there should be description of what the setting does and what the purpose of overriding the firmware setting is.
OK, I will change module parameter from specific register-level to a higher level. And, I will modify the description of module parameters. To be clear, we don't suppose these parameters (EL1 registers) are often changed at runtime.
Quoted 3 lines
Looking at the first one in the list, I see the specification mentions multiple distinct features that can be enabled or disabled, so these should probably get controlled individually.
It is not necessary to enable/disable every feature individually. There are no plans to use these features individually.
Quoted 4 lines
I also see that it is possible
to control this for TTBR1 and TTBR0 separately, and we probably cannot allow user space (through module parameters or any other interface) to control TTBR1, which is where the kernel resides.
This driver does not change the values of TTBR0 and TTBR1, and the values of TCR_EL1.TBI0 and TCR_EL1.TBI1. The cache functions can be used when TBI is already enabled.
Quoted 4 lines
The TTBR0 settings in turn would seem to interact with
CONFIG_ARM64_MTE, and should not be controlled independently but through the same interfaces as that if we find that it does need to be controlled at all.
MTE is not supported on A64FX.
So, this function does not conflict with MTE.
Quoted 16 lines
I have not looked at any further details, but that should help get an idea of what I think would happen with the other registers.
drivers/soc/fujitsu/fujitsu_cache.c line 156
Quoted 8 lines
drivers/soc/fujitsu/fujitsu_cache.c new file +8
-0+static int __init fujitsu_drv_init (void ) +{ +int ret; + +if (read_cpuid_implementor () !=ARM_CPU_IMP_FUJITSU ) +return -ENODEV ; +if (read_cpuid_part_number () !=FUJITSU_CPU_PART_A64FX ) +return -ENODEV ;The
module_initfunction should not return an error when it is running on incompatible hardware, please just change this to silently return success to avoid warning about the failed initcall if the driver is built into a generic kernel.
OK, I will change these codes to return success.
Best regards,
Tan Shaopeng
Will Deacon
maintainerRe: [PATCH RFC] soc: fujitsu: Add cache driver code
Quoted 20 lines · On Thu, Mar 04, 2021 at 10:34:43AM +0000, [email protected] wrote:
Quoted 20 lines
drivers/soc/fujitsu/Kconfig
Quoted 10 lines · tan.shaopeng
drivers/soc/fujitsu/Kconfig new file +10
-0+ +config FUJITSU_CACHE + tristate "FUJITSU Cache Driver" + depends on ARM64_VHE || COMPILE_TEST + help + FUJITSU Cache Driver + + This driver offers cache functions for A64FX system. + Loading this cache driver, control registers will be set to enable + these functions, and advanced settings registers will be set bydefault
Quoted 1 line
+ values. After loading this driver, you can use the default values of
the
Quoted 4 lines
drivers/soc/fujitsu/Kconfig new file +4
-0+ advanced settings registers or set the advanced settings registers + from EL0. Unloading this driver, control registers will be clear to + disable these functions. + When built as a module, this will be called as "fujitsu_cache".
Quoted 8 lines
Quoted 4 lines
My feeling is that this code should be in
arch/arm64/, as the cache is generally considered part of the CPU, rather than part of the wider SoC design, or something that can be controlled separately from the core kernel and memory management code.Thanks for your advice. I also would like to hear the opinions from other soc&arm maintainers, and then consider whether to add this to
arch/arm64/.
Given that all of this is outside of the scope of the architecture, I don't think that arch/arm64/ is the right place for it. Perhaps this would fit into the resctrl rework that James has been doing for MPAM?
Will
Re: [PATCH RFC] soc: fujitsu: Add cache driver code
Quoted 26 lines · Will Deacon
Quoted 25 lines · On Thu, Mar 04, 2021 at 10:34:43AM +0000, [email protected] wrote:
Quoted 24 lines
drivers/soc/fujitsu/Kconfig
Quoted 10 lines · tan.shaopeng
drivers/soc/fujitsu/Kconfig new file +10
-0+ +config FUJITSU_CACHE + tristate "FUJITSU Cache Driver" + depends on ARM64_VHE || COMPILE_TEST + help + FUJITSU Cache Driver + + This driver offers cache functions for A64FX system. + Loading this cache driver, control registers will be set to enable + these functions, and advanced settings registers will be set bydefault
Quoted 1 line
+ values. After loading this driver, you can use the default values of
the
drivers/soc/fujitsu/Kconfig line 24
Quoted 4 lines
drivers/soc/fujitsu/Kconfig new file +4
-0+ advanced settings registers or set the advanced settings registers + from EL0. Unloading this driver, control registers will be clear to + disable these functions. + When built as a module, this will be called as "fujitsu_cache".My feeling is that this code should be in
arch/arm64/, as the cache is generally considered part of the CPU, rather than part of the wider SoC design, or something that can be controlled separately from the core kernel and memory management code.
Quoted 7 lines
Quoted 3 lines
Thanks for your advice. I also would like to hear the opinions from other soc&arm maintainers, and then consider whether to add this to
arch/arm64/.Given that all of this is outside of the scope of the architecture, I don't think that
arch/arm64/is the right place for it. Perhaps this would fit into the resctrl rework that James has been doing for MPAM?
Indeed, that sounds like a good starting point. I don't understand enough about either of the two to be sure, but it sounds like there is some overlap in functionality, and ideally we would have one user interface that can deal with all the hardware implementations (intel, arm, fujitsu and any future ones).
Arnd
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
RE: [PATCH RFC] soc: fujitsu: Add cache driver code
Quoted 42 lines · Will Deacon
Quoted 1 line
On Thu, Mar 04, 2021 at 10:34:43AM +0000, [email protected]
Quoted 11 lines · wrote:
Quoted 11 lines
Quoted 11 lines
drivers/soc/fujitsu/Kconfig
Quoted 9 lines · tan.shaopeng
drivers/soc/fujitsu/Kconfig new file +9
-0+ +config FUJITSU_CACHE + tristate "FUJITSU Cache Driver" + depends on ARM64_VHE || COMPILE_TEST + help + FUJITSU Cache Driver + + This driver offers cache functions for A64FX system. + Loading this cache driver, control registers will be set toenable
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ these functions, and advanced settings registers will be set
by
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
default
Quoted 1 line
+ values. After loading this driver, you can use the default
values of
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
the
Quoted 1 line
+ advanced settings registers or set the advanced settings
registers
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ from EL0. Unloading this driver, control registers will be
clear to
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ disable these functions. + When built as a module, this will be called as"
fujitsu_cache".Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
My feeling is that this code should be in
arch/arm64/, as the cache is generally considered part of the CPU, rather than part of the wider SoC design, or something that can be controlled separately from the core kernel and memory management code.Quoted 7 lines
Quoted 3 lines
Thanks for your advice. I also would like to hear the opinions from other soc&arm maintainers, and then consider whether to add this to
arch/arm64/.Given that all of this is outside of the scope of the architecture, I don't think that
arch/arm64/is the right place for it. Perhaps this would fit into the resctrl rework that James has been doing for MPAM?
Quoted 5 lines
Indeed, that sounds like a good starting point. I don't understand enough about either of the two to be sure, but it sounds like there is some overlap in functionality, and ideally we would have one user interface that can deal with all the hardware implementations (intel, arm, fujitsu and any future ones).
I don't know resctrl well and I’m not sure if it can be used for sector cache now. Also, it seems to me that resctrl has no control with hardware prefetch. I will learn more about resctrl.
Best regards,
Tan Shaopeng
RE: [PATCH RFC] soc: fujitsu: Add cache driver code
In reply to Arnd BergmannDear James Morse
Quoted 8 lines
Quoted 3 lines
Given that all of this is outside of the scope of the architecture, I don't think that
arch/arm64/is the right place for it. Perhaps this would fit into the resctrl rework that James has been doing for MPAM?Indeed, that sounds like a good starting point. I don't understand enough about either of the two to be sure, but it sounds like there is some overlap in functionality, and ideally we would have one user interface that can deal with all the hardware implementations (intel, arm, fujitsu and any future ones).
According to my study, it seems possible to add A64FX's sector cache function to resctrl. I heard you are working on resctrl rework for MPAM , but I cannot find related patches on ML archive. Therefore,
I would like to know the status about MPAM support.
(1) I think the first step is to support resctrl for ARM arch. Have you finished the work of arm support and when will you release it?
(2) When will you release MPAM patch?
Best regards
Tan Shaopeng
Re: [PATCH RFC] soc: fujitsu: Add cache driver code
Hi Tan Shaopeng,
Quoted 11 lines · On 31/03/2021 09:52, [email protected] wrote:
Quoted 8 lines
Quoted 3 lines
Given that all of this is outside of the scope of the architecture, I don't think that
arch/arm64/is the right place for it. Perhaps this would fit into the resctrl rework that James has been doing for MPAM?Indeed, that sounds like a good starting point. I don't understand enough about either of the two to be sure, but it sounds like there is some overlap in functionality, and ideally we would have one user interface that can deal with all the hardware implementations (intel, arm, fujitsu and any future ones).
According to my study, it seems possible to add A64FX's sector cache function to resctrl.
I think this depends on whether it maps to one of Intel RDT's existing schema. While adding new ones looks easy, it is bad for user-space as they are not portable between machines that support resctrl.
Quoted 3 lines
I heard you are working on resctrl rework for MPAM , but I cannot find related patches on ML archive. Therefore, I would like to know the status about MPAM support.
Its about five or six series that refactor resctrl inside arch/x86 to have a clear boundary between arch-specific code and the resctrl code that implements the filesystem, then pull it out to /fs/ and build the MPAM driver to make it work for arm64.
Unfortunately, its rather large (>100 patches), so will take some time to be reviewed.
Quoted 2 lines
(1) I think the first step is to support resctrl for ARM arch. Have you finished the work of arm support and when will you release it?
No-one wants a second copy of the code to implement resctrl, as this will introduce subtle bugs that user-space would have to work around, and make it harder to merge later.
The first step is to refactor the arch/x86 implementation of resctrl so that the parts that are visible to user-space can be moved somewhere that is common to multiple architectures.
I've posted the next chunk of that work here:
https://lore.kernel.org/lkml/[email protected]/
Quoted 1 line
(2) When will you release MPAM patch?
The latest complete version of the tree is here:
https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/log/?h=mpam/snapshot/feb
It is over a year old, and has plenty of bugs.
I hope to push a newer version of the branch once I have a complete copy of the tree that has been tested, and is based on the current version of the ACPI table.
Thanks,
James
RE: [PATCH RFC] soc: fujitsu: Add cache driver code
Hi James Morse
Quoted 10 lines · On 31/03/2021 09:52, [email protected] wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Given that all of this is outside of the scope of the architecture, I don't think that
arch/arm64/is the right place for it. Perhaps this would fit into the resctrl rework that James has been doing forMPAM?
Quoted 5 lines
Quoted 5 lines
Indeed, that sounds like a good starting point. I don't understand enough about either of the two to be sure, but it sounds like there is some overlap in functionality, and ideally we would have one user interface that can deal with all the hardware implementations (intel, arm,
Quoted 8 lines
fujitsu and any future ones).
Quoted 2 lines
According to my study, it seems possible to add A64FX's sector cache function to resctrl.
I think this depends on whether it maps to one of Intel RDT's existing schema. While adding new ones looks easy, it is bad for user-space as they are not portable between machines that support resctrl.
Thanks for your advice, I will try finding a way to add the sector cache function in resctrl by using existing schema.
Quoted 29 lines
Quoted 3 lines
I heard you are working on resctrl rework for MPAM , but I cannot find related patches on ML archive. Therefore, I would like to know the status about MPAM support.
Its about five or six series that refactor resctrl inside
arch/x86to have a clear boundary between arch-specific code and the resctrl code that implements the filesystem, then pull it out to /fs/ and build the MPAM driver to make it work for arm64.Unfortunately, its rather large (>100 patches), so will take some time to be reviewed.
Quoted 2 lines
(1) I think the first step is to support resctrl for ARM arch. Have you finished the work of arm support and when will you release it?
No-one wants a second copy of the code to implement resctrl, as this will introduce subtle bugs that user-space would have to work around, and make it harder to merge later.
The first step is to refactor the
arch/x86implementation of resctrl so that the parts that are visible to user-space can be moved somewhere that is common to multiple architectures.I've posted the next chunk of that work here:
https://lore.kernel.org/lkml/[email protected]/Quoted 1 line
(2) When will you release MPAM patch?
Quoted 8 lines
The latest complete version of the tree is here:
https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/log/?h=mpa
m/snapshot/febIt is over a year old, and has plenty of bugs.
I hope to push a newer version of the branch once I have a complete copy of the tree that has been tested, and is based on the current version of the ACPI table.
Thanks for your information. Let me see the patch.
Thanks,
Tan Shaopeng
Re: [PATCH RFC] soc: fujitsu: Add cache driver code
In reply to [email protected]Quoted 34 lines · On Thu, Mar 4, 2021 at 11:34 AM [email protected]…
Quoted 20 lines
Review
Quoted 2 lines · tan.shaopeng
(quoted diff) +2
-0+module_param(tagaddr_ctrl_reg, ulong, 0444); +MODULE_PARM_DESC(tagaddr_ctrl_reg, "HPC tag address overridecontrol register");
Review
Quoted 2 lines
(quoted diff) +2
-0+module_param(hwpf_ctrl_reg, ulong, 0444); +MODULE_PARM_DESC(hwpf_ctrl_reg, "hardware prefetch assist controlregister");
drivers/soc/fujitsu/fujitsu_cache.c
Quoted 6 lines
drivers/soc/fujitsu/fujitsu_cache.c new file +6
-0+module_param (sec_ctrl_reg, ulong,0444 ); +MODULE_PARM_DESC (sec_ctrl_reg,"sector cache control register" ); +module_param (sec_assign_reg, ulong,0444 ); +MODULE_PARM_DESC (sec_assign_reg,"sector cache assign register" ); +module_param (sec_set0_l2_reg, ulong,0444 ); +MODULE_PARM_DESC(sec_set0_l2_reg, "sector cache L2 way
register(sector=0,1)");Review
Quoted 2 lines
(quoted diff) +2
-0+module_param(sec_set1_l2_reg, ulong, 0444); +MODULE_PARM_DESC(sec_set1_l2_reg, "sector cache L2 way
register(sector=2,3)");Quoted 8 lines
My feeling is that the actual settings need to be on a higher level, not tied to the specific register-level implementation of this chip. Normally, the L2 cache is set up by the firmware according to local policy, and the settings can either be read by the kernel from registers or passed down through the device tree. It sounds like you want to control the policy at runtime in the operating system rather than at boot time, so for each setting you wish to override, there should be description of what the setting does and what the purpose of overriding the firmware setting is.
OK, I will change module parameter from specific register-level to a higher level. And, I will modify the description of module parameters. To be clear, we don't suppose these parameters (EL1 registers) are often changed at runtime.
Quoted 6 lines
Quoted 3 lines
Looking at the first one in the list, I see the specification mentions multiple distinct features that can be enabled or disabled, so these should probably get controlled individually.
It is not necessary to enable/disable every feature individually. There are no plans to use these features individually.
Ok, in that case you probably want a smaller number of global settings can describe all the combinations one may need in practice.
Quoted 9 lines
Quoted 4 lines
I also see that it is possible
to control this for TTBR1 and TTBR0 separately, and we probably cannot allow user space (through module parameters or any other interface) to control TTBR1, which is where the kernel resides.This driver does not change the values of TTBR0 and TTBR1, and the values of TCR_EL1.TBI0 and TCR_EL1.TBI1. The cache functions can be used when TBI is already enabled.
Quoted 7 lines
Quoted 4 lines
The TTBR0 settings in turn would seem to interact with
CONFIG_ARM64_MTE, and should not be controlled independently but through the same interfaces as that if we find that it does need to be controlled at all.MTE is not supported on A64FX.
So, this function does not conflict with MTE.
But could you guarantee that no future generation might support both features? In either case, it sounds like the kernel would need to know when this is enabled in the same way: as far as I understand, both of these put extra information into the upper eight bits of a pointer, and any code that interacts with user addresses would need to know about this.
Arnd
RE: [PATCH RFC] soc: fujitsu: Add cache driver code
Quoted 42 lines
Quoted 8 lines · On Thu, Mar 4, 2021 at 11:34 AM [email protected]…
Quoted 8 lines
Review
Quoted 2 lines · tan.shaopeng
(quoted diff) +2
-0+module_param(tagaddr_ctrl_reg, ulong, 0444); +MODULE_PARM_DESC(tagaddr_ctrl_reg, "HPC tag address overridecontrol register");
Review
Quoted 2 lines
(quoted diff) +2
-0+module_param(hwpf_ctrl_reg, ulong, 0444); +MODULE_PARM_DESC(hwpf_ctrl_reg, "hardware prefetch assistcontrol
Quoted 5 lines
Quoted 5 lines
register");
drivers/soc/fujitsu/fujitsu_cache.c
Quoted 4 lines
drivers/soc/fujitsu/fujitsu_cache.c new file +4
-0+module_param (sec_ctrl_reg, ulong,0444 ); +MODULE_PARM_DESC (sec_ctrl_reg,"sector cache control register" ); +module_param (sec_assign_reg, ulong,0444 ); +MODULE_PARM_DESC(sec_assign_reg, "sector cache assignregister");
Quoted 25 lines
Quoted 7 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+module_param(sec_set0_l2_reg, ulong, 0444); +MODULE_PARM_DESC(sec_set0_l2_reg, "sector cache L2 way
register(sector=0,1)");Review
Quoted 2 lines
(quoted diff) +2
-0+module_param(sec_set1_l2_reg, ulong, 0444); +MODULE_PARM_DESC(sec_set1_l2_reg, "sector cache L2 way
register(sector=2,3)");Quoted 8 lines
My feeling is that the actual settings need to be on a higher level, not tied to the specific register-level implementation of this chip. Normally, the L2 cache is set up by the firmware according to local policy, and the settings can either be read by the kernel from registers or passed down through the device tree. It sounds like you want to control the policy at runtime in the operating system rather than at boot time, so for each setting you wish to override, there should be description of what the setting does and what the purpose of overriding the firmware setting is.
OK, I will change module parameter from specific register-level to a higher level. And, I will modify the description of module parameters. To be clear, we don't suppose these parameters (EL1 registers) are often changed at runtime.
Quoted 3 lines
Looking at the first one in the list, I see the specification mentions multiple distinct features that can be enabled or disabled, so these should probably get controlled individually.
Quoted 6 lines
Quoted 2 lines
It is not necessary to enable/disable every feature individually. There are no plans to use these features individually.
Ok, in that case you probably want a smaller number of global settings can describe all the combinations one may need in practice.
Thanks for your advice.
I will consider the optimal module parameters if we end up make a driver.
Quoted 17 lines
Quoted 9 lines
Quoted 4 lines
I also see that it is possible
to control this for TTBR1 and TTBR0 separately, and we probably cannot allow user space (through module parameters or any other interface) to control TTBR1, which is where the kernel resides.This driver does not change the values of TTBR0 and TTBR1, and the values of TCR_EL1.TBI0 and TCR_EL1.TBI1. The cache functions can be used when TBI is already enabled.
Quoted 7 lines
Quoted 4 lines
The TTBR0 settings in turn would seem to interact with
CONFIG_ARM64_MTE, and should not be controlled independently but through the same interfaces as that if we find that it does need to be controlled at all.MTE is not supported on A64FX.
So, this function does not conflict with MTE.
Quoted 6 lines
But could you guarantee that no future generation might support both features? In either case, it sounds like the kernel would need to know when this is enabled in the same way: as far as I understand, both of these put extra information into the upper eight bits of a pointer, and any code that interacts with user addresses would need to know about this.
I think these functions and MTE cannot be enabled
at the same time on hardware level.
Best regards,
Tan Shaopeng