mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Tomohiro Misono (Fujitsu)" <misono.tomohiro@fujitsu.com>
To: 'Mark Rutland' <mark.rutland@arm.com>
Cc: 'Catalin Marinas' <catalin.marinas@arm.com>,
	'Will Deacon' <will@kernel.org>,
	'Jonathan Corbet' <corbet@lwn.net>,
	'Shuah Khan' <skhan@linuxfoundation.org>,
	'Randy Dunlap' <rdunlap@infradead.org>,
	'Marc Zyngier' <maz@kernel.org>,
	'Thomas Gleixner' <tglx@kernel.org>,
	'Radu Rendec' <radu@rendec.net>,
	'Oliver Upton' <oupton@kernel.org>,
	'Fuad Tabba' <fuad.tabba@linux.dev>,
	'Joey Gouly' <joey.gouly@arm.com>,
	'Steffen Eiden' <seiden@linux.ibm.com>,
	'Suzuki K Poulose' <suzuki.poulose@arm.com>,
	'Zenghui Yu' <yuzenghui@huawei.com>,
	"Kohei Enju (Fujitsu)" <enju.kohei@fujitsu.com>,
	"'linux-arm-kernel@lists.infradead.org'"
	<linux-arm-kernel@lists.infradead.org>,
	"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>,
	"'linux-doc@vger.kernel.org'" <linux-doc@vger.kernel.org>,
	"'linux-perf-users@vger.kernel.org'"
	<linux-perf-users@vger.kernel.org>,
	"'kvmarm@lists.linux.dev'" <kvmarm@lists.linux.dev>
Subject: RE: [PATCH v2 3/4] perf: arm_pmu: Add workaround for FUJITSU-MONAKA Erratum E#030002
Date: Mon, 19 Oct 2026 06:19:25 +0000	[thread overview]
Message-ID: <TY7PR01MB15746F6C7CF8E021A0FBA5743E5982@TY7PR01MB15746.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <atImMmlBmOYlY5T2@J2N7QTR9R3.cambridge.arm.com>

> Subject: Re: [PATCH v2 3/4] perf: arm_pmu: Add workaround for FUJITSU-MONAKA Erratum E#030002
> 
> On Fri, Oct 16, 2026 at 01:00:13PM +0000, Tomohiro Misono (Fujitsu) wrote:
> > > Subject: Re: [PATCH v2 3/4] perf: arm_pmu: Add workaround for FUJITSU-MONAKA Erratum E#030002
> > >
> > > On Fri, Oct 16, 2026 at 07:00:47PM +0900, Tomohiro Misono wrote:
> > > > FUJITSU-MONAKA Erratum E#030002 affects FUJITSU-MONAKA CPU.
> > > >
> > > > On affected FUJITSU-MONAKA CPUs, after a PMU event counter is
> > > > stopped at a value just before overflow, an overflow might still
> > > > be incorrectly detected, resulting interrupt storm in some case.
> > > >
> > > > For example, if the following conditions are met:
> > > >   1) Running perf to count an event in user space only
> > > >   2) The event can also occur in kernel space
> > > >   3) The counter value is set just before the overflow
> > > >      (when using the -F option, initial counter value is -1)
> > > >
> > > > when the kernel is about to return to user space after enabling
> > > > the count, an overflow interrupt is incorrectly triggered by an
> > > > event that occurred in kernel space. Since the counter value is
> > > > not updated (correctly), the interrupt handler does nothing and
> > > > returns with the same condition. This leads to another wrong interrupt
> > > > and results in an interrupt storm and eventually a softlockup.
> > >
> > > I don't fully understand this.
> > >
> > > Surely the relevant PMOVS{CLR,SET}[n] bit set as if the counter n
> > > overflowed?
> > >
> > > If that bit is set, the handler will certainly do *something*.
> > >
> > > If that bit is not set, the interrupt shouldn't be asserted at all. When
> > > does it get de-asserted?
> >
> > Sorry, my explanation wasn't clear. The interrupt will be de-asserted
> > as usual.
> 
> I'm trying to work out which of the following happens due to the
> erratum:
> 
> (a) When the erratum occurs, the HW sets a bit in PMOVS*. An overflow
>     interrupt is asserted because PMOVS* is non-zero. The overflow
>     handler will see that bit was set in PMOVS*. Clearing PMOVS*
>     de-asserts the interrupt as usual.
> 
> (b) When the erratum occurs, the HW does not set a bit in PMOVS*, and
>     asserts an overflow interrupt even if PMOVS* is clear.  The overflow
>     handler might not see a bit set in PMOVS*.
> 
> (c) Something else.
> 
> Can you pleaes confirm what HW does with PMOVS* when the erratum occurs?
> I assume (a), but you haven't explicitly stated that so far.

I confirmed that HW works as (a). I will update the comments in v3.

> 
> > The problem is that armpmu_event_set_period() will not update the counter
> > value if, for example, the counter is -1. Therefore, false overflow detection will continue.
> > With this patch, armpmu_event_set_period() will force the counter to -6 so that
> > false overflow detection won't occur in the kernel, since the maximum event
> > count at a time is 5.
> 
> I expected that were this to occur a number of times in quick
> succession, the core perf code would throttle the event, and adjust the
> period.

I didn't see that happen. I'll take a look at the core perf code.

> 
> I am presumably missing some detail that prevents that.
> I assume you've seen the issue in practice? i.e. you've actucally
> triggered this with the perf tool on real hardware?

Yes, I see this problem on real hardware when using perf with
the -F 99 option or the -c 1 option, specifying counting in user space only.

Best Regards,
Tomohiro Misono

  reply	other threads:[~2026-10-19  6:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 10:00 [PATCH v2 0/4] arm64: Add workarounds for FUJITSU-MONAKA CPU Tomohiro Misono
2026-10-16 10:00 ` [PATCH v2 1/4] arm64: cputype: Add FUJITSU MONAKA definition Tomohiro Misono
2026-10-16 11:51   ` Mark Rutland
2026-10-16 10:00 ` [PATCH v2 2/4] arm64: tlb: Add tlbi workaround for FUJITSU-MONAKA Erratum E#030001 Tomohiro Misono
2026-10-16 11:50   ` Mark Rutland
2026-10-16 12:35     ` Marc Zyngier
2026-11-19  8:33       ` Tomohiro Misono (Fujitsu)
2026-10-19  9:23   ` Vladimir Murzin
2026-10-19  9:38     ` Tomohiro Misono (Fujitsu)
2026-10-16 10:00 ` [PATCH v2 3/4] perf: arm_pmu: Add workaround for FUJITSU-MONAKA Erratum E#030002 Tomohiro Misono
2026-10-16 12:08   ` Mark Rutland
2026-10-16 13:00     ` Tomohiro Misono (Fujitsu)
2026-10-16 13:27       ` Mark Rutland
2026-10-19  6:19         ` Tomohiro Misono (Fujitsu) [this message]
2026-11-19  8:35         ` Tomohiro Misono (Fujitsu)
2026-10-19  9:24   ` Vladimir Murzin
2026-10-16 10:00 ` [PATCH v2 4/4] irqchip/gicv3: Add workaround for FUJITSU-MONAKA erratum E#030003 Tomohiro Misono
2026-10-17 11:48   ` kernel test robot
2026-10-19 12:53     ` Kohei Enju
2026-10-17 12:27   ` Marc Zyngier
2026-10-20  7:20     ` Kohei Enju

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=TY7PR01MB15746F6C7CF8E021A0FBA5743E5982@TY7PR01MB15746.jpnprd01.prod.outlook.com \
    --to=misono.tomohiro@fujitsu.com \
    --cc=catalin.marinas@arm.com \
    --cc=corbet@lwn.net \
    --cc=enju.kohei@fujitsu.com \
    --cc=fuad.tabba@linux.dev \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=radu@rendec.net \
    --cc=rdunlap@infradead.org \
    --cc=seiden@linux.ibm.com \
    --cc=skhan@linuxfoundation.org \
    --cc=suzuki.poulose@arm.com \
    --cc=tglx@kernel.org \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.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

all inboxes | Powered by JetHome®