mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Suren Baghdasaryan <surenb@google.com>
Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, kent.overstreet@linux.dev,
	linux-kernel@vger.kernel.org, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH 1/1] sched.h: always_inline alloc_tag_{save|restore} to fix modpost warnings
Date: Wed, 3 Jul 2024 21:17:47 -0700	[thread overview]
Message-ID: <20240703211747.97e7740df8c9d91de324c5ce@linux-foundation.org> (raw)
In-Reply-To: <CAJuCfpHvNjFQYU0zHOuang2mNOLNHHiNfaWACPWuP4mSMX_OmQ@mail.gmail.com>

On Wed, 3 Jul 2024 21:07:56 -0700 Suren Baghdasaryan <surenb@google.com> wrote:

> On Wed, Jul 3, 2024 at 8:54 PM Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> > On Wed, 3 Jul 2024 20:46:11 -0700 Suren Baghdasaryan <surenb@google.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"?


  reply	other threads:[~2024-07-04  4:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-03 22:15 Suren Baghdasaryan
2024-07-03 22:51 ` Andrew Morton
2024-07-03 23:23   ` Suren Baghdasaryan
2024-07-04  0:10     ` Suren Baghdasaryan
2024-07-04  3:46       ` Suren Baghdasaryan
2024-07-04  3:54         ` Andrew Morton
2024-07-04  4:07           ` Suren Baghdasaryan
2024-07-04  4:17             ` Andrew Morton [this message]
2024-07-04  4:25               ` Suren Baghdasaryan
2024-07-04  5:17                 ` Andrew Morton

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=20240703211747.97e7740df8c9d91de324c5ce@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=juri.lelli@redhat.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=surenb@google.com \
    --cc=vincent.guittot@linaro.org \
    /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

all inboxes | Powered by JetHome®