From: Leon Romanovsky <leonro@nvidia.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Ajit Khaparde <ajit.khaparde@broadcom.com>,
<andrew.gospodarek@broadcom.com>, <davem@davemloft.net>,
<edumazet@google.com>, <jgg@ziepe.ca>,
<linux-kernel@vger.kernel.org>, <linux-rdma@vger.kernel.org>,
<michael.chan@broadcom.com>, <netdev@vger.kernel.org>,
<pabeni@redhat.com>, <selvin.xavier@broadcom.com>
Subject: Re: [PATCH net-next v7 1/8] bnxt_en: Add auxiliary driver support
Date: Tue, 17 Jan 2023 14:31:01 +0200 [thread overview]
Message-ID: <Y8aVBTAVFQPPx47H@unreal> (raw)
In-Reply-To: <20230116205625.394596cc@kernel.org>
On Mon, Jan 16, 2023 at 08:56:25PM -0800, Jakub Kicinski wrote:
> On Sat, 14 Jan 2023 12:39:09 -0800 Ajit Khaparde wrote:
> > > > +static void bnxt_aux_dev_release(struct device *dev)
> > > > +{
> > > > + struct bnxt_aux_dev *bnxt_adev =
> > > > + container_of(dev, struct bnxt_aux_dev, aux_dev.dev);
> > > > + struct bnxt *bp = netdev_priv(bnxt_adev->edev->net);
> > > > +
> > > > + bnxt_adev->edev->en_ops = NULL;
> > > > + kfree(bnxt_adev->edev);
> > >
> > > And yet the reference counted "release" function accesses the bp->adev
> > > like it must exist.
> > >
> > > This seems odd to me - why do we need refcounting on devices at all
> > > if we can free them synchronously? To be clear - I'm not sure this is
> > > wrong, just seems odd.
> > I followed the existing implementations in that regard. Thanks
>
> Leon, could you take a look? Is there no problem in assuming bnxt_adev
> is still around in the release function?
You caught a real bug. The auxdev idea is very simple - it needs to
behave like driver core, but in the driver itself.
As such, bnxt_aux_dev_free() shouldn't be called after bnxt_rdma_aux_device_uninit().
Device will be released through auxiliary_device_uninit();
BTW, line 325 from below shouldn't exist too.
312 void bnxt_rdma_aux_device_uninit(struct bnxt *bp)
313 {
...
325 if (bnxt_adev->id >= 0)
326 ida_free(&bnxt_aux_dev_ids, bnxt_adev->id);
And one line bnxt_aux_dev_alloc() needs to be deleted too.
Thanks
next prev parent reply other threads:[~2023-01-17 12:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 20:29 [PATCH net-next v7 0/8] Add Auxiliary driver support Ajit Khaparde
2023-01-12 20:29 ` [PATCH net-next v7 1/8] bnxt_en: Add auxiliary " Ajit Khaparde
2023-01-14 6:10 ` Jakub Kicinski
2023-01-14 20:39 ` Ajit Khaparde
2023-01-17 4:56 ` Jakub Kicinski
2023-01-17 12:31 ` Leon Romanovsky [this message]
2023-01-17 17:18 ` Leon Romanovsky
2023-01-17 19:33 ` Ajit Khaparde
2023-01-18 6:32 ` Ajit Khaparde
2023-01-12 20:29 ` [PATCH net-next v7 2/8] RDMA/bnxt_re: Use auxiliary driver interface Ajit Khaparde
2023-01-12 20:29 ` [PATCH net-next v7 3/8] bnxt_en: Remove usage of ulp_id Ajit Khaparde
2023-01-12 20:29 ` [PATCH net-next v7 4/8] bnxt_en: Use direct API instead of indirection Ajit Khaparde
2023-01-12 20:29 ` [PATCH net-next v7 5/8] bnxt_en: Use auxiliary bus calls over proprietary calls Ajit Khaparde
2023-01-12 20:29 ` [PATCH net-next v7 6/8] bnxt_en: Remove struct bnxt access from RoCE driver Ajit Khaparde
2023-01-12 20:29 ` [PATCH net-next v7 7/8] RDMA/bnxt_re: Remove the sriov config callback Ajit Khaparde
2023-01-12 20:29 ` [PATCH net-next v7 8/8] bnxt_en: Remove runtime interrupt vector allocation Ajit Khaparde
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=Y8aVBTAVFQPPx47H@unreal \
--to=leonro@nvidia.com \
--cc=ajit.khaparde@broadcom.com \
--cc=andrew.gospodarek@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jgg@ziepe.ca \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=selvin.xavier@broadcom.com \
/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.