From: Jessica Yu <jeyu@kernel.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: Laura Abbott <labbott@redhat.com>,
Martin Sebor <msebor@gcc.gnu.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] include/linux/module.h: mark init/cleanup_module aliases as __init/exit
Date: Thu, 7 Feb 2019 11:54:31 +0100 [thread overview]
Message-ID: <20190207105431.GA26041@linux-8ccs> (raw)
In-Reply-To: <CANiq72=gS7=G6WbZ4jqybMBh44FeF7UeVEfeb1hN8uMAMt_2bw@mail.gmail.com>
+++ Miguel Ojeda [06/02/19 22:19 +0100]:
>On Wed, Feb 6, 2019 at 6:56 PM Miguel Ojeda
><miguel.ojeda.sandonis@gmail.com> wrote:
>>
>> diff --git a/include/linux/module.h b/include/linux/module.h
>> index 8fa38d3e7538..1b5e370f1bc0 100644
>> --- a/include/linux/module.h
>> +++ b/include/linux/module.h
>> @@ -129,13 +129,13 @@ extern void cleanup_module(void);
>> #define module_init(initfn) \
>> static inline initcall_t __maybe_unused __inittest(void) \
>> { return initfn; } \
>> - int init_module(void) __attribute__((alias(#initfn)));
>> + int init_module(void) __init __attribute__((alias(#initfn)));
>>
>> /* This is only required if you want to be unloadable. */
>> #define module_exit(exitfn) \
>> static inline exitcall_t __maybe_unused __exittest(void) \
>> { return exitfn; } \
>> - void cleanup_module(void) __attribute__((alias(#exitfn)));
>> + void cleanup_module(void) __exit __attribute__((alias(#exitfn)));
>
>It turns out that there are some modules without __init/__exit marked
>functions, which GCC complains about, since now the alias is in a
>different section than the target:
>
> * In some cases, this is due to a missing __init/__exit marking
>(e.g. drivers/connector/connector.c). These should be fixed in any
>case.
> * In other cases, the cleanup function is not marked as such because
>it is called from another place in the TU, like the init function
>(e.g. arch/x86/kvm/vmx.c). We would need to create an actual cleanup
>function (marked as __exit) that simply calls the current exit static
>function.
Grr, I guess it was not so simple after all. :)
>So we have a few alternatives:
>
> 1) Going only with __cold.
> 2) Using the new __copy attribute (because then they are copied only
>in the cases they are actually used).
> 3) Fix and go for __init/__exit. While this requires some tweaking
>as explained above, it would be good if we can achieve it since then
>we are enforcing proper __init/__exit markings for all modules
>(whereas __copy wouldn't spot).
>
>I think it is worth achieving 3), but that will take a bit more of
>time. In that case, I suggest we push 1) or 2) for the moment (so that
>the warning is fixed) and then work on fixing all instances. As soon
>as that is done, we can push 3).
My order of preference would be 2, 1, striving for 3 eventually.
Thanks Miguel!
Jessica
next prev parent reply other threads:[~2019-02-07 10:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-06 17:56 [PATCH v2] include/linux/module.h: mark init/cleanup_module aliases as __init/exit Miguel Ojeda
2019-02-06 21:19 ` Miguel Ojeda
2019-02-07 10:54 ` Jessica Yu [this message]
2019-02-08 23:32 ` Miguel Ojeda
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=20190207105431.GA26041@linux-8ccs \
--to=jeyu@kernel.org \
--cc=labbott@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=msebor@gcc.gnu.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