[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZqJjsg3s7H5cTWlT@infradead.org>
Date: Thu, 25 Jul 2024 07:39:46 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Youling Tang <youling.tang@...ux.dev>
Cc: Christoph Hellwig <hch@...radead.org>, Arnd Bergmann <arnd@...db.de>,
Luis Chamberlain <mcgrof@...nel.org>, Chris Mason <clm@...com>,
Josef Bacik <josef@...icpanda.com>, David Sterba <dsterba@...e.com>,
tytso@....edu, Andreas Dilger <adilger.kernel@...ger.ca>,
Jaegeuk Kim <jaegeuk@...nel.org>, Chao Yu <chao@...nel.org>,
linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-modules@...r.kernel.org, linux-btrfs@...r.kernel.org,
linux-ext4@...r.kernel.org, linux-f2fs-devel@...ts.sourceforge.net,
Youling Tang <tangyouling@...inos.cn>
Subject: Re: [PATCH 1/4] module: Add module_subinit{_noexit} and
module_subeixt helper macros
On Thu, Jul 25, 2024 at 11:01:33AM +0800, Youling Tang wrote:
> - It doesn't feel good to have only one subinit/exit in a file.
> Assuming that there is only one file in each file, how do we
> ensure that the files are linked in order?(Is it sorted by *.o
> in the Makefile?)
Yes, link order already matterns for initialization order for built-in
code, so this is a well known concept.
> - Even if the order of each init is linked correctly, then the
> runtime will be iterated through the .subinitcall.init section,
> which executes each initfn in sequence (similar to do_initcalls),
> which means that no other code can be inserted between each subinit.
I don't understand this comment. What do you mean with no other
code could be inserted?
> If module_subinit is called in module_init, other code can be inserted
> between subinit, similar to the following:
>
> ```
> static int __init init_example(void)
> {
> module_subinit(inita, exita);
>
> otherthing...
>
> module_subinit(initb, exitb);
>
> return 0;
> }
Yikes. That's really not the point of having init calls, but just
really, really convoluted control flow.
> module_init(init_example);
> ```
>
> IMHO, module_subinit() might be better called in module_init().
I strongly disagree.
Powered by blists - more mailing lists