[PATCH v9 14/27] x86/resctrl: Fix types in resctrl_arch_mon_ctx_alloc() and free stubs

James Morse posted 27 patches 7 months, 3 weeks ago
There is a newer version of this series
[PATCH v9 14/27] x86/resctrl: Fix types in resctrl_arch_mon_ctx_alloc() and free stubs
Posted by James Morse 7 months, 3 weeks ago
resctrl_arch_mon_ctx_alloc() and resctrl_arch_mon_ctx_free() take an enum
resctrl_event_id. This in turn requires the enum to be defined in
resctrl_types.h so that it is accessible to asm/resctrl.h.

The x86 stubs take an int. Fix that.

Signed-off-by: James Morse <james.morse@arm.com>
---
Changes since v8:
 * This patch is new.
---
 arch/x86/include/asm/resctrl.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h
index 7a39728b0743..bd149c37551c 100644
--- a/arch/x86/include/asm/resctrl.h
+++ b/arch/x86/include/asm/resctrl.h
@@ -194,13 +194,15 @@ static inline u32 resctrl_arch_rmid_idx_encode(u32 ignored, u32 rmid)
 
 /* x86 can always read an rmid, nothing needs allocating */
 struct rdt_resource;
-static inline void *resctrl_arch_mon_ctx_alloc(struct rdt_resource *r, int evtid)
+static inline void *resctrl_arch_mon_ctx_alloc(struct rdt_resource *r,
+					       enum resctrl_event_id evtid)
 {
 	might_sleep();
 	return NULL;
 };
 
-static inline void resctrl_arch_mon_ctx_free(struct rdt_resource *r, int evtid,
+static inline void resctrl_arch_mon_ctx_free(struct rdt_resource *r,
+					     enum resctrl_event_id evtid,
 					     void *ctx) { };
 
 u64 resctrl_arch_get_prefetch_disable_bits(void);
-- 
2.39.5
Re: [PATCH v9 14/27] x86/resctrl: Fix types in resctrl_arch_mon_ctx_alloc() and free stubs
Posted by Reinette Chatre 7 months, 3 weeks ago
Hi James,

The shortlog sounds like the stubs themselves are being free'd. How about
    x86/resctrl: Fix types in resctrl_arch_mon_ctx_{alloc,free}() stubs

On 4/25/25 10:37 AM, James Morse wrote:
> resctrl_arch_mon_ctx_alloc() and resctrl_arch_mon_ctx_free() take an enum
> resctrl_event_id. This in turn requires the enum to be defined in
> resctrl_types.h so that it is accessible to asm/resctrl.h.

I found the "This in turn requires ..." to indicate that this dependency
still needs to be met. How about:

 resctrl_arch_mon_ctx_alloc() and resctrl_arch_mon_ctx_free() take an enum
 resctrl_event_id that is already defined in resctrl_types.h to be accessible
 to asm/resctrl.h.

> 
> The x86 stubs take an int. Fix that.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> ---



> diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h
> index 7a39728b0743..bd149c37551c 100644
> --- a/arch/x86/include/asm/resctrl.h
> +++ b/arch/x86/include/asm/resctrl.h
> @@ -194,13 +194,15 @@ static inline u32 resctrl_arch_rmid_idx_encode(u32 ignored, u32 rmid)
>  
>  /* x86 can always read an rmid, nothing needs allocating */
>  struct rdt_resource;
> -static inline void *resctrl_arch_mon_ctx_alloc(struct rdt_resource *r, int evtid)
> +static inline void *resctrl_arch_mon_ctx_alloc(struct rdt_resource *r,
> +					       enum resctrl_event_id evtid)
>  {
>  	might_sleep();
>  	return NULL;
>  };

I missed this stray ";" sneaking in ...

>  
> -static inline void resctrl_arch_mon_ctx_free(struct rdt_resource *r, int evtid,
> +static inline void resctrl_arch_mon_ctx_free(struct rdt_resource *r,
> +					     enum resctrl_event_id evtid,
>  					     void *ctx) { };
>  
... and this one.

>  u64 resctrl_arch_get_prefetch_disable_bits(void);

Reinette
Re: [PATCH v9 14/27] x86/resctrl: Fix types in resctrl_arch_mon_ctx_alloc() and free stubs
Posted by James Morse 7 months, 2 weeks ago
Hi Reinette,

On 01/05/2025 18:27, Reinette Chatre wrote:
> The shortlog sounds like the stubs themselves are being free'd. How about
>     x86/resctrl: Fix types in resctrl_arch_mon_ctx_{alloc,free}() stubs

Sure,


> On 4/25/25 10:37 AM, James Morse wrote:
>> resctrl_arch_mon_ctx_alloc() and resctrl_arch_mon_ctx_free() take an enum
>> resctrl_event_id. This in turn requires the enum to be defined in
>> resctrl_types.h so that it is accessible to asm/resctrl.h.
> 
> I found the "This in turn requires ..." to indicate that this dependency
> still needs to be met. How about:
> 
>  resctrl_arch_mon_ctx_alloc() and resctrl_arch_mon_ctx_free() take an enum
>  resctrl_event_id that is already defined in resctrl_types.h to be accessible
>  to asm/resctrl.h.

Done,


>> The x86 stubs take an int. Fix that.
>>
>> Signed-off-by: James Morse <james.morse@arm.com>
>> ---
> 
> 
> 
>> diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h
>> index 7a39728b0743..bd149c37551c 100644
>> --- a/arch/x86/include/asm/resctrl.h
>> +++ b/arch/x86/include/asm/resctrl.h
>> @@ -194,13 +194,15 @@ static inline u32 resctrl_arch_rmid_idx_encode(u32 ignored, u32 rmid)
>>  
>>  /* x86 can always read an rmid, nothing needs allocating */
>>  struct rdt_resource;
>> -static inline void *resctrl_arch_mon_ctx_alloc(struct rdt_resource *r, int evtid)
>> +static inline void *resctrl_arch_mon_ctx_alloc(struct rdt_resource *r,
>> +					       enum resctrl_event_id evtid)
>>  {
>>  	might_sleep();
>>  	return NULL;
>>  };
> 
> I missed this stray ";" sneaking in ...
> 
>>  
>> -static inline void resctrl_arch_mon_ctx_free(struct rdt_resource *r, int evtid,
>> +static inline void resctrl_arch_mon_ctx_free(struct rdt_resource *r,
>> +					     enum resctrl_event_id evtid,
>>  					     void *ctx) { };
>>  
> ... and this one.


Both removed - not sure how that happened!


Thanks,

James