Linux Power Management development
 help / color / mirror / Atom feed
From: "Zhang, Rui" <rui.zhang@intel.com>
To: "qinyuntan@linux.alibaba.com" <qinyuntan@linux.alibaba.com>,
	"lenb@kernel.org" <lenb@kernel.org>
Cc: "michael.hebenstreit@intel.com" <michael.hebenstreit@intel.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"xlpang@linux.alibaba.com" <xlpang@linux.alibaba.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] tools/power turbostat: Restore u32 truncation for raw counters
Date: Fri, 27 Nov 2026 05:54:33 +0000	[thread overview]
Message-ID: <6113de4fedc012d78fc8e6f06e38f6c905d0062f.camel@intel.com> (raw)
In-Reply-To: <20261124032723.157254-3-qinyuntan@linux.alibaba.com>

On Tue, 2026-11-24 at 11:27 +0800, Qinyun Tan wrote:
> The u32 size option truncates raw counter values to 32 bits for
> display.
> However, print_hex_value() now prints the full value even when the
> width
> is 32 bits. For example, 0x000000edc994ba0d is printed as edc994ba0d
> instead of c994ba0d.
> 
> The print helper cleanup replaced %08x and the unsigned int cast with
> %08llx. The field width is a minimum, so it does not truncate values
> that need more than eight hexadecimal digits. The cast was needed to
> discard the upper 32 bits.
> 
> Restore the cast and %08x for raw counters up to 32 bits wide. Leave
> 64-bit raw values and decimal counter formatting unchanged.
> 
> Fixes: 092b76a3253f ("tools/power turbostat: Cleanup print helper
> functions")
> Signed-off-by: Qinyun Tan <qinyuntan@linux.alibaba.com>

Acked-by: Zhang Rui <rui.zhang@intel.com>

-rui
> ---
>  tools/power/x86/turbostat/turbostat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/power/x86/turbostat/turbostat.c
> b/tools/power/x86/turbostat/turbostat.c
> index 4e7eba8d8752..d0f0b4af6094 100644
> --- a/tools/power/x86/turbostat/turbostat.c
> +++ b/tools/power/x86/turbostat/turbostat.c
> @@ -2906,7 +2906,7 @@ static inline int print_hex_value(int width,
> int *printed, char *delim, unsigned
>  	char *sep = (*printed)++ ? delim : "";
>  
>  	if (width <= 32)
> -		return sprintf(outp, "%s%08llx", sep, value);
> +		return sprintf(outp, "%s%08x", sep, (unsigned
> int)value);
>  	else
>  		return sprintf(outp, "%s%016llx", sep, value);
>  }


  reply	other threads:[~2026-11-27  5:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  3:27 [PATCH 0/3] tools/power turbostat: Fix counter formats and CPU selection docs Qinyun Tan
2026-11-24  3:27 ` [PATCH 1/3] tools/power turbostat: Fix average format for CPU/core perf counters Qinyun Tan
2026-11-27  5:53   ` Zhang, Rui
2026-11-24  3:27 ` [PATCH 2/3] tools/power turbostat: Restore u32 truncation for raw counters Qinyun Tan
2026-11-27  5:54   ` Zhang, Rui [this message]
2026-11-24  3:27 ` [PATCH 3/3] tools/power turbostat: Fix --cpu summary description Qinyun Tan
2026-11-27  5:55   ` Zhang, Rui

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=6113de4fedc012d78fc8e6f06e38f6c905d0062f.camel@intel.com \
    --to=rui.zhang@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=michael.hebenstreit@intel.com \
    --cc=qinyuntan@linux.alibaba.com \
    --cc=xlpang@linux.alibaba.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