[PATCH v14 06/32] fs/resctrl: Split L3 dependent parts out of __mon_event_count()

Tony Luck posted 32 patches 2 months, 2 weeks ago
There is a newer version of this series
[PATCH v14 06/32] fs/resctrl: Split L3 dependent parts out of __mon_event_count()
Posted by Tony Luck 2 months, 2 weeks ago
Carve out the L3 resource specific event reading code into a separate helper
to support reading event data from a new monitoring resource.

Suggested-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
 fs/resctrl/monitor.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
index 572a9925bd6c..179962a81362 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -413,7 +413,7 @@ static void mbm_cntr_free(struct rdt_mon_domain *d, int cntr_id)
 	memset(&d->cntr_cfg[cntr_id], 0, sizeof(*d->cntr_cfg));
 }
 
-static int __mon_event_count(struct rdtgroup *rdtgrp, struct rmid_read *rr)
+static int __l3_mon_event_count(struct rdtgroup *rdtgrp, struct rmid_read *rr)
 {
 	int cpu = smp_processor_id();
 	u32 closid = rdtgrp->closid;
@@ -494,6 +494,18 @@ static int __mon_event_count(struct rdtgroup *rdtgrp, struct rmid_read *rr)
 	return ret;
 }
 
+static int __mon_event_count(struct rdtgroup *rdtgrp, struct rmid_read *rr)
+{
+	switch (rr->r->rid) {
+	case RDT_RESOURCE_L3:
+		return __l3_mon_event_count(rdtgrp, rr);
+
+	default:
+		rr->err = -EINVAL;
+		return -EINVAL;
+	}
+}
+
 /*
  * mbm_bw_count() - Update bw count from values previously read by
  *		    __mon_event_count().
-- 
2.51.1
Re: [PATCH v14 06/32] fs/resctrl: Split L3 dependent parts out of __mon_event_count()
Posted by Reinette Chatre 2 months, 1 week ago
Hi Tony,

On 11/24/25 10:53 AM, Tony Luck wrote:
> Carve out the L3 resource specific event reading code into a separate helper
> to support reading event data from a new monitoring resource.
> 
> Suggested-by: Reinette Chatre <reinette.chatre@intel.com>
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
>  fs/resctrl/monitor.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
> index 572a9925bd6c..179962a81362 100644
> --- a/fs/resctrl/monitor.c
> +++ b/fs/resctrl/monitor.c
> @@ -413,7 +413,7 @@ static void mbm_cntr_free(struct rdt_mon_domain *d, int cntr_id)
>  	memset(&d->cntr_cfg[cntr_id], 0, sizeof(*d->cntr_cfg));
>  }
>  
> -static int __mon_event_count(struct rdtgroup *rdtgrp, struct rmid_read *rr)
> +static int __l3_mon_event_count(struct rdtgroup *rdtgrp, struct rmid_read *rr)
>  {
>  	int cpu = smp_processor_id();
>  	u32 closid = rdtgrp->closid;
> @@ -494,6 +494,18 @@ static int __mon_event_count(struct rdtgroup *rdtgrp, struct rmid_read *rr)
>  	return ret;
>  }
>  
> +static int __mon_event_count(struct rdtgroup *rdtgrp, struct rmid_read *rr)
> +{
> +	switch (rr->r->rid) {
> +	case RDT_RESOURCE_L3:
> +		return __l3_mon_event_count(rdtgrp, rr);
> +

unnecessary empty line

> +	default:
> +		rr->err = -EINVAL;
> +		return -EINVAL;
> +	}
> +}
> +
>  /*
>   * mbm_bw_count() - Update bw count from values previously read by
>   *		    __mon_event_count().

| Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>

Reinette