public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] arm_mpam: resctrl: mpam resctrl glue code fixes
@ 2026-04-14 13:27 Ben Horgan
  2026-04-14 13:27 ` [PATCH v1 1/2] arm_mpam: resctrl: Fix broken error path in mpam_resctrl_alloc_domain() Ben Horgan
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Ben Horgan @ 2026-04-14 13:27 UTC (permalink / raw)
  To: ben.horgan
  Cc: Dan Carpenter, Dan Carpenter, James Morse, Reinette Chatre,
	Fenghua Yu, lkml, linux-arm-kernel

A couple of minor fixes for the new mpam resctrl glue code. These fix
a sparse warning and and use of an unitialized variable in an
unexpected error case.

Thanks for the bug reports.

Based on arm64 for-next/mpam.
git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/mpam

Ben Horgan (2):
  arm_mpam: resctrl: Fix the check for no monitor components found
  arm_mpam: resctrl: Make resctrl_mon_ctx_waiters static

 drivers/resctrl/mpam_resctrl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.43.0



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 1/2] arm_mpam: resctrl: Fix broken error path in mpam_resctrl_alloc_domain()
  2026-04-14 13:27 [PATCH v1 0/2] arm_mpam: resctrl: mpam resctrl glue code fixes Ben Horgan
@ 2026-04-14 13:27 ` Ben Horgan
  2026-04-14 13:31   ` Ben Horgan
  2026-04-14 13:27 ` [PATCH v1 1/2] arm_mpam: resctrl: Fix the check for no monitor components found Ben Horgan
  2026-04-14 13:27 ` [PATCH v1 2/2] arm_mpam: resctrl: Make resctrl_mon_ctx_waiters static Ben Horgan
  2 siblings, 1 reply; 7+ messages in thread
From: Ben Horgan @ 2026-04-14 13:27 UTC (permalink / raw)
  To: ben.horgan
  Cc: Dan Carpenter, Dan Carpenter, James Morse, Reinette Chatre,
	Fenghua Yu, lkml, linux-arm-kernel

Dan Carpenter reports that, in mpam_resctrl_alloc_domain(), any_mon_comp is
used in an 'if' condition when it may be uninitialized. Initialize it to
NULL so that the check behaves correctly when no monitor components are
found.

Reported-by: Dan Carpenter <error27@gmail.com>
Fixes: 264c285999fc ("arm_mpam: resctrl: Add monitor initialisation and domain boilerplate")
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
 drivers/resctrl/mpam_resctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index a9938006d0e6..d80df486a313 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -1399,7 +1399,7 @@ mpam_resctrl_alloc_domain(unsigned int cpu, struct mpam_resctrl_res *res)
 	}
 
 	if (r->mon_capable) {
-		struct mpam_component *any_mon_comp;
+		struct mpam_component *any_mon_comp = NULL;
 		struct mpam_resctrl_mon *mon;
 		enum resctrl_event_id eventid;
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 1/2] arm_mpam: resctrl: Fix the check for no monitor components found
  2026-04-14 13:27 [PATCH v1 0/2] arm_mpam: resctrl: mpam resctrl glue code fixes Ben Horgan
  2026-04-14 13:27 ` [PATCH v1 1/2] arm_mpam: resctrl: Fix broken error path in mpam_resctrl_alloc_domain() Ben Horgan
@ 2026-04-14 13:27 ` Ben Horgan
  2026-04-14 23:08   ` Gavin Shan
  2026-04-14 13:27 ` [PATCH v1 2/2] arm_mpam: resctrl: Make resctrl_mon_ctx_waiters static Ben Horgan
  2 siblings, 1 reply; 7+ messages in thread
From: Ben Horgan @ 2026-04-14 13:27 UTC (permalink / raw)
  To: ben.horgan
  Cc: Dan Carpenter, Dan Carpenter, James Morse, Reinette Chatre,
	Fenghua Yu, lkml, linux-arm-kernel

Dan Carpenter reports that, in mpam_resctrl_alloc_domain(), any_mon_comp is
used in an 'if' condition when it may be uninitialized. Initialize it to
NULL so that the check behaves correctly when no monitor components are
found.

Reported-by: Dan Carpenter <error27@gmail.com>
Fixes: 264c285999fc ("arm_mpam: resctrl: Add monitor initialisation and domain boilerplate")
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
 drivers/resctrl/mpam_resctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index a9938006d0e6..d80df486a313 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -1399,7 +1399,7 @@ mpam_resctrl_alloc_domain(unsigned int cpu, struct mpam_resctrl_res *res)
 	}
 
 	if (r->mon_capable) {
-		struct mpam_component *any_mon_comp;
+		struct mpam_component *any_mon_comp = NULL;
 		struct mpam_resctrl_mon *mon;
 		enum resctrl_event_id eventid;
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 2/2] arm_mpam: resctrl: Make resctrl_mon_ctx_waiters static
  2026-04-14 13:27 [PATCH v1 0/2] arm_mpam: resctrl: mpam resctrl glue code fixes Ben Horgan
  2026-04-14 13:27 ` [PATCH v1 1/2] arm_mpam: resctrl: Fix broken error path in mpam_resctrl_alloc_domain() Ben Horgan
  2026-04-14 13:27 ` [PATCH v1 1/2] arm_mpam: resctrl: Fix the check for no monitor components found Ben Horgan
@ 2026-04-14 13:27 ` Ben Horgan
  2026-04-14 23:09   ` Gavin Shan
  2 siblings, 1 reply; 7+ messages in thread
From: Ben Horgan @ 2026-04-14 13:27 UTC (permalink / raw)
  To: ben.horgan
  Cc: Dan Carpenter, Dan Carpenter, James Morse, Reinette Chatre,
	Fenghua Yu, lkml, linux-arm-kernel, kernel test robot

resctrl_mon_ctx_waiters is not used outside of this file, so make it
static. This fixes the sparse warning:

drivers/resctrl/mpam_resctrl.c:25:1: warning: symbol 'resctrl_mon_ctx_waiters' was not declared. Should it be static?

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202603281842.c2K96tJA-lkp@intel.com/
Fixes: 2a3c79c61539 ("arm_mpam: resctrl: Allow resctrl to allocate monitors")
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
---
 drivers/resctrl/mpam_resctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index d80df486a313..bb933b224851 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -22,7 +22,7 @@
 
 #include "mpam_internal.h"
 
-DECLARE_WAIT_QUEUE_HEAD(resctrl_mon_ctx_waiters);
+static DECLARE_WAIT_QUEUE_HEAD(resctrl_mon_ctx_waiters);
 
 /*
  * The classes we've picked to map to resctrl resources, wrapped
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 1/2] arm_mpam: resctrl: Fix broken error path in mpam_resctrl_alloc_domain()
  2026-04-14 13:27 ` [PATCH v1 1/2] arm_mpam: resctrl: Fix broken error path in mpam_resctrl_alloc_domain() Ben Horgan
@ 2026-04-14 13:31   ` Ben Horgan
  0 siblings, 0 replies; 7+ messages in thread
From: Ben Horgan @ 2026-04-14 13:31 UTC (permalink / raw)
  Cc: Dan Carpenter, Dan Carpenter, James Morse, Reinette Chatre,
	Fenghua Yu, lkml, linux-arm-kernel

Apologies, I just sent the same patch twice with different subjects. This one can be ignored.

Thanks,

Ben

On 4/14/26 14:27, Ben Horgan wrote:
> Dan Carpenter reports that, in mpam_resctrl_alloc_domain(), any_mon_comp is
> used in an 'if' condition when it may be uninitialized. Initialize it to
> NULL so that the check behaves correctly when no monitor components are
> found.
> 
> Reported-by: Dan Carpenter <error27@gmail.com>
> Fixes: 264c285999fc ("arm_mpam: resctrl: Add monitor initialisation and domain boilerplate")
> Signed-off-by: Ben Horgan <ben.horgan@arm.com>
> ---
>  drivers/resctrl/mpam_resctrl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
> index a9938006d0e6..d80df486a313 100644
> --- a/drivers/resctrl/mpam_resctrl.c
> +++ b/drivers/resctrl/mpam_resctrl.c
> @@ -1399,7 +1399,7 @@ mpam_resctrl_alloc_domain(unsigned int cpu, struct mpam_resctrl_res *res)
>  	}
>  
>  	if (r->mon_capable) {
> -		struct mpam_component *any_mon_comp;
> +		struct mpam_component *any_mon_comp = NULL;
>  		struct mpam_resctrl_mon *mon;
>  		enum resctrl_event_id eventid;
>  



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 1/2] arm_mpam: resctrl: Fix the check for no monitor components found
  2026-04-14 13:27 ` [PATCH v1 1/2] arm_mpam: resctrl: Fix the check for no monitor components found Ben Horgan
@ 2026-04-14 23:08   ` Gavin Shan
  0 siblings, 0 replies; 7+ messages in thread
From: Gavin Shan @ 2026-04-14 23:08 UTC (permalink / raw)
  To: Ben Horgan
  Cc: Dan Carpenter, Dan Carpenter, James Morse, Reinette Chatre,
	Fenghua Yu, lkml, linux-arm-kernel

On 4/14/26 11:27 PM, Ben Horgan wrote:
> Dan Carpenter reports that, in mpam_resctrl_alloc_domain(), any_mon_comp is
> used in an 'if' condition when it may be uninitialized. Initialize it to
> NULL so that the check behaves correctly when no monitor components are
> found.
> 
> Reported-by: Dan Carpenter <error27@gmail.com>
> Fixes: 264c285999fc ("arm_mpam: resctrl: Add monitor initialisation and domain boilerplate")
> Signed-off-by: Ben Horgan <ben.horgan@arm.com>
> ---
>   drivers/resctrl/mpam_resctrl.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
Reviewed-by: Gavin Shan <gshan@redhat.com>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 2/2] arm_mpam: resctrl: Make resctrl_mon_ctx_waiters static
  2026-04-14 13:27 ` [PATCH v1 2/2] arm_mpam: resctrl: Make resctrl_mon_ctx_waiters static Ben Horgan
@ 2026-04-14 23:09   ` Gavin Shan
  0 siblings, 0 replies; 7+ messages in thread
From: Gavin Shan @ 2026-04-14 23:09 UTC (permalink / raw)
  To: Ben Horgan
  Cc: Dan Carpenter, Dan Carpenter, James Morse, Reinette Chatre,
	Fenghua Yu, lkml, linux-arm-kernel, kernel test robot

On 4/14/26 11:27 PM, Ben Horgan wrote:
> resctrl_mon_ctx_waiters is not used outside of this file, so make it
> static. This fixes the sparse warning:
> 
> drivers/resctrl/mpam_resctrl.c:25:1: warning: symbol 'resctrl_mon_ctx_waiters' was not declared. Should it be static?
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202603281842.c2K96tJA-lkp@intel.com/
> Fixes: 2a3c79c61539 ("arm_mpam: resctrl: Allow resctrl to allocate monitors")
> Signed-off-by: Ben Horgan <ben.horgan@arm.com>
> ---
>   drivers/resctrl/mpam_resctrl.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
Reviewed-by: Gavin Shan <gshan@redhat.com>



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-04-14 23:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-14 13:27 [PATCH v1 0/2] arm_mpam: resctrl: mpam resctrl glue code fixes Ben Horgan
2026-04-14 13:27 ` [PATCH v1 1/2] arm_mpam: resctrl: Fix broken error path in mpam_resctrl_alloc_domain() Ben Horgan
2026-04-14 13:31   ` Ben Horgan
2026-04-14 13:27 ` [PATCH v1 1/2] arm_mpam: resctrl: Fix the check for no monitor components found Ben Horgan
2026-04-14 23:08   ` Gavin Shan
2026-04-14 13:27 ` [PATCH v1 2/2] arm_mpam: resctrl: Make resctrl_mon_ctx_waiters static Ben Horgan
2026-04-14 23:09   ` Gavin Shan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox