Skip to contentSkip to conversation

arm_mpam: resctrl: Catch and propagate error from get_cpu_cacheinfo_id()

PATCH In review Andre Przywara 4 participants 13 messages Sep 2 – Sep 17 MPAM driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm_mpam: resctrl: Catch and propagate error from get_cpu_cacheinfo_id()

get_cpu_cacheinfo_id() can fail, in which case it returns a negative error value.

Check the returned value for this error condition, before passing the value on to other code, which would hide the negative number in some high value in the unsigned type.

Fixes 36528c7681b8 ("arm_mpam: resctrl: Add support for 'MB' resource")
---
 drivers/resctrl/mpam_resctrl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/resctrl/mpam_resctrl.c +4 -1
index 9d223057953ab..a5e661eff86d7 100644
@@ -786,7 +786,10 @@ static u32 get_mba_min(struct mpam_props *cprops)
 /* Find the L3 cache that has affinity with this CPU */
 static int find_l3_equivalent_bitmask(int cpu, cpumask_var_t tmp_cpumask)
 {
-	u32 cache_id = get_cpu_cacheinfo_id(cpu, 3);
+	int cache_id = get_cpu_cacheinfo_id(cpu, 3);
+
+	if (cache_id < 0)
+		return -ENOENT;
 
 	lockdep_assert_cpus_held();
 
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi Andre,

Quoted 9 lines · Andre Przywara

get_cpu_cacheinfo_id() can fail, in which case it returns a negative error value.

Check the returned value for this error condition, before passing the value on to other code, which would hide the negative number in some high value in the unsigned type.

Fixes 36528c7681b8 ("arm_mpam: resctrl: Add support for 'MB' resource")

This looks good to me. Out of interest what led you to find this?

Thanks,

Ben

Quoted 20 lines
---
 drivers/resctrl/mpam_resctrl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/resctrl/mpam_resctrl.c +4 -1
index 9d223057953ab..a5e661eff86d7 100644
@@ -786,7 +786,10 @@ static u32 get_mba_min(struct mpam_props *cprops)
 /* Find the L3 cache that has affinity with this CPU */
 static int find_l3_equivalent_bitmask(int cpu, cpumask_var_t tmp_cpumask)
 {
-	u32 cache_id = get_cpu_cacheinfo_id(cpu, 3);
+	int cache_id = get_cpu_cacheinfo_id(cpu, 3);
+
+	if (cache_id < 0)
+		return -ENOENT;
 
 	lockdep_assert_cpus_held();
 
#2 lore raw

Hi Ben,

thanks for having a look!

Quoted 6 lines · Ben Horgan

Hi Andre,

Quoted 3 lines · Andre Przywara

get_cpu_cacheinfo_id() can fail, in which case it returns a negative error value.

Quoted 8 lines
Quoted 6 lines

Check the returned value for this error condition, before passing the value on to other code, which would hide the negative number in some high value in the unsigned type.

Fixes 36528c7681b8 ("arm_mpam: resctrl: Add support for 'MB' resource")

This looks good to me. Out of interest what led you to find this?

For Yin Li's RFC patch [06/15], I was looking around to find the proper type for cache-id, and stumbled upon this.

Quoted 1 line

Thanks!

Cheers,
Andre

Quoted 26 lines

Thanks,

Ben

Quoted 20 lines
---
  drivers/resctrl/mpam_resctrl.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/resctrl/mpam_resctrl.c +4 -1
index 9d223057953ab..a5e661eff86d7 100644
@@ -786,7 +786,10 @@ static u32 get_mba_min(struct mpam_props *cprops)
  /* Find the L3 cache that has affinity with this CPU */
  static int find_l3_equivalent_bitmask(int cpu, cpumask_var_t tmp_cpumask)
  {
-	u32 cache_id = get_cpu_cacheinfo_id(cpu, 3);
+	int cache_id = get_cpu_cacheinfo_id(cpu, 3);
+
+	if (cache_id < 0)
+		return -ENOENT;
 
  	lockdep_assert_cpus_held();
 
maintainer
#3 lore raw
In reply to Ben Horgan

Hi Andre,

Quoted 10 lines · Ben Horgan

Hi Andre,

Quoted 7 lines · Andre Przywara

get_cpu_cacheinfo_id() can fail, in which case it returns a negative error value.

Check the returned value for this error condition, before passing the value on to other code, which would hide the negative number in some high value in the unsigned type.

Quoted 6 lines
Quoted 2 lines
Fixes 36528c7681b8 ("arm_mpam: resctrl: Add support for 'MB' resource")

This looks good to me. Out of interest what led you to find this?

I seem to have been a bit hasty here.

Sashiko points out at [1] that 0xFFFFFFFF is the only value we were previously considering invalid and that the value coming from dt or acpi can provid other valid values that would after this patch be considered invalid.

[1] https://sashiko.dev/#/patchset/20260902143757.3469690-1-andre.przywara%40arm.com

Thanks,

Ben>

Quoted 26 lines

Thanks,

Ben

Quoted 20 lines
---
 drivers/resctrl/mpam_resctrl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/resctrl/mpam_resctrl.c +4 -1
index 9d223057953ab..a5e661eff86d7 100644
@@ -786,7 +786,10 @@ static u32 get_mba_min(struct mpam_props *cprops)
 /* Find the L3 cache that has affinity with this CPU */
 static int find_l3_equivalent_bitmask(int cpu, cpumask_var_t tmp_cpumask)
 {
-	u32 cache_id = get_cpu_cacheinfo_id(cpu, 3);
+	int cache_id = get_cpu_cacheinfo_id(cpu, 3);
+
+	if (cache_id < 0)
+		return -ENOENT;
 
 	lockdep_assert_cpus_held();
 
#4 lore raw
Quoted 20 lines · Ben Horgan

Hi Andre,

Quoted 10 lines · Ben Horgan

Hi Andre,

Quoted 7 lines · Andre Przywara

get_cpu_cacheinfo_id() can fail, in which case it returns a negative error value.

Check the returned value for this error condition, before passing the value on to other code, which would hide the negative number in some high value in the unsigned type.

Quoted 6 lines
Quoted 2 lines
Fixes 36528c7681b8 ("arm_mpam: resctrl: Add support for 'MB' resource")

This looks good to me. Out of interest what led you to find this?

Quoted 8 lines

I seem to have been a bit hasty here.

Sashiko points out at [1] that 0xFFFFFFFF is the only value we were previously considering invalid and that the value coming from dt or acpi can provid other valid values that would after this patch be considered invalid.

[1] https://sashiko.dev/#/patchset/20260902143757.3469690-1-andre.przywara%40arm.com

I think Sashiko is correct that the check 'if (cache_id < 0) return -ENOENT' is incorrect because only -1 is a invalid ID. The correct check would be:

	u32 cache_id = get_cpu_cacheinfo_id(cpu, 3);

	if (cache_id = UINT_MAX)
		return -ENOENT;

Or

	int cache_id = get_cpu_cacheinfo_id(cpu, 3);

	if (cache_id == -1)
		return -ENOENT;

Thanks,
Gavin

Quoted 31 lines

Thanks,

Ben>

Quoted 26 lines

Thanks,

Ben

Quoted 20 lines
---
  drivers/resctrl/mpam_resctrl.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/resctrl/mpam_resctrl.c +4 -1
index 9d223057953ab..a5e661eff86d7 100644
@@ -786,7 +786,10 @@ static u32 get_mba_min(struct mpam_props *cprops)
  /* Find the L3 cache that has affinity with this CPU */
  static int find_l3_equivalent_bitmask(int cpu, cpumask_var_t tmp_cpumask)
  {
-	u32 cache_id = get_cpu_cacheinfo_id(cpu, 3);
+	int cache_id = get_cpu_cacheinfo_id(cpu, 3);
+
+	if (cache_id < 0)
+		return -ENOENT;
 
  	lockdep_assert_cpus_held();
 
#5 lore raw
In reply to Ben Horgan

Hi,

Quoted 18 lines · Ben Horgan

Hi Andre,

Quoted 15 lines · Ben Horgan

Hi Andre,

Quoted 9 lines · Andre Przywara

get_cpu_cacheinfo_id() can fail, in which case it returns a negative error value.

Check the returned value for this error condition, before passing the value on to other code, which would hide the negative number in some high value in the unsigned type.

Fixes 36528c7681b8 ("arm_mpam: resctrl: Add support for 'MB' resource")

This looks good to me. Out of interest what led you to find this?

Quoted 7 lines
Quoted 1 line

I seem to have been a bit hasty here.

Sashiko points out at [1] that 0xFFFFFFFF is the only value we were previously considering invalid and that the value coming from dt or acpi can provid other valid values that would after this patch be considered invalid.

Fair, and I can easily change the check to only check explicitly for -1.

But this is somewhat broken already, right? I mean the return type for the existing get_cpu_cacheinfo_id() has always been "int". It looks like this comes from the x86 world, where the cache IDs never get that large? I can have a deeper look, but my gut feeling is that this is practically irrelevant, since we barely see Aff3 at all, not to mention high values of it.

Cheers,
Andre

Quoted 33 lines

[1] https://sashiko.dev/#/patchset/20260902143757.3469690-1-andre.przywara%40arm.com

Thanks,

Ben>

Quoted 26 lines

Thanks,

Ben

Quoted 20 lines
---
  drivers/resctrl/mpam_resctrl.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/resctrl/mpam_resctrl.c +4 -1
index 9d223057953ab..a5e661eff86d7 100644
@@ -786,7 +786,10 @@ static u32 get_mba_min(struct mpam_props *cprops)
  /* Find the L3 cache that has affinity with this CPU */
  static int find_l3_equivalent_bitmask(int cpu, cpumask_var_t tmp_cpumask)
  {
-	u32 cache_id = get_cpu_cacheinfo_id(cpu, 3);
+	int cache_id = get_cpu_cacheinfo_id(cpu, 3);
+
+	if (cache_id < 0)
+		return -ENOENT;
 
  	lockdep_assert_cpus_held();
 
maintainer
#6 lore raw

Hi Andre,

Quoted 29 lines · Andre Przywara

Hi,

Quoted 18 lines · Ben Horgan

Hi Andre,

Quoted 15 lines · Ben Horgan

Hi Andre,

Quoted 9 lines · Andre Przywara

get_cpu_cacheinfo_id() can fail, in which case it returns a negative error value.

Check the returned value for this error condition, before passing the value on to other code, which would hide the negative number in some high value in the unsigned type.

Fixes 36528c7681b8 ("arm_mpam: resctrl: Add support for 'MB' resource")

This looks good to me. Out of interest what led you to find this?

Quoted 7 lines
Quoted 1 line

I seem to have been a bit hasty here.

Sashiko points out at [1] that 0xFFFFFFFF is the only value we were previously considering invalid and that the value coming from dt or acpi can provid other valid values that would after this patch be considered invalid.

Quoted 5 lines

Fair, and I can easily change the check to only check explicitly for -1.

But this is somewhat broken already, right? I mean the return type for the existing get_cpu_cacheinfo_id() has always been "int". It looks like this comes from the x86 world, where the cache IDs never get that large? I can have a deeper look, but my gut feeling is that this is

The cache_id being in the PPTT table is a fairly new addition introduced for PPTT table version 3 and introduced to drivers/acpi/pptt.c as part of the preparations for the MPAM driver at the end of 2025. At this point, it seems I neglected to consider any potential effect on get_cpu_cacheinfo_id(). The pptt cacheid takes any u32 value apart from 0. I haven't joined all the dots but I expect there might be some tidying up needed in this area.

Quoted 1 line

practically irrelevant, since we barely see Aff3 at all, not to mention high values of it.

Does Aff3 effect the cache id on acpi systems?

Thanks,

Ben>

Quoted 36 lines

Cheers,
Andre

Quoted 32 lines

[1] https://sashiko.dev/#/patchset/20260902143757.3469690-1-andre.przywara%40arm.com

Thanks,

Ben>

Quoted 25 lines

Thanks,

Ben

Quoted 19 lines

---
  drivers/resctrl/mpam_resctrl.c | 5 ++++-

  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/resctrl/mpam_resctrl.c +4 -1
index 9d223057953ab..a5e661eff86d7 100644
@@ -786,7 +786,10 @@ static u32 get_mba_min(struct mpam_props *cprops)
   /* Find the L3 cache that has affinity with this CPU */
   static int find_l3_equivalent_bitmask(int cpu, cpumask_var_t tmp_cpumask)
   {
-    u32 cache_id = get_cpu_cacheinfo_id(cpu, 3);
+    int cache_id = get_cpu_cacheinfo_id(cpu, 3);
+
+    if (cache_id < 0)
+        return -ENOENT;
         lockdep_assert_cpus_held();

#7 lore raw
In reply to Andre Przywara
Quoted 19 lines · Andre Przywara
Quoted 18 lines · Ben Horgan
Quoted 8 lines · Ben Horgan
Quoted 7 lines · Andre Przywara

get_cpu_cacheinfo_id() can fail, in which case it returns a negative error value.

Check the returned value for this error condition, before passing the value on to other code, which would hide the negative number in some high value in the unsigned type.

Quoted 6 lines
Quoted 2 lines
Fixes 36528c7681b8 ("arm_mpam: resctrl: Add support for 'MB' resource")

This looks good to me. Out of interest what led you to find this?

I seem to have been a bit hasty here.

Quoted 8 lines
Quoted 3 lines

Sashiko points out at [1] that 0xFFFFFFFF is the only value we were previously considering invalid and that the value coming from dt or acpi can provid other valid values that would after this patch be considered invalid.

Fair, and I can easily change the check to only check explicitly for -1.

But this is somewhat broken already, right? I mean the return type for the existing get_cpu_cacheinfo_id() has always been "int". It looks like this comes from the x86 world, where the cache IDs never get that large? I can have a deeper look, but my gut feeling is that this is practically irrelevant, since we barely see Aff3 at all, not to mention high values of it.

I guess we also can exploit CACHE_ID flag in struct cacheinfo::attributes. struct cacheinfo::id is valid only when CACHE_ID flag is set. So we would introduce our own helper as below, where an extra return value to indicate the (returned) cached ID is valid or not.

In drivers/resctrl/mpam_internal.h:

/* NULL is returned if struct cacheinfo::attributes don't have CACHE_ID set */ static inline bool mpam_cpu_cache_id(int cpu, int level, unsigned int *id)

{
        struct cacheinfo *ci = get_cpu_cacheinfo_level(cpu, level);

        if (!ci)
                return false;
        
        if (id)
                *id = ci->id;
        
        return true;
}

Thanks,
Gavin

Reviewed-by on v1 1/1
#8 lore raw
In reply to Andre Przywara
Quoted 19 lines · Andre Przywara

get_cpu_cacheinfo_id() can fail, in which case it returns a negative error value.

Check the returned value for this error condition, before passing the value on to other code, which would hide the negative number in some high value in the unsigned type.

Fixes 36528c7681b8 ("arm_mpam: resctrl: Add support for 'MB' resource")
---
  drivers/resctrl/mpam_resctrl.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/resctrl/mpam_resctrl.c +0 -0
index 9d223057953ab..a5e661eff86d7 100644
@@ -786,7 +786,10 @@ static u32 get_mba_min(struct mpam_props *cprops)
  /* Find the L3 cache that has affinity with this CPU */

drivers/resctrl/mpam_resctrl.c static u32 get_mba_min(struct mpam_props *cprops) · line 795

Quoted 10 lines
drivers/resctrl/mpam_resctrl.c +4 -1
  static int find_l3_equivalent_bitmask(int cpu, cpumask_var_t tmp_cpumask)
  {
-	u32 cache_id = get_cpu_cacheinfo_id(cpu, 3);
+	int cache_id = get_cpu_cacheinfo_id(cpu, 3);
+
+	if (cache_id < 0)
+		return -ENOENT;
 
  	lockdep_assert_cpus_held();
 

Hi Andre

This looks good to me.

Signature · 2 lines
Thx and BRs,
Yin
Reviewed-by on v1 1/1
#9 lore raw
In reply to Andre Przywara
Quoted 7 lines · Andre Przywara

get_cpu_cacheinfo_id() can fail, in which case it returns a negative error value.

Check the returned value for this error condition, before passing the value on to other code, which would hide the negative number in some high value in the unsigned type.

Quoted 6 lines
Fixes 36528c7681b8 ("arm_mpam: resctrl: Add support for 'MB' resource")
---
  drivers/resctrl/mpam_resctrl.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 6 lines
drivers/resctrl/mpam_resctrl.c +0 -0
index 9d223057953ab..a5e661eff86d7 100644
@@ -786,7 +786,10 @@ static u32 get_mba_min(struct mpam_props *cprops)
  /* Find the L3 cache that has affinity with this CPU */

drivers/resctrl/mpam_resctrl.c static u32 get_mba_min(struct mpam_props *cprops) · line 795

Quoted 10 lines
drivers/resctrl/mpam_resctrl.c +4 -1
  static int find_l3_equivalent_bitmask(int cpu, cpumask_var_t tmp_cpumask)
  {
-	u32 cache_id = get_cpu_cacheinfo_id(cpu, 3);
+	int cache_id = get_cpu_cacheinfo_id(cpu, 3);
+
+	if (cache_id < 0)
+		return -ENOENT;
 
  	lockdep_assert_cpus_held();
 

find_l3_equivalent_bitmask() passes @cache_id to find_l3_equivalent_bitmask() as a 'unsigned long' argument. Actually, it can be 'u32'. It's not directly related to this patch though.

int mpam_get_cpumask_from_cache_id(unsigned long cache_id, ...);

can be:

int mpam_get_cpumask_from_cache_id(u32 cache_id, ...);

Thanks,
Gavin

#10 lore raw
Quoted 36 lines · Gavin Shan
Quoted 7 lines · Andre Przywara

get_cpu_cacheinfo_id() can fail, in which case it returns a negative error value.

Check the returned value for this error condition, before passing the value on to other code, which would hide the negative number in some high value in the unsigned type.

Quoted 6 lines
Fixes 36528c7681b8 ("arm_mpam: resctrl: Add support for 'MB' resource")

---
  drivers/resctrl/mpam_resctrl.c | 5 ++++-

  1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 5 lines
drivers/resctrl/mpam_resctrl.c +0 -0
index 9d223057953ab..a5e661eff86d7 100644

drivers/resctrl/mpam_resctrl.c static u32 get_mba_min(struct mpam_props *cprops) · line 793

Quoted 9 lines
drivers/resctrl/mpam_resctrl.c +4 -1
@@ -786,7 +786,10 @@ static u32 get_mba_min(struct mpam_props *cprops)
   /* Find the L3 cache that has affinity with this CPU */
   static int find_l3_equivalent_bitmask(int cpu, cpumask_var_t tmp_cpumask)
   {
-    u32 cache_id = get_cpu_cacheinfo_id(cpu, 3);
+    int cache_id = get_cpu_cacheinfo_id(cpu, 3);
+
+    if (cache_id < 0)
+        return -ENOENT;
       lockdep_assert_cpus_held();

find_l3_equivalent_bitmask() passes @cache_id to find_l3_equivalent_bitmask() as a 'unsigned long' argument. Actually, it can be 'u32'. It's not directly related to this patch though.

Quoted 6 lines

int mpam_get_cpumask_from_cache_id(unsigned long cache_id, ...);

can be:

int mpam_get_cpumask_from_cache_id(u32 cache_id, ...);

Hi Gavin,

Thanks for pointing this out. I've made exactly this change in my MPAM DT series (v2, in preparation) — mpam_get_cpumask_from_cache_id() is changed from unsigned long to u32 there, along with the related cache-id variables.
https://lore.kernel.org/all/20260811-mpam-resctrl-dt-knp-support-v1-6-ea6397bead59@oss.qualcomm.com/

I'm about to post v2 of that series and will make sure you're on Cc, in case you'd like to take a look.

Thanks,
Yin

Quoted 3 lines

Thanks,
Gavin

Signature · 2 lines
Thx and BRs,
Yin
#11 lore raw

Hi Yin,

Quoted 46 lines · Yin Li
Quoted 36 lines · Gavin Shan
Quoted 7 lines · Andre Przywara

get_cpu_cacheinfo_id() can fail, in which case it returns a negative error value.

Check the returned value for this error condition, before passing the value on to other code, which would hide the negative number in some high value in the unsigned type.

Quoted 6 lines
Fixes 36528c7681b8 ("arm_mpam: resctrl: Add support for 'MB' resource")

---
  drivers/resctrl/mpam_resctrl.c | 5 ++++-

  1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 5 lines
drivers/resctrl/mpam_resctrl.c +0 -0
index 9d223057953ab..a5e661eff86d7 100644

drivers/resctrl/mpam_resctrl.c static u32 get_mba_min(struct mpam_props *cprops) · line 793

Quoted 9 lines
drivers/resctrl/mpam_resctrl.c +4 -1
@@ -786,7 +786,10 @@ static u32 get_mba_min(struct mpam_props *cprops)
   /* Find the L3 cache that has affinity with this CPU */
   static int find_l3_equivalent_bitmask(int cpu, cpumask_var_t tmp_cpumask)
   {
-    u32 cache_id = get_cpu_cacheinfo_id(cpu, 3);
+    int cache_id = get_cpu_cacheinfo_id(cpu, 3);
+
+    if (cache_id < 0)
+        return -ENOENT;
       lockdep_assert_cpus_held();

find_l3_equivalent_bitmask() passes @cache_id to find_l3_equivalent_bitmask() as a 'unsigned long' argument. Actually, it can be 'u32'. It's not directly related to this patch though.

Quoted 6 lines

int mpam_get_cpumask_from_cache_id(unsigned long cache_id, ...);

can be:

int mpam_get_cpumask_from_cache_id(u32 cache_id, ...);

Hi Gavin,

Quoted 9 lines

Thanks for pointing this out. I've made exactly this change in my MPAM DT series (v2, in preparation) — mpam_get_cpumask_from_cache_id() is changed from unsigned long to u32 there, along with the related cache-id variables.
https://lore.kernel.org/all/20260811-mpam-resctrl-dt-knp-support-v1-6-ea6397bead59@oss.qualcomm.com/

I'm about to post v2 of that series and will make sure you're on Cc, in case you'd like to take a look.

Thanks for head-up, please keep me on the cc list. I would like to review if I get bandwidth, but no promise :)

I noticed RFCv1 series of DT support for MPAM was posted to [email protected] instead of [email protected]. Since MPAM is a arm64 feature, it's reasonable to post the patches to [email protected] at the same time.

MAINTAINERS doesn't indicates a maillist for MPAM patches in section "MPAM DRIVER". I guess it would be something worthy to be added.

Thanks,
Gavin

#12 lore raw
Quoted 55 lines · Gavin Shan

Hi Yin,

Quoted 52 lines · Yin Li
Quoted 36 lines · Gavin Shan
Quoted 7 lines · Andre Przywara

get_cpu_cacheinfo_id() can fail, in which case it returns a negative error value.

Check the returned value for this error condition, before passing the value on to other code, which would hide the negative number in some high value in the unsigned type.

Quoted 6 lines
Fixes 36528c7681b8 ("arm_mpam: resctrl: Add support for 'MB' resource")

---
  drivers/resctrl/mpam_resctrl.c | 5 ++++-

  1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 5 lines
drivers/resctrl/mpam_resctrl.c +0 -0
index 9d223057953ab..a5e661eff86d7 100644

drivers/resctrl/mpam_resctrl.c static u32 get_mba_min(struct mpam_props *cprops) · line 793

Quoted 9 lines
drivers/resctrl/mpam_resctrl.c +4 -1
@@ -786,7 +786,10 @@ static u32 get_mba_min(struct mpam_props *cprops)
   /* Find the L3 cache that has affinity with this CPU */
   static int find_l3_equivalent_bitmask(int cpu, cpumask_var_t tmp_cpumask)
   {
-    u32 cache_id = get_cpu_cacheinfo_id(cpu, 3);
+    int cache_id = get_cpu_cacheinfo_id(cpu, 3);
+
+    if (cache_id < 0)
+        return -ENOENT;
       lockdep_assert_cpus_held();

find_l3_equivalent_bitmask() passes @cache_id to find_l3_equivalent_bitmask() as a 'unsigned long' argument. Actually, it can be 'u32'. It's not directly related to this patch though.

Quoted 6 lines

int mpam_get_cpumask_from_cache_id(unsigned long cache_id, ...);

can be:

int mpam_get_cpumask_from_cache_id(u32 cache_id, ...);

Hi Gavin,

Thanks for pointing this out. I've made exactly this change in my MPAM
DT series (v2, in preparation) — mpam_get_cpumask_from_cache_id() is
changed from unsigned long to u32 there, along with the related cache-id
variables.
https://lore.kernel.org/all/20260811-mpam-resctrl-dt-knp-support-v1-6- [email protected]/

Quoted 7 lines
Quoted 3 lines

I'm about to post v2 of that series and will make sure you're on Cc, in case you'd like to take a look.

Thanks for head-up, please keep me on the cc list. I would like to review if I get bandwidth, but no promise :)

Hi Gavin,

Thanks, will keep you on Cc for v2.

Quoted 4 lines

I noticed RFCv1 series of DT support for MPAM was posted to linux- [email protected] instead of [email protected]. Since MPAM is a arm64 feature, it's reasonable to post the patches to [email protected] at the same time.

Good point on linux-arm-kernel — I'll make sure v2 goes to [email protected] as well.

Quoted 3 lines

MAINTAINERS doesn't indicates a maillist for MPAM patches in section "MPAM DRIVER". I guess it would be something worthy to be added.

And agreed that the MPAM DRIVER entry in MAINTAINERS is missing an "L:" mailing list, which is likely why get_maintainer.pl didn't pick up linux-arm-kernel. I'll note this in the v2 cover letter so the MPAM maintainers can decide whether to add it.

Thx and BRs,
Yin

Quoted 4 lines

Thanks,
Gavin

Signature · 2 lines
Thx and BRs,
Yin