Linux Power Management development
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Zhu Jun <zhujun2@cmss.chinamobile.com>, trenn@suse.com
Cc: shuah@kernel.org, jwyatt@redhat.com, jkacur@redhat.com,
	linux-pm@vger.kernel.org, Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] cpupower: Propagate errors from child powercap zones
Date: Fri, 20 Nov 2026 12:45:37 -0700	[thread overview]
Message-ID: <6ef36a84-b46b-40ac-bfc3-edffbeb8b8f4@linuxfoundation.org> (raw)
In-Reply-To: <20261120062134.98489-1-zhujun2@cmss.chinamobile.com>

On 11/19/26 23:21, Zhu Jun wrote:
> powercap_walk_zones() returns a callback error for the current zone but
> discards errors from recursive calls. A callback that fails on a child
> zone therefore does not stop the walk and the caller receives success.
> 
> Propagate the recursive return value so callback errors have the same
> meaning at every level of the hierarchy.

Why is this change necessary? Does this change by itself do
what you are intended it do?

> 
> Fixes: c2294c1496b7 ("cpupower: Introduce powercap intel-rapl library and powercap-info command")
> Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
> ---
>   tools/power/cpupower/lib/powercap.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/power/cpupower/lib/powercap.c b/tools/power/cpupower/lib/powercap.c
> index 94a0c69e55ef..76ca392161e6 100644
> --- a/tools/power/cpupower/lib/powercap.c
> +++ b/tools/power/cpupower/lib/powercap.c
> @@ -300,8 +300,11 @@ int powercap_walk_zones(struct powercap_zone *zone,
>   		return ret;
>   
>   	for (i = 0; i < POWERCAP_MAX_CHILD_ZONES; i++) {
> -		if (zone->children[i] != NULL)
> -			powercap_walk_zones(zone->children[i], f);
> +		if (zone->children[i]) {
> +			ret = powercap_walk_zones(zone->children[i], f);
> +			if (ret)
> +				return ret;
> +		}
>   	}
>   	return 0;
>   }
> 
> 

thanks,
-- Shuah

      reply	other threads:[~2026-11-20 19:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  6:21 [PATCH] cpupower: Propagate errors from child powercap zones Zhu Jun
2026-11-20 19:45 ` Shuah Khan [this message]

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=6ef36a84-b46b-40ac-bfc3-edffbeb8b8f4@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=jkacur@redhat.com \
    --cc=jwyatt@redhat.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=trenn@suse.com \
    --cc=zhujun2@cmss.chinamobile.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox