Re: [PATCH v7 44/49] x86/resctrl: Relax some asm #includes

Fenghua Yu
2025-03-07T02:51:10Z

Hi, James and Dave,

On 2/28/25 11:59, James Morse wrote:
> From: Dave Martin <Dave.Martin@arm.com>
>
> checkpatch.pl identifies some direct #includes of asm headers that
> can be satisfied by including the corresponding <linux/...> header
> instead.
>
> Fix them.
>
> No intentional functional change.

The commit message doesn't mention the rid code changes? Maybe add the
message or remove the rid code changes (which are not essential in this
patch set any way)?

> Signed-off-by: Dave Martin <Dave.Martin@arm.com>
> Signed-off-by: James Morse <james.morse@arm.com>
> ---
> Changes since v6:
> * This patch is new.
>
> Changes since v2:
> * asm->linux for resctrl.h moved into an earlier patch.
> ---
> arch/x86/kernel/cpu/resctrl/core.c | 10 +++++-----
> arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 3 ++-
> 2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
> index 93b51d522bc7..6ed0d4f5d6a3 100644
> --- a/arch/x86/kernel/cpu/resctrl/core.c
> +++ b/arch/x86/kernel/cpu/resctrl/core.c
> @@ -60,7 +60,6 @@ struct rdt_hw_resource rdt_resources_all[RDT_NUM_RESOURCES] = {
> [RDT_RESOURCE_L3] =
> {
> .r_resctrl = {
> - .rid = RDT_RESOURCE_L3,
> .name = "L3",
> .ctrl_scope = RESCTRL_L3_CACHE,
> .mon_scope = RESCTRL_L3_CACHE,
> @@ -74,7 +73,6 @@ struct rdt_hw_resource rdt_resources_all[RDT_NUM_RESOURCES] = {
> [RDT_RESOURCE_L2] =
> {
> .r_resctrl = {
> - .rid = RDT_RESOURCE_L2,
> .name = "L2",
> .ctrl_scope = RESCTRL_L2_CACHE,
> .ctrl_domains = ctrl_domain_init(RDT_RESOURCE_L2),
> @@ -86,7 +84,6 @@ struct rdt_hw_resource rdt_resources_all[RDT_NUM_RESOURCES] = {
> [RDT_RESOURCE_MBA] =
> {
> .r_resctrl = {
> - .rid = RDT_RESOURCE_MBA,
> .name = "MB",
> .ctrl_scope = RESCTRL_L3_CACHE,
> .ctrl_domains = ctrl_domain_init(RDT_RESOURCE_MBA),
> @@ -96,7 +93,6 @@ struct rdt_hw_resource rdt_resources_all[RDT_NUM_RESOURCES] = {
> [RDT_RESOURCE_SMBA] =
> {
> .r_resctrl = {
> - .rid = RDT_RESOURCE_SMBA,
> .name = "SMBA",
> .ctrl_scope = RESCTRL_L3_CACHE,
> .ctrl_domains = ctrl_domain_init(RDT_RESOURCE_SMBA),
> @@ -998,7 +994,11 @@ void resctrl_cpu_detect(struct cpuinfo_x86 *c)
> static int __init resctrl_arch_late_init(void)
> {
> struct rdt_resource *r;
> - int state, ret;
> + int state, ret, i;
> +
> + /* Initialise all rid values for_each_rdt_resource() */
> + for (i = 0; i < RDT_NUM_RESOURCES; i++)
> + rdt_resources_all[i].r_resctrl.rid = i;
>
> /*
> * Initialize functions(or definitions) that are different
> diff --git a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c
> index 69dff2bb2c09..5ed9ece12de0 100644
> --- a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c
> +++ b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c
> @@ -11,6 +11,8 @@
>
> #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>
> +#include <linux/cacheflush.h>
> +#include <linux/cacheinfo.h>
> #include <linux/cpu.h>
> #include <linux/cpumask.h>
> #include <linux/debugfs.h>
> @@ -22,7 +24,6 @@
> #include <linux/slab.h>
> #include <linux/uaccess.h>
>
> -#include <asm/cacheflush.h>
> #include <asm/cpu_device_id.h>
> #include <asm/perf_event.h>
>

Thanks.

-Fenghua