All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikita Travkin via B4 Relay <devnull+nikita.trvn.ru@kernel.org>
To: Lukasz Luba <lukasz.luba@arm.com>,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	 Daniel Lezcano <daniel.lezcano@linaro.org>,
	Zhang Rui <rui.zhang@intel.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	 linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Nikita Travkin <nikitos.tr@gmail.com>,
	Nikita Travkin <nikita@trvn.ru>
Subject: [PATCH v2 1/3] thermal: gov_power_allocator: Allow binding without cooling devices
Date: Wed, 03 Apr 2024 16:31:40 +0500	[thread overview]
Message-ID: <20240403-gpa-no-cooling-devs-v2-1-79bdd8439449@trvn.ru> (raw)
In-Reply-To: <20240403-gpa-no-cooling-devs-v2-0-79bdd8439449@trvn.ru>

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;
 	}
 

-- 
2.44.0



WARNING: multiple messages have this Message-ID (diff)
From: Nikita Travkin <nikita@trvn.ru>
To: Lukasz Luba <lukasz.luba@arm.com>,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	 Daniel Lezcano <daniel.lezcano@linaro.org>,
	Zhang Rui <rui.zhang@intel.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	 linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Nikita Travkin <nikitos.tr@gmail.com>,
	Nikita Travkin <nikita@trvn.ru>
Subject: [PATCH v2 1/3] thermal: gov_power_allocator: Allow binding without cooling devices
Date: Wed, 03 Apr 2024 16:31:40 +0500	[thread overview]
Message-ID: <20240403-gpa-no-cooling-devs-v2-1-79bdd8439449@trvn.ru> (raw)
In-Reply-To: <20240403-gpa-no-cooling-devs-v2-0-79bdd8439449@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;
 	}
 

-- 
2.44.0


  reply	other threads:[~2024-04-03 11:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03 11:31 [PATCH v2 0/3] gov_power_allocator: Allow binding before cooling devices Nikita Travkin via B4 Relay
2024-04-03 11:31 ` Nikita Travkin
2024-04-03 11:31 ` Nikita Travkin via B4 Relay [this message]
2024-04-03 11:31   ` [PATCH v2 1/3] thermal: gov_power_allocator: Allow binding without " Nikita Travkin
2024-04-03 12:43   ` Lukasz Luba
2024-04-03 14:41     ` Rafael J. Wysocki
2024-04-03 15:03       ` Lukasz Luba
2024-04-03 11:31 ` [PATCH v2 2/3] thermal: gov_power_allocator: Allow binding without trip points Nikita Travkin via B4 Relay
2024-04-03 11:31   ` Nikita Travkin
2024-04-03 12:48   ` Lukasz Luba
2024-04-03 11:31 ` [PATCH v2 3/3] thermal: gov_power_allocator: Suppress sustainable_power warning without trip_points Nikita Travkin via B4 Relay
2024-04-03 11:31   ` Nikita Travkin
2024-04-03 12:52   ` Lukasz Luba
2024-04-03 13:05     ` Nikita Travkin
2024-04-09 14:41 ` [PATCH v2 0/3] gov_power_allocator: Allow binding before cooling devices Leonard Lausen
2024-04-09 14:42 ` Leonard Lausen
2024-04-09 14:46   ` Nikita Travkin
2024-04-11  6:38     ` Lukasz Luba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240403-gpa-no-cooling-devs-v2-1-79bdd8439449@trvn.ru \
    --to=devnull+nikita.trvn.ru@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=nikita@trvn.ru \
    --cc=nikitos.tr@gmail.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.