From: "Michal Suchánek" <msuchanek@suse.de>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: WARN_ONCE does not warn once
Date: Fri, 15 Nov 2019 10:32:19 +0100 [thread overview]
Message-ID: <20191115093219.GA24518@kitsune.suse.cz> (raw)
In-Reply-To: <20191115084434.GJ11661@kitsune.suse.cz>
On Fri, Nov 15, 2019 at 09:44:34AM +0100, Michal Suchánek wrote:
> On Fri, Nov 15, 2019 at 03:43:24PM +1100, Michael Ellerman wrote:
> > Michal Suchánek <msuchanek@suse.de> writes:
> > > On Thu, Nov 14, 2019 at 05:46:55PM +0100, Michal Suchánek wrote:
> > >> Hello,
> > >>
> > >> on powernv with 5.3.8 kernel I get flood of messages on boot.
> > >>
> > >> The messages match WARN_ONCE(1, "opal: OPAL_CONSOLE_FLUSH missing.\n");
> > >
> > > Asking around it was pointed out that WARN_ONCE warns up to as many
> > > times as you have CPUs.
> >
> > Does it?
> >
> > > Did not bother counting the messages but it may very well be the case it
> > > is printed once for each CPU.
> >
> > The way it's implemented is slightly racy, but I'd be surprised if every
> > CPU hit that race all at once.
>
> Printing a warn_once this early probably forces some peculiar timing.
> grep WARN.*__opal_flush_console dmesg.txt | wc -l gives exactly the
> number of CPUs as shown by lscpu.
>
And this dose not change with enforcing once using an atomic.
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index d271accf224b..dd870124b804 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -425,6 +425,7 @@ static s64 __opal_flush_console(uint32_t vtermno)
s64 rc;
if (!opal_check_token(OPAL_CONSOLE_FLUSH)) {
+ static atomic_t warned;
__be64 evt;
/*
@@ -432,7 +433,8 @@ static s64 __opal_flush_console(uint32_t vtermno)
* the console can still be flushed by calling the polling
* function while it has OPAL_EVENT_CONSOLE_OUTPUT events.
*/
- WARN_ONCE(1, "opal: OPAL_CONSOLE_FLUSH missing.\n");
+ if (!atomic_xchg(&warned, 1))
+ WARN(1, "opal: OPAL_CONSOLE_FLUSH missing.\n");
opal_poll_events(&evt);
if (!(be64_to_cpu(evt) & OPAL_EVENT_CONSOLE_OUTPUT))
Something more tricky is going on.
Thanks
Michal
prev parent reply other threads:[~2019-11-15 9:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-14 16:46 WARN_ONCE does not warn once Michal Suchánek
2019-11-14 19:44 ` Michal Suchánek
2019-11-15 4:43 ` Michael Ellerman
2019-11-15 8:44 ` Michal Suchánek
2019-11-15 9:32 ` Michal Suchánek [this message]
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=20191115093219.GA24518@kitsune.suse.cz \
--to=msuchanek@suse.de \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
/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;
as well as URLs for NNTP newsgroup(s).