From: Sam Ravnborg <sam@ravnborg.org>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: "Luck, Tony" <tony.luck@intel.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-ia64@vger.kernel.org
Subject: Re: [PATCH] ia64: fix a few section mismatch warnings
Date: Fri, 27 Jul 2007 05:49:01 +0000 [thread overview]
Message-ID: <20070727054901.GA10629@uranus.ravnborg.org> (raw)
In-Reply-To: <20070727043614.GS27237@ftp.linux.org.uk>
On Fri, Jul 27, 2007 at 05:36:14AM +0100, Al Viro wrote:
> On Fri, Jul 27, 2007 at 06:27:44AM +0200, Sam Ravnborg wrote:
> > On Fri, Jul 27, 2007 at 02:18:13AM +0100, Al Viro wrote:
> > > On Thu, Jul 26, 2007 at 11:01:41PM +0200, Sam Ravnborg wrote:
> > >
> > > > +static void *__init_refok alloc_rte(unsigned long size)
> > > > +{
> > > > + return alloc_bootmem(size);
> > > > +}
> > >
> > > That makes no sense at all. If we ever call that after freeing initmem,
> > > we are screwed, period. Sounds like __init fodder.
> >
> > The call site has logic to prevent this from being called after init.
> > And the call site cannot be made __init and to limit the scope of
> > the __init_refok a small function is used.
> >
> > So unless I mis-understood something the above should be OK.
>
> Then the call site must be __init_refok, AFAICS. The point is,
> the callers of alloc_rte() are where the analysis belongs; use of
> __init_refok means that you assert that all calls of __init *from*
> *it* are safe. Otherwise it just becomes "make modpost STFU and
> let's hope that code is really OK".
The above function is suposed to be used solely from
iosapic_alloc_rte() and not for general use.
And instead of declaring all of iosapic_alloc_rte() as __init_refok
then the single line doing the call to an __init function
was factored out and marked __init.
alloc_rte() can be used from everywhere but the naming suggest
that this is for rte only.
To make it more clear what the function was used for I could have made
it like this:
/*
* Call site shall make sure this isused only during early init.
* Use __init_refok to avoid warnings from modpost.
*/
static void * __init_refok alloc_rte(unsigned long size)
{
return alloc_bootmen(sizeof(struct iosapic_rte_info) * size);
}
Would that make the intention more clear?
As for marking all of iosapic_alloc_rte() __init_refok this was not done
because that would then not detect any new __init usage within the function.
That could be done too obviously - it is anyway only 30 loc.
Sam
WARNING: multiple messages have this Message-ID (diff)
From: Sam Ravnborg <sam@ravnborg.org>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: "Luck, Tony" <tony.luck@intel.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-ia64@vger.kernel.org
Subject: Re: [PATCH] ia64: fix a few section mismatch warnings
Date: Fri, 27 Jul 2007 07:49:01 +0200 [thread overview]
Message-ID: <20070727054901.GA10629@uranus.ravnborg.org> (raw)
In-Reply-To: <20070727043614.GS27237@ftp.linux.org.uk>
On Fri, Jul 27, 2007 at 05:36:14AM +0100, Al Viro wrote:
> On Fri, Jul 27, 2007 at 06:27:44AM +0200, Sam Ravnborg wrote:
> > On Fri, Jul 27, 2007 at 02:18:13AM +0100, Al Viro wrote:
> > > On Thu, Jul 26, 2007 at 11:01:41PM +0200, Sam Ravnborg wrote:
> > >
> > > > +static void *__init_refok alloc_rte(unsigned long size)
> > > > +{
> > > > + return alloc_bootmem(size);
> > > > +}
> > >
> > > That makes no sense at all. If we ever call that after freeing initmem,
> > > we are screwed, period. Sounds like __init fodder.
> >
> > The call site has logic to prevent this from being called after init.
> > And the call site cannot be made __init and to limit the scope of
> > the __init_refok a small function is used.
> >
> > So unless I mis-understood something the above should be OK.
>
> Then the call site must be __init_refok, AFAICS. The point is,
> the callers of alloc_rte() are where the analysis belongs; use of
> __init_refok means that you assert that all calls of __init *from*
> *it* are safe. Otherwise it just becomes "make modpost STFU and
> let's hope that code is really OK".
The above function is suposed to be used solely from
iosapic_alloc_rte() and not for general use.
And instead of declaring all of iosapic_alloc_rte() as __init_refok
then the single line doing the call to an __init function
was factored out and marked __init.
alloc_rte() can be used from everywhere but the naming suggest
that this is for rte only.
To make it more clear what the function was used for I could have made
it like this:
/*
* Call site shall make sure this isused only during early init.
* Use __init_refok to avoid warnings from modpost.
*/
static void * __init_refok alloc_rte(unsigned long size)
{
return alloc_bootmen(sizeof(struct iosapic_rte_info) * size);
}
Would that make the intention more clear?
As for marking all of iosapic_alloc_rte() __init_refok this was not done
because that would then not detect any new __init usage within the function.
That could be done too obviously - it is anyway only 30 loc.
Sam
next prev parent reply other threads:[~2007-07-27 5:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-26 21:01 [PATCH] ia64: fix a few section mismatch warnings Sam Ravnborg
2007-07-26 21:01 ` Sam Ravnborg
2007-07-27 1:18 ` Al Viro
2007-07-27 1:18 ` Al Viro
2007-07-27 4:27 ` Sam Ravnborg
2007-07-27 4:27 ` Sam Ravnborg
2007-07-27 4:36 ` Al Viro
2007-07-27 4:36 ` Al Viro
2007-07-27 5:49 ` Sam Ravnborg [this message]
2007-07-27 5:49 ` Sam Ravnborg
2007-07-27 7:44 ` Sam Ravnborg
2007-07-27 7:44 ` Sam Ravnborg
2007-07-27 22:32 ` Luck, Tony
2007-07-27 22:32 ` Luck, Tony
2007-07-28 6:15 ` Sam Ravnborg
2007-07-28 6:15 ` Sam Ravnborg
2007-07-30 18:41 ` Luck, Tony
2007-07-30 18:41 ` Luck, Tony
2007-07-30 20:50 ` [PATCH v3] " Sam Ravnborg
2007-07-30 20:50 ` Sam Ravnborg
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=20070727054901.GA10629@uranus.ravnborg.org \
--to=sam@ravnborg.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
--cc=viro@ftp.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.