mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geoff Blake <blakgeof@amazon.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: <will@kernel.org>, <mark.rutland@arm.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 1/2] perf/arm-cmn: Cope with spurious IRQs better
Date: Mon, 5 Dec 2022 09:38:02 -0600	[thread overview]
Message-ID: <2bb86e97-6cef-700e-70ed-4f303da10fd9@amazon.com> (raw)
In-Reply-To: <83d16969-9d23-1dc5-c9dd-03542b43a52e@arm.com>

> > > >   From my perspective, this is a worse solution as now we're sweeping an
> > > > issue under the rug and consuming CPU cycles handling IRQs we should not
> > > > be getting in the first place.  While an overflow IRQ from the cmn
> > > > should
> > > > not be high frequency, there is a non-zero chance in the future it could
> > > > be and this could lead to a very hard to debug performance issue instead
> > > > of the current problem, which is discovering we need to clean up better
> > > > from a noisy kernel message.
> > > 
> > > Kexec is not the only possible source of spurious IRQs. If they cause a
> > > problem for this driver, that cannot be robustly addressed by trying to
> > > rely on whatever software might happen to run before this driver.
> > 
> > Sure, I can agree with the assertion a spurious IRQ could come from
> > anywhere, in that case though, shouldn't the behavior still be to log
> > spurious IRQs as a warning instead of silently sinking them?
> 
> We still have to handle the interrupt anyway to avoid it getting
> disabled behind our back, and beyond that it's not really something
> that's actionable by the user. What would we say?
> 
>        dev_warn(dev, "Something harmless, and in some cases expected,
> happened! If you've just rebooted after a kernel panic, maybe try having
> the kernel not panic?");
> 
> Perhaps that should be a core IRQ helper so that many other drivers can
> also call it too?
> 
> Furthermore if you're worried about performance implications from a
> theoretical interrupt storm, I can tell you from experience that logging
> to a serial console from a high-frequency interrupt handler is one of
> the best ways to cripple a system to the point where reaching for the
> power switch is the only option.

Logging unexpected events is necessary to give clues of what is going 
wrong before they implode on fully remote machines.  If you prefer to 
handle the IRQ here rather than in the bad_irq section, then can we at 
least have a WARN_ON() in the case where a spurious IRQ happens but no 
overflow bit is set.  

> The DTC_CTL documentation seems fairly unambiguous:
> 
> [0]     dt_en   Enables debug, trace, and PMU features
> 
> The design intent is that the PMU counters do not count when the entire
> PMU feature is disabled. I'm pretty sure I did confirm that empirically
> during development too (I recall the sheer number of different "enable"
> bits baffled me at the beginning, and there was actually one that did
> nothing, which I think did eventually get removed from the documentation).
> 
> Of course clearing PMCR_PMU_EN is sufficient to simply stop counting,
> which we also depend on for correct operation, but I believe clearing
> DT_EN allows it to put all of the DT logic into a quiescent state.

I took the other patch that writes 0 to DTC_CTL.dt_en only and put it in a 
loop of kexec'ing when the PMU is active for a few hours, I did not see 
anymore spurious IRQs (whereas with the stock driver I could reproduce in under 10 tries). 
You are correct Robin, that is all that is needed, and my code was overly 
cautious.

- Geoff

  reply	other threads:[~2022-12-05 15:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-30 15:36 Robin Murphy
2022-11-30 15:36 ` [PATCH 2/2] perf/arm-cmn: Implement shutdown method Robin Murphy
2022-11-30 16:02 ` [PATCH 1/2] perf/arm-cmn: Cope with spurious IRQs better Geoff Blake
2022-11-30 18:16   ` Robin Murphy
2022-11-30 23:13     ` Geoff Blake
2022-12-01 18:28       ` Robin Murphy
2022-12-05 15:38         ` Geoff Blake [this message]
2022-12-15 18:00           ` [PATCH] perf/arm-cmn: Add shutdown routine Geoff Blake
2023-01-04 15:55             ` Geoff Blake
2023-01-19 15:30               ` Geoff Blake
2023-01-19 15:32               ` Robin Murphy
2023-01-19 17:10                 ` Geoff Blake
2023-01-19 18:14                   ` Will Deacon

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=2bb86e97-6cef-700e-70ed-4f303da10fd9@amazon.com \
    --to=blakgeof@amazon.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robin.murphy@arm.com \
    --cc=will@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

all inboxes | Powered by JetHome®