From: Sam Ravnborg <sam@ravnborg.org>
To: Jan Engelhardt <jengelh@computergmbh.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
linux-kbuild <linux-kbuild@vger.kernel.org>
Subject: Re: [RFC] __ref annotation of function/data referencing __init/__exit
Date: Tue, 29 Jan 2008 21:12:45 +0100 [thread overview]
Message-ID: <20080129201245.GA14857@uranus.ravnborg.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0801292053531.14907@fbirervta.pbzchgretzou.qr>
On Tue, Jan 29, 2008 at 08:55:32PM +0100, Jan Engelhardt wrote:
>
> On Jan 28 2008 22:38, Sam Ravnborg wrote:
> >On Sat, Jan 26, 2008 at 07:44:54PM +0100, Sam Ravnborg wrote:
> >> Today we have the following annotations for functions/data
> >> referencing __init/__exit functions / data:
> >>
> >> __init_refok for functions
> >> __initdata_refok for data
> >>
> >> and
> >> _exit_refok for functions
> >>
> >> To simplify it and to introduce a shorter annotation I
> >> will suggest the following annotation:
> >>
> >> __ref <= for functions (code) that
> >> references __*init / __*exit
> >> __refdata <= for variables
> >> __refconst <= for const variables
> >>
> >
> >This patch was includedin todays kbuild.git submission
> >as I heard no negative feedback.
>
> I would like to see some real-world example of __ref*.
> When would you want to "reference" (function pointer?) an __init
> function from outside another __init function?
It replaces the old __init_Refok - so you can just grep for that one.
One obvious example:
init/main.c:static void noinline __init_refok rest_init(void)
Here we jump from the the __init part to the normal operation.
And
static noinline __init_refok
int zone_wait_table_init(struct zone *zone, unsigned long zone_size_pages)
{
...
if (system_state == SYSTEM_BOOTING) {
zone->wait_table = (wait_queue_head_t *)
alloc_bootmem_node(pgdat, alloc_size);
The program logic guarantee that we only call
alloc_bootmem_node when we are in the init phase.
So to silence the warning we added __init_refok that is
now named __ref.
We have plenty of data structures containing pointers to
functions annotated __*init or __*exit.
One that casues a lot of warnings is pci_serial_quirks.
Here we can use the annotation to tell modpost that
the references are OK like this (see __refdata):
static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
...
.exit = __devexit_p(sbs_exit),
},
thout the annotation modpost would complain about the
reference to sbs_exit because sbs_exit is annotated __devexit.
If you have proposals to improve the commeonts in init.h please let
me know. This seems to confuse a lot of people.
Sam
prev parent reply other threads:[~2008-01-29 20:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-26 18:44 [RFC] __ref annotation of function/data referencing __init/__exit Sam Ravnborg
2008-01-28 21:38 ` Sam Ravnborg
2008-01-29 19:55 ` Jan Engelhardt
2008-01-29 20:12 ` Sam Ravnborg [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=20080129201245.GA14857@uranus.ravnborg.org \
--to=sam@ravnborg.org \
--cc=jengelh@computergmbh.de \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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