[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240703211747.97e7740df8c9d91de324c5ce@linux-foundation.org>
Date: Wed, 3 Jul 2024 21:17:47 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Suren Baghdasaryan <surenb@...gle.com>
Cc: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, kent.overstreet@...ux.dev,
linux-kernel@...r.kernel.org, kernel test robot <lkp@...el.com>
Subject: Re: [PATCH 1/1] sched.h: always_inline alloc_tag_{save|restore} to
fix modpost warnings
On Wed, 3 Jul 2024 21:07:56 -0700 Suren Baghdasaryan <surenb@...gle.com> wrote:
> On Wed, Jul 3, 2024 at 8:54 PM Andrew Morton <akpm@...ux-foundation.org> wrote:
> >
> > On Wed, 3 Jul 2024 20:46:11 -0700 Suren Baghdasaryan <surenb@...gle.com> wrote:
> >
> > > Ok, I confirmed that the warning is happening due to the access to
> > > "current" from alloc_tag_save()/alloc_tag_restore() functions. I guess
> > > when these functions access "thread_info" variable:
> > > https://elixir.bootlin.com/linux/v6.10-rc6/source/arch/xtensa/include/asm/thread_info.h#L96,
> > > compiler flags that because the variable is on the stack of an __init
> > > function while alloc_tag_save()/alloc_tag_restore() when not inlined
> > > are from .text section.
> >
> > Well, is the warning legitimate? I don't see why an automatic variable
> > of an __init function should be considered to be .init storage - we can
> > assume it won't become an invalid reference while the .init function is
> > executing?
>
> I don't think it's really a problem. __init function is executing, it
> calls a function from .text (say alloc_tag_save() that was not
> inlined) which in turn calls get_current(), which returns a pointer
> somewhere inside __initdata. That should be fine since this can only
> happen during init stage. If this call happens after init,
> get_current() can't return a pointer from __initdata. If it does then
> we have a much bigger problem.
So I think you're saying "yes, the warning is legitimate and this might
be a problem, but it isn't in this case, so the checking code is OK so
let's just work around it"?
Powered by blists - more mailing lists