linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] pr_warn_once() issue in x86 MSR extable code
@ 2022-06-17 11:08 Stephane Eranian
  2022-06-17 14:52 ` Peter Zijlstra
  0 siblings, 1 reply; 6+ messages in thread
From: Stephane Eranian @ 2022-06-17 11:08 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: LKML, Eric Dumazet, jpoimboe, Steven Rostedt

Hi,

Some changes to the way invalid MSR accesses are reported by the kernel is
causing some problems with messages printed on the console.

We have seen several cases of ex_handler_msr() printing invalid MSR
accesses once but
the callstack multiple times causing confusion on the console.

The last time the exception MSR code was modified (5.16) by PeterZ was:

  d52a7344bdfa x86/msr: Remove .fixup usage:

  if (!safe && wrmsr &&  pr_warn_once("unchecked MSR access error: ..."))
               show_stack_regs(regs);

Note that this code pattern was also present, though in a different
form, before this commit.

The problem here is that another earlier commit (5.13):

a358f40600b3 once: implement DO_ONCE_LITE for non-fast-path "do once"
functionality

Modifies all the pr_*_once() calls to always return true claiming that
no caller is ever
checking the return value of the functions.

This is why we are seeing the callstack printed without the associated
printk() msg.

I believe that having the pr_*_once() functions return true the first
time they are called
is useful especially when extra information, such as callstack, must
be printed to help
track the origin of the problem.

The exception handling code seems to be the only place where the
return value is checked
for pr_warn_once(). A minimal change would be to create another
version of that function
that calls DO_ONCE() instead of DO_ONCE_LITE(), e.g., pr_warn_once_return().

I can post a patch to that effect if we all agree on the approach.

Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-21  8:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17 11:08 [RFC] pr_warn_once() issue in x86 MSR extable code Stephane Eranian
2022-06-17 14:52 ` Peter Zijlstra
2022-06-22 17:51   ` Stephane Eranian
2022-07-20 12:48     ` Stephane Eranian
2022-07-20 13:44       ` [PATCH] x86/extable: Fix ex_handler_msr() print condition Peter Zijlstra
2022-07-21  8:52   ` [tip: x86/core] " tip-bot2 for Peter Zijlstra

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).