public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: linux-rdma@vger.kernel.org, Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH rdma-next] RDMA/nldev: Fix section mismatch warning for nldev
Date: Fri, 28 Oct 2022 13:48:45 -0300	[thread overview]
Message-ID: <Y1wH7Yls7ld66Vl/@nvidia.com> (raw)
In-Reply-To: <Y1wHudga/a912vsE@unreal>

On Fri, Oct 28, 2022 at 07:47:53PM +0300, Leon Romanovsky wrote:
> On Fri, Oct 28, 2022 at 01:34:57PM -0300, Jason Gunthorpe wrote:
> > On Fri, Oct 28, 2022 at 07:19:36PM +0300, Leon Romanovsky wrote:
> > > On Fri, Oct 28, 2022 at 01:15:16PM -0300, Jason Gunthorpe wrote:
> > > > On Fri, Oct 28, 2022 at 07:14:16PM +0300, Leon Romanovsky wrote:
> > > > > On Fri, Oct 28, 2022 at 01:00:27PM -0300, Jason Gunthorpe wrote:
> > > > > > On Fri, Oct 28, 2022 at 09:58:56AM +0300, Leon Romanovsky wrote:
> > > > > > > ppc64_defconfig) produced this warning:
> > > > > > > 
> > > > > > > WARNING: modpost: drivers/infiniband/core/ib_core.o: section mismatch in reference: .init_module (section: .init.text) -> .nldev_exit (section: .exit.text)
> > > > > > > 
> > > > > > > Fix it by removing __init/__exit markers as nldev is part of ib_core.ko
> > > > > > > and as such doesn't require any special notations for entry/exit functions.
> > > > > > 
> > > > > > This isn't what the problem is, the patch Stephen reported:
> > > > > > 
> > > > > > commit ad9394a3da33995dff828dbfd4540421e535bec9 (ko-rdma/for-rc)
> > > > > > Author: Chen Zhongjin <chenzhongjin@huawei.com>
> > > > > > Date:   Tue Oct 25 10:41:46 2022 +0800
> > > > > > 
> > > > > >     RDMA/core: Fix null-ptr-deref in ib_core_cleanup()
> > > > > > 
> > > > > > Adds a call to an __exit function from an __init function:
> > > > > > 
> > > > > > @@ -2815,10 +2815,18 @@ static int __init ib_core_init(void)
> > > > > > 
> > > > > > +err_parent:
> > > > > > +       rdma_nl_unregister(RDMA_NL_LS);
> > > > > > +       nldev_exit();
> > > > > > +       unregister_pernet_device(&rdma_dev_net_ops);
> > > > > > 
> > > > > > Which is not allowed
> > > > > > 
> > > > > > All that is required is to drop the __exit from nldev_exit, 
> > > > > 
> > > > > This is why I dropped both __exit and __init. I see no value in keeping
> > > > > __init, without __exit.
> > > > 
> > > > __init works just fine, it will cause the code to be unload after the
> > > > module registration is compelted
> > > 
> > > The code will be unloaded as part of ib_core unload. It is not different
> > > from any other function call in ib_core_init() which is marked as __init.
> > 
> > Huh?
> > 
> > Only things marked __init are discarded after module load
> 
> nldev_init() has single call to rdma_nl_register(), which part of ib_core_init() too.
> There is nothing to discard.

It discards the one statement function since it cannot be inlined.

Jason

      reply	other threads:[~2022-10-28 16:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28  6:58 [PATCH rdma-next] RDMA/nldev: Fix section mismatch warning for nldev Leon Romanovsky
2022-10-28  7:12 ` Leon Romanovsky
2022-10-28 16:00 ` Jason Gunthorpe
2022-10-28 16:14   ` Leon Romanovsky
2022-10-28 16:15     ` Jason Gunthorpe
2022-10-28 16:19       ` Leon Romanovsky
2022-10-28 16:34         ` Jason Gunthorpe
2022-10-28 16:47           ` Leon Romanovsky
2022-10-28 16:48             ` Jason Gunthorpe [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=Y1wH7Yls7ld66Vl/@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /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