From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, nirranjan@chelsio.com,
vishal@chelsio.com, dt@chelsio.com
Subject: Re: [PATCH net] cxgb4: fix refcount init for TC-MQPRIO offload
Date: Wed, 18 Dec 2019 09:03:13 +0530 [thread overview]
Message-ID: <20191218033312.GA15752@chelsio.com> (raw)
In-Reply-To: <20191217.140930.477589169001575109.davem@davemloft.net>
On Tuesday, December 12/17/19, 2019 at 14:09:30 -0800, David Miller wrote:
> From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> Date: Mon, 16 Dec 2019 19:54:02 +0530
>
> > @@ -205,7 +205,11 @@ static int cxgb4_mqprio_alloc_hw_resources(struct net_device *dev)
> > cxgb4_enable_rx(adap, &eorxq->rspq);
> > }
> >
> > - refcount_inc(&adap->tc_mqprio->refcnt);
> > + if (!refcount_read(&adap->tc_mqprio->refcnt))
> > + refcount_set(&adap->tc_mqprio->refcnt, 1);
> > + else
> > + refcount_inc(&adap->tc_mqprio->refcnt);
> > +
>
> This is not correct.
>
> You're bypassing the whole point of the refcount_t type which is to make sure
> that code that initializes a new object explicitly calls refcount_set() and
> that once the refcount goes to zero the object is freed or the refcount is
> initialized again using refcount_set() or similar.
>
> I'm not applying this, it's just papering around the real problem.
Ok, I'll move refcount_set() closer to where the hardware queue
arrays, that it's tracking, have been allocated. Will send a v2.
Thanks,
Rahul
prev parent reply other threads:[~2019-12-18 3:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-16 14:24 [PATCH net] cxgb4: fix refcount init for TC-MQPRIO offload Rahul Lakkireddy
2019-12-17 22:09 ` David Miller
2019-12-18 3:33 ` Rahul Lakkireddy [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=20191218033312.GA15752@chelsio.com \
--to=rahul.lakkireddy@chelsio.com \
--cc=davem@davemloft.net \
--cc=dt@chelsio.com \
--cc=netdev@vger.kernel.org \
--cc=nirranjan@chelsio.com \
--cc=vishal@chelsio.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 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).