From: Cong Wang <amwang@redhat.com>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: netdev@vger.kernel.org, herbert.xu@redhat.com,
nhorman@redhat.com, sgruszka@redhat.com, davem@davemloft.net
Subject: Re: [Patch 2/2] mlx4: add dynamic LRO disable support
Date: Wed, 09 Jun 2010 17:23:35 +0800 [thread overview]
Message-ID: <4C0F5D97.5030605@redhat.com> (raw)
In-Reply-To: <1275661552.2095.13.camel@achroite.uk.solarflarecom.com>
On 06/04/10 22:25, Ben Hutchings wrote:
> On Fri, 2010-06-04 at 09:56 +0800, Cong Wang wrote:
>> On 06/03/10 20:37, Ben Hutchings wrote:
>>> On Wed, 2010-06-02 at 23:39 -0400, Amerigo Wang wrote:
>>>> This patch adds dynamic LRO diable support for mlx4 net driver.
>>>> It also fixes a bug of mlx4, which checks NETIF_F_LRO flag in rx
>>>> path without rtnl lock.
>>> [...]
>>>
>>> Is that flag test actually unsafe - and if so, how is testing num_lro
>>> any better? Perhaps access to net_device::features should be wrapped
>>> with ACCESS_ONCE() to ensure that reads and writes are atomic.
>>>
>>
>> At least, I don't find there is any race with 'num_lro', thus
>> no lock is needed.
>
> In both cases there is a race condition but it is harmless so long as
> the read and the write are atomic. There is a general assumption in
> networking code that this is the case for int and long. Personally I
> would prefer to see this made explicit using ACCESS_ONCE(), but I don't
> see any specific problem in mlx4 (not that I'm familiar with this driver
> either).
I read this email again.
I think you misunderstood the race condition here. Even read and write
are atomic here, the race still exists. One can just set NETIF_F_LRO
asynchronously right before mlx4 check this flag in mlx4_en_process_rx_cq()
which doesn't take rtnl_lock.
Also, I don't think ACCESS_ONCE() can make things atomic here.
Am I missing something?
Thanks.
next prev parent reply other threads:[~2010-06-09 9:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-03 3:38 [Patch 1/2] s2io: add dynamic LRO disable support Amerigo Wang
2010-06-03 3:39 ` [Patch 2/2] mlx4: " Amerigo Wang
2010-06-03 12:37 ` Ben Hutchings
2010-06-04 1:56 ` Cong Wang
2010-06-04 14:25 ` Ben Hutchings
2010-06-07 8:51 ` Cong Wang
2010-06-07 11:00 ` Stanislaw Gruszka
2010-06-07 13:15 ` Cong Wang
2010-06-09 9:23 ` Cong Wang [this message]
2010-06-09 10:49 ` Stanislaw Gruszka
2010-06-15 8:53 ` Cong Wang
2010-06-15 9:39 ` Stanislaw Gruszka
2010-06-17 10:54 ` Cong Wang
2010-06-17 12:03 ` Stanislaw Gruszka
2010-06-18 3:10 ` Cong Wang
2010-06-03 13:38 ` [Patch 1/2] s2io: " Michal Schmidt
2010-06-05 8:53 ` Ramkrishna Vepa
2010-06-07 9:01 ` Cong Wang
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=4C0F5D97.5030605@redhat.com \
--to=amwang@redhat.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=herbert.xu@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@redhat.com \
--cc=sgruszka@redhat.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.