From: Eric Dumazet <eric.dumazet@gmail.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
fbl@redhat.com, nhorman@redhat.com, davem@redhat.com
Subject: Re: [RFC] tcp: race in receive part
Date: Thu, 25 Jun 2009 12:51:12 +0200 [thread overview]
Message-ID: <4A4356A0.20606@gmail.com> (raw)
In-Reply-To: <20090624164102.GB29337@redhat.com>
Oleg Nesterov a écrit :
> On 06/24, Oleg Nesterov wrote:
>> On 06/24, Jiri Olsa wrote:
>>> +/* The read_lock() on x86 is a full memory barrier. */
>>> +#define smp_mb__after_read_lock() barrier()
>> Just curious, why do we need barrier() ?
>>
>> I must admit, personally I dislike _read_lock part. Because I think we
>> need a "more generic" smp_mb__{before,after}_lock() or whatever which
>> work for spin_lock/read_lock/write_lock.
>>
>> In that case it can have more users. Btw, in fs/select.c too, see
>> __pollwake().
>>
>> And surprise,
>>
>>> --- a/fs/select.c
>>> +++ b/fs/select.c
>>> @@ -219,6 +219,10 @@ static void __pollwait(struct file *filp, wait_queue_head_t *wait_address,
>>> init_waitqueue_func_entry(&entry->wait, pollwake);
>>> entry->wait.private = pwq;
>>> add_wait_queue(wait_address, &entry->wait);
>>> +
>>> + /* This memory barrier is paired with the smp_mb__after_read_lock
>>> + * in the sk_has_sleeper. */
>>> + smp_mb();
>> This could be smp_mb__after_lock() too.
>
> Cough. this needs mb__after_UNlock(), sorry.
>
Yes, and this time you need separate smp_mb__after_spin_unlock(),
as rwlocks and spinlocks dont have same unlock implementation.
(spin_unlock dont have memory barrier on x86, while read_write_unlock do have a barrier)
As it wont give us a benefit on x86 but code obfuscation, I suspect we can leave this for now :)
next prev parent reply other threads:[~2009-06-25 10:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-18 10:27 [RFC] tcp: race in receive part Jiri Olsa
2009-06-18 14:06 ` Eric Dumazet
2009-06-23 9:12 ` Jiri Olsa
2009-06-23 10:32 ` Eric Dumazet
2009-06-23 19:44 ` Oleg Nesterov
2009-06-24 10:20 ` Jiri Olsa
2009-06-24 11:04 ` Eric Dumazet
2009-06-24 16:21 ` Jiri Olsa
2009-06-24 16:30 ` Oleg Nesterov
2009-06-24 16:41 ` Oleg Nesterov
2009-06-25 10:51 ` Eric Dumazet [this message]
2009-06-25 10:28 ` Eric Dumazet
2009-06-25 10:46 ` Eric Dumazet
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=4A4356A0.20606@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@redhat.com \
--cc=fbl@redhat.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nhorman@redhat.com \
--cc=oleg@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 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).