linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Selvin Xavier <selvin.xavier@broadcom.com>
To: Jason Gunthorpe <jgg@mellanox.com>
Cc: Doug Ledford <dledford@redhat.com>, linux-rdma@vger.kernel.org
Subject: Re: [PATCH for-next v2 2/3] RDMA/bnxt_re: Refactor device add/remove functionalities
Date: Tue, 25 Feb 2020 09:52:45 +0530	[thread overview]
Message-ID: <CA+sbYW3zbVQtNkqbidjdqOsLBzwiLezgdytY=s8Hbi1LhF66yQ@mail.gmail.com> (raw)
In-Reply-To: <20200224135358.GJ26318@mellanox.com>

On Mon, Feb 24, 2020 at 7:24 PM Jason Gunthorpe <jgg@mellanox.com> wrote:
>
> >  static void bnxt_re_stop_irq(void *handle)
> > @@ -1317,7 +1320,37 @@ static void bnxt_re_query_hwrm_intf_version(struct bnxt_re_dev *rdev)
> >               le16_to_cpu(resp.hwrm_intf_patch);
> >  }
> >
> > -static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev)
> > +static void bnxt_re_ib_uninit(struct bnxt_re_dev *rdev)
> > +{
> > +     /* Cleanup ib dev */
> > +     if (test_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags)) {
> > +             ib_unregister_device(&rdev->ibdev);
> > +             clear_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags);
> > +     }
>
> The reason ib_unregister_device_queued exists is because you can't
> call unregistration while holding RTNL.
>
> >       case NETDEV_UNREGISTER:
> > @@ -1704,9 +1727,8 @@ static int bnxt_re_netdev_event(struct notifier_block *notifier,
> >                */
> >               if (atomic_read(&rdev->sched_count) > 0)
> >                       goto exit;
> > -             bnxt_re_ib_unreg(rdev);
> > -             bnxt_re_remove_one(rdev);
> > -             bnxt_re_dev_unreg(rdev);
> > +             bnxt_re_ib_uninit(rdev);
> > +             bnxt_re_remove_device(rdev);
> >               break;
>
> ie here.
>
> This *must* simply be a call to ib_unregister_device_queued() and all
> this other stuff has to go into the dealloc.
>
> As written this is all kinds of deadlocking and racy
>

This patch (patch 2 of this series) was to refactor the existing code and
group the reg/unreg operations as bnxt_re_add_device/bnxt_re_remove_device.  The
third patch in this series is introducing the dealloc_driver hook and
changing the code as
you suggested by calling ib_unregister_device_queued/ ib_unregister_driver.
I didn't want to squash these two patches together.

-Selvin
> Jason

  reply	other threads:[~2020-02-25  4:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-24 10:49 [PATCH for-next v2 0/3] RDMA/bnxt_re driver update Selvin Xavier
2020-02-24 10:49 ` [PATCH for-next v2 1/3] RDMA/bnxt_re: Add more flags in device init and uninit path Selvin Xavier
2020-02-24 13:48   ` Jason Gunthorpe
2020-02-25 10:14     ` Selvin Xavier
2020-02-24 10:49 ` [PATCH for-next v2 2/3] RDMA/bnxt_re: Refactor device add/remove functionalities Selvin Xavier
2020-02-24 13:53   ` Jason Gunthorpe
2020-02-25  4:22     ` Selvin Xavier [this message]
2020-02-24 10:49 ` [PATCH for-next v2 3/3] RDMA/bnxt_re: Use driver_unregister and unregistration API Selvin Xavier
2020-02-24 13:43   ` Jason Gunthorpe
2020-02-25  4:10     ` Selvin Xavier
2020-02-25 13:16       ` Jason Gunthorpe
2020-02-25 15:52         ` Selvin Xavier

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='CA+sbYW3zbVQtNkqbidjdqOsLBzwiLezgdytY=s8Hbi1LhF66yQ@mail.gmail.com' \
    --to=selvin.xavier@broadcom.com \
    --cc=dledford@redhat.com \
    --cc=jgg@mellanox.com \
    --cc=linux-rdma@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;
as well as URLs for NNTP newsgroup(s).