Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Gautam Menghani" <gautam@linux.ibm.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v3 2/3] powerpc/perf: Update prev_count of event to get accurate values
Date: Fri, 06 Nov 2026 15:40:07 +0000	[thread overview]
Message-ID: <sashiko-outbox-201715@kernel.org> (raw)
In-Reply-To: <20261106153136.330165-3-gautam@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] powerpc/perf: dead store to prev_data from local64_read() in
  vpa_pmu_read()
--

commit e6b6a01ca205d4ad136547505bcf1dcf984b82ba
Author: Gautam Menghani <gautam@linux.ibm.com>

powerpc/perf: Update prev_count of event to get accurate values

This commit updates event->hw.prev_count in vpa_pmu_read() using
local64_xchg() so that consecutive counter reads accumulate only the delta
since the last read.

> diff --git a/arch/powerpc/perf/vpa-pmu.c b/arch/powerpc/perf/vpa-pmu.c
> index 01d9196fcb0f6..3296877eb317b 100644
> --- a/arch/powerpc/perf/vpa-pmu.c
> +++ b/arch/powerpc/perf/vpa-pmu.c
> @@ -132,6 +132,7 @@ static void vpa_pmu_read(struct perf_event *event)
>  
>  	prev_data = local64_read(&event->hw.prev_count);
>  	new_data = get_counter_data(event);
> +	prev_data = local64_xchg(&event->hw.prev_count, new_data);

[Severity: Low]
Can the earlier local64_read(&event->hw.prev_count) call be dropped now
that local64_xchg() unconditionally overwrites prev_data before it is
used?  Because local64_read() expands to a volatile READ_ONCE() load, the
compiler cannot elide the redundant read on every vpa_pmu_read() call.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106153136.330165-1-gautam@linux.ibm.com?part=2

  reply	other threads:[~2026-11-06 15:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 15:31 [PATCH v3 0/3] powerpc/perf: Fix vpa-pmu driver to report correct numbers Gautam Menghani
2026-11-06 15:31 ` [PATCH v3 1/3] Revert "powerpc/perf: Add per-task/process monitoring to vpa_pmu driver" Gautam Menghani
2026-11-06 15:31 ` [PATCH v3 2/3] powerpc/perf: Update prev_count of event to get accurate values Gautam Menghani
2026-11-06 15:40   ` sashiko-bot [this message]
2026-11-06 15:31 ` [PATCH v3 3/3] KVM: PPC: Book3s HV: Ensure reliable usage of latency counters Gautam Menghani
2026-11-06 15:50   ` sashiko-bot
2026-11-06 16:02 ` [PATCH v3 0/3] powerpc/perf: Fix vpa-pmu driver to report correct numbers Gautam Menghani

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=sashiko-outbox-201715@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=gautam@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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