Re: [PATCH] lockdep: avoid struct return in lock_stats()
From: Andy Shevchenko
Date: Wed Jun 18 2025 - 13:57:10 EST
On Tue, Jun 17, 2025 at 10:17:32PM -0700, Boqun Feng wrote:
> On Tue, Jun 10, 2025 at 11:29:21AM +0200, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@xxxxxxxx>
> >
> > Returning a large structure from the lock_stats() function causes clang
> > to have multiple copies of it on the stack and copy between them, which
> > can end up exceeding the frame size warning limit:
> >
> > kernel/locking/lockdep.c:300:25: error: stack frame size (1464) exceeds limit (1280) in 'lock_stats' [-Werror,-Wframe-larger-than]
> > 300 | struct lock_class_stats lock_stats(struct lock_class *class)
> >
> > Change the calling conventions to directly operate on the caller's copy,
> > which apparently is what gcc does already.
> >
> > Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
>
> Queued for more tests and reviews, thanks!
What about this one:
lockdep: change 'static const' variables to enum values
?
(I can't quickly find the pointer right now, but I think in lore.kernel.org you can find it)
--
With Best Regards,
Andy Shevchenko