diff mbox series

[v2,1/3] thermal: gov_power_allocator: Allow binding without cooling devices

Message ID 20240403-gpa-no-cooling-devs-v2-1-79bdd8439449@trvn.ru (mailing list archive)
State In Next
Delegated to: Rafael Wysocki
Headers show
Series gov_power_allocator: Allow binding before cooling devices | expand

Commit Message

Nikita Travkin via B4 Relay April 3, 2024, 11:31 a.m. UTC
From: Nikita Travkin <nikita@trvn.ru>

IPA was recently refactored to split out memory allocation into a
separate funciton. That funciton was made to return -EINVAL if there is
zero power_actors and thus no memory to allocate. This causes IPA to
fail probing when the thermal zone has no attached cooling devices.

Since cooling devices can attach after the thermal zone is created and
the governer is attached to it, failing probe due to the lack of cooling
devices is incorrect.

Change the allocate_actors_buffer() to return success when there is no
cooling devices present.

Fixes: 912e97c67cc3 ("thermal: gov_power_allocator: Move memory allocation out of throttle()")
Signed-off-by: Nikita Travkin <nikita@trvn.ru>
---
 drivers/thermal/gov_power_allocator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lukasz Luba April 3, 2024, 12:43 p.m. UTC | #1
On 4/3/24 12:31, Nikita Travkin via B4 Relay wrote:
> From: Nikita Travkin <nikita@trvn.ru>
> 
> IPA was recently refactored to split out memory allocation into a
> separate funciton. That funciton was made to return -EINVAL if there is
> zero power_actors and thus no memory to allocate. This causes IPA to
> fail probing when the thermal zone has no attached cooling devices.
> 
> Since cooling devices can attach after the thermal zone is created and
> the governer is attached to it, failing probe due to the lack of cooling
> devices is incorrect.
> 
> Change the allocate_actors_buffer() to return success when there is no
> cooling devices present.
> 
> Fixes: 912e97c67cc3 ("thermal: gov_power_allocator: Move memory allocation out of throttle()")
> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
> ---
>   drivers/thermal/gov_power_allocator.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
> index 1b17dc4c219c..ec637071ef1f 100644
> --- a/drivers/thermal/gov_power_allocator.c
> +++ b/drivers/thermal/gov_power_allocator.c
> @@ -606,7 +606,7 @@ static int allocate_actors_buffer(struct power_allocator_params *params,
>   
>   	/* There might be no cooling devices yet. */
>   	if (!num_actors) {
> -		ret = -EINVAL;
> +		ret = 0;
>   		goto clean_state;
>   	}
>   
> 

LGTM

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Rafael J. Wysocki April 3, 2024, 2:41 p.m. UTC | #2
On Wed, Apr 3, 2024 at 2:44 PM Lukasz Luba <lukasz.luba@arm.com> wrote:
>
>
>
> On 4/3/24 12:31, Nikita Travkin via B4 Relay wrote:
> > From: Nikita Travkin <nikita@trvn.ru>
> >
> > IPA was recently refactored to split out memory allocation into a
> > separate funciton. That funciton was made to return -EINVAL if there is
> > zero power_actors and thus no memory to allocate. This causes IPA to
> > fail probing when the thermal zone has no attached cooling devices.
> >
> > Since cooling devices can attach after the thermal zone is created and
> > the governer is attached to it, failing probe due to the lack of cooling
> > devices is incorrect.
> >
> > Change the allocate_actors_buffer() to return success when there is no
> > cooling devices present.
> >
> > Fixes: 912e97c67cc3 ("thermal: gov_power_allocator: Move memory allocation out of throttle()")
> > Signed-off-by: Nikita Travkin <nikita@trvn.ru>
> > ---
> >   drivers/thermal/gov_power_allocator.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
> > index 1b17dc4c219c..ec637071ef1f 100644
> > --- a/drivers/thermal/gov_power_allocator.c
> > +++ b/drivers/thermal/gov_power_allocator.c
> > @@ -606,7 +606,7 @@ static int allocate_actors_buffer(struct power_allocator_params *params,
> >
> >       /* There might be no cooling devices yet. */
> >       if (!num_actors) {
> > -             ret = -EINVAL;
> > +             ret = 0;
> >               goto clean_state;
> >       }
> >
> >
>
> LGTM
>
> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

Applied as 6.9-rc material along with the [2/3], thanks!
Lukasz Luba April 3, 2024, 3:03 p.m. UTC | #3
On 4/3/24 15:41, Rafael J. Wysocki wrote:
> On Wed, Apr 3, 2024 at 2:44 PM Lukasz Luba <lukasz.luba@arm.com> wrote:
>>
>>
>>
>> On 4/3/24 12:31, Nikita Travkin via B4 Relay wrote:
>>> From: Nikita Travkin <nikita@trvn.ru>
>>>
>>> IPA was recently refactored to split out memory allocation into a
>>> separate funciton. That funciton was made to return -EINVAL if there is
>>> zero power_actors and thus no memory to allocate. This causes IPA to
>>> fail probing when the thermal zone has no attached cooling devices.
>>>
>>> Since cooling devices can attach after the thermal zone is created and
>>> the governer is attached to it, failing probe due to the lack of cooling
>>> devices is incorrect.
>>>
>>> Change the allocate_actors_buffer() to return success when there is no
>>> cooling devices present.
>>>
>>> Fixes: 912e97c67cc3 ("thermal: gov_power_allocator: Move memory allocation out of throttle()")
>>> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
>>> ---
>>>    drivers/thermal/gov_power_allocator.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
>>> index 1b17dc4c219c..ec637071ef1f 100644
>>> --- a/drivers/thermal/gov_power_allocator.c
>>> +++ b/drivers/thermal/gov_power_allocator.c
>>> @@ -606,7 +606,7 @@ static int allocate_actors_buffer(struct power_allocator_params *params,
>>>
>>>        /* There might be no cooling devices yet. */
>>>        if (!num_actors) {
>>> -             ret = -EINVAL;
>>> +             ret = 0;
>>>                goto clean_state;
>>>        }
>>>
>>>
>>
>> LGTM
>>
>> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
> 
> Applied as 6.9-rc material along with the [2/3], thanks!
> 

Thank you Rafael!
diff mbox series

Patch

diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
index 1b17dc4c219c..ec637071ef1f 100644
--- a/drivers/thermal/gov_power_allocator.c
+++ b/drivers/thermal/gov_power_allocator.c
@@ -606,7 +606,7 @@  static int allocate_actors_buffer(struct power_allocator_params *params,
 
 	/* There might be no cooling devices yet. */
 	if (!num_actors) {
-		ret = -EINVAL;
+		ret = 0;
 		goto clean_state;
 	}