Re: [GIT PULL] objtool fixes and updates

Ingo Molnar
2025-03-31T09:39:16Z

* Josh Poimboeuf <jpoimboe@kernel.org> wrote:

> On Mon, Mar 31, 2025 at 01:13:55AM +0200, Borislav Petkov wrote:
> > On Sun, Mar 30, 2025 at 03:19:40PM -0700, Linus Torvalds wrote:
> > > On Sat, 29 Mar 2025 at 08:33, Borislav Petkov <bp@alien8.de> wrote:
> > > >
> > > > Btw, test bot complains:
> > > >
> > > > https://lore.kernel.org/r/202503292202.Sge7ZEUc-lkp@intel.com
> > >
> > > That's not a very helpful error message
> >
> > I found this:
> >
> > https://lore.kernel.org/r/202503280703.OARM8SrY-lkp@intel.com
> >
> > which looks like the original report.
> >
> > Looks unsolved yet...
>
> The "new" warning is just the "skipping duplicate warning", which was
> already merged with commit 0a7fb6f07e3a ("objtool: Increase per-function
> WARN_FUNC() rate limit"). So none of the warnings are specific to this
> pull request.
>
> Tiezhu, can you please look at this warning?
>
> arch/loongarch/kernel/traps.o: warning: objtool: show_stack+0xe0: stack state mismatch: reg1[22]=-1+0 reg2[22]=-2-160
> arch/loongarch/kernel/traps.o: warning: objtool: show_stack+0xe0: stack state mismatch: reg1[23]=-1+0 reg2[23]=-2-152

I'm wondering why LKP didn't pick up the primary warning, only the
final warning that skips duplicate warnings, which is kinda totally
useless in isolation:

`-- arch-loongarch-kernel-traps.o:warning:objtool:show_stack:skipping-duplicate-warning(s)

Maybe we should just do what is below - output a single warning, a bit
like lockdep.

Or delay the reporting to until the entire pass is finished, and
output something like:

warning: objtool: show_stack+0xe0: stack state mismatch: reg1[22]=-1+0 reg2[22]=-2-160 [2+ more warnings]

Note: we shouldn't output the real warning count - just that it's
multiple warnings that might or might not be resolved by fixing the
primary warning.

Or something like that.

Thanks,

Ingo

============>
tools/objtool/include/objtool/warn.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/objtool/include/objtool/warn.h b/tools/objtool/include/objtool/warn.h
index b29ac144e4f5..69dd29a3c267 100644
--- a/tools/objtool/include/objtool/warn.h
+++ b/tools/objtool/include/objtool/warn.h
@@ -57,7 +57,7 @@ static inline char *offstr(struct section *sec, unsigned long offset)
free(_str); \
})

-#define WARN_LIMIT 2
+#define WARN_LIMIT 1

#define WARN_INSN(insn, format, ...) \
({ \
@@ -69,8 +69,6 @@ static inline char *offstr(struct section *sec, unsigned long offset)
if (_insn->sym) \
_insn->sym->warnings++; \
} else if (_insn->sym && _insn->sym->warnings == WARN_LIMIT) { \
- WARN_FUNC("skipping duplicate warning(s)", \
- _insn->sec, _insn->offset); \
_insn->sym->warnings++; \
} \
})