Linux Modules
 help / color / mirror / Atom feed
From: Changbin Du <changbin.du@huawei.com>
To: Changbin Du <changbin.du@huawei.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	<linux-modules@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Hui Wang <hw.huiwang@huawei.com>, Xiaoyi Su <suxiaoyi@huawei.com>,
	Jeffrey Hugo <jhugo@codeaurora.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH] modules: wait do_free_init correctly
Date: Mon, 25 Dec 2023 12:07:36 +0800	[thread overview]
Message-ID: <20231225040736.7htp2cfhocbw4hxw@M910t> (raw)
In-Reply-To: <20231221023037.emexvbbnt6tpgcs5@M910t>

On Thu, Dec 21, 2023 at 10:30:37AM +0800, Changbin Du wrote:
> On Wed, Dec 20, 2023 at 06:32:39AM -0800, Luis Chamberlain wrote:
> > On Wed, Dec 20, 2023 at 01:27:51PM +0800, Changbin Du wrote:
> > > On Tue, Dec 19, 2023 at 01:52:03PM -0800, Luis Chamberlain wrote:
> > > > On Tue, Dec 19, 2023 at 12:51:51PM -0800, Andrew Morton wrote:
> > > > > On Tue, 19 Dec 2023 22:12:31 +0800 Changbin Du <changbin.du@huawei.com> wrote:
> > > > > 
> > > > > > The commit 1a7b7d922081 ("modules: Use vmalloc special flag") moves
> > > > > > do_free_init() into a global workqueue instead of call_rcu(). So now
> > > > > > we should wait it via flush_work().
> > > > > 
> > > > > What are the runtime effects of this change?
> > > > 
> > > > Indeed that's needed given how old this culprit commit is:
> > > > 
> > > > git describe --contains 1a7b7d922081
> > > > v5.2-rc1~192^2~5
> > > > 
> > > > Who did this work and for what reason? What triggered this itch?
> > > >
> > > Seems the waiting was introduced by commit ae646f0b9ca ("init: fix false positives
> > > in W+X checking").
> > > 
> > > As what I have observed, mark_readonly() is only invoked by the first user mode
> > > thread function kernel_init(), which is before userspace /init. So is it real
> > > possible we have loaded modules at this point?
> > 
> > Are you saying we don't free any module inits at all then? I asked a lot
> > of questions and your answers seem slim.
> >
> Yes, indeed no module loaded at all before mark_readonly(), at least on my desktop.
> So I think we can just delete this synchronization. I am not sure whether there are
> any historical reasons.
>
I thought about it again, kernel doesn't prevent any drivers from calling
request_module() before init. So it's possible that some particular modules do
behave this way.

I will send an updated one to fix the compilation issue for no CONFIG_MODULES.

-- 
Cheers,
Changbin Du

      reply	other threads:[~2023-12-25  4:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19 14:12 [PATCH] modules: wait do_free_init correctly Changbin Du
2023-12-19 20:51 ` Andrew Morton
2023-12-19 21:52   ` Luis Chamberlain
2023-12-20  5:27     ` Changbin Du
2023-12-20 14:32       ` Luis Chamberlain
2023-12-21  2:30         ` Changbin Du
2023-12-25  4:07           ` Changbin Du [this message]

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=20231225040736.7htp2cfhocbw4hxw@M910t \
    --to=changbin.du@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=hw.huiwang@huawei.com \
    --cc=jhugo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=suxiaoyi@huawei.com \
    /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