The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: David Arcari <darcari@redhat.com>
To: Len Brown <lenb@kernel.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] tools/power turbostat: allow turbostat to work when aperf is not available
Date: Tue, 2 Dec 2025 07:55:02 -0500	[thread overview]
Message-ID: <e41340a2-4474-4c36-9ed6-bb73232774b1@redhat.com> (raw)
In-Reply-To: <CAJvTdKnBKcXJV5az-2q1MF8b6PU6mxVS2YETgn+OWUKBfOSuZA@mail.gmail.com>



On 12/1/25 3:11 PM, Len Brown wrote:
> Something like this?

Yes - this works.  It's actually nice and clean and actually mitigates 
the need for patch 0001.  Clearly an improvement over my patch 3.

How would you like to proceed?  I could resubmit a single v2 patch (with 
an appropriate explanation).

I'd rather not attempt to solve the retry issue.  It's really a second 
order issue and I don't think I'm the appropriate person to do that work.

-DA

> 
> diff --git a/tools/power/x86/turbostat/turbostat.c
> b/tools/power/x86/turbostat/turbostat.c
> index 5bc47ad5da09..4a847e7e9c65 100644
> --- a/tools/power/x86/turbostat/turbostat.c
> +++ b/tools/power/x86/turbostat/turbostat.c
> @@ -8530,7 +8530,7 @@ void rapl_perf_init(void)
>   /* Assumes msr_counter_info is populated */
>   static int has_amperf_access(void)
>   {
> -       return msr_counter_arch_infos[MSR_ARCH_INFO_APERF_INDEX].present &&
> +       return has_aperf &&
> msr_counter_arch_infos[MSR_ARCH_INFO_APERF_INDEX].present &&
>              msr_counter_arch_infos[MSR_ARCH_INFO_MPERF_INDEX].present;
>   }
> 
> 
> On Mon, Dec 1, 2025 at 2:53 PM Len Brown <lenb@kernel.org> wrote:
>>
>>> ...add_msr_perf_counter() returns -1
>>
>> good.  and then add_msr_counter() succeeds because...
>>
>>> rdmsr returns zero for MSR_IA32_APERF and MSR_IA32_MPERF.
>>
>> Your patch is a good suggestion -- though it checks for APERF only and
>> not for MPERF.
>>
>> We already ran CPUID and cleared has_aperf, so I'm thinking we should
>> be heading this off earlier.  Let me send you a test patch later today.
>>
>> thanks,
>> Len Brown, Intel Open Source Technology Center
> 
> 
> 



  reply	other threads:[~2025-12-02 12:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-18 15:58 [PATCH 0/3] tools/power turbostat: Fix segfault and restart loop issues David Arcari
2025-11-18 15:58 ` [PATCH 1/3] tools/power turbostat: avoid segfault referencing fd_instr_count_percpu David Arcari
2025-11-25 19:11   ` Len Brown
2025-12-01 14:13     ` David Arcari
2025-11-18 15:58 ` [PATCH 2/3] tools/power turbostat: avoid an infinite loop of restarts David Arcari
2025-11-25 19:12   ` Len Brown
2025-11-25 21:50     ` David Arcari
2025-11-27 17:45       ` Len Brown
2025-12-01 12:18         ` David Arcari
2025-11-18 15:58 ` [PATCH 3/3] tools/power turbostat: allow turbostat to work when aperf is not available David Arcari
2025-11-25 19:14   ` Len Brown
2025-11-25 21:55     ` David Arcari
2025-12-01 15:13       ` David Arcari
2025-12-01 19:53         ` Len Brown
2025-12-01 20:11           ` Len Brown
2025-12-02 12:55             ` David Arcari [this message]
2025-12-02 15:02               ` Len Brown

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=e41340a2-4474-4c36-9ed6-bb73232774b1@redhat.com \
    --to=darcari@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    /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