From: David Miller <davem@davemloft.net>
To: deepa.kernel@gmail.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
viro@zeniv.linux.org.uk, arnd@arndb.de, y2038@lists.linaro.org
Subject: Re: [PATCH] sock: Make sock->sk_tstamp thread-safe
Date: Sat, 22 Dec 2018 15:03:33 -0800 (PST) [thread overview]
Message-ID: <20181222.150333.1964216452010509730.davem@davemloft.net> (raw)
In-Reply-To: <20181221202733.19627-1-deepa.kernel@gmail.com>
From: Deepa Dinamani <deepa.kernel@gmail.com>
Date: Fri, 21 Dec 2018 12:27:33 -0800
> Al Viro mentioned that there is probably a race condition
> lurking in accesses of sk_tstamp on 32-bit machines.
>
> sock->sk_tstamp is of type ktime_t which is always an s64.
> On a 32 bit architecture, we might run into situations of
> unsafe access as the access to the field becomes non atomic.
>
> Use seqlocks for synchronization.
> This allows us to avoid using spinlocks for readers as
> readers do not need mutual exclusion.
>
> Another approach to solve this is to require sk_lock for all
> modifications of the timestamps. The current approach allows
> for timestamps to have their own lock: sk_tstamp_lock.
> This allows for the patch to not compete with already
> existing critical sections, and side effects are limited
> to the paths in the patch.
>
> The addition of the new field maintains the data locality
> optimizations from
> commit 9115e8cd2a0c ("net: reorganize struct sock for better data
> locality")
>
> Note that all the instances of the sk_tstamp accesses
> are either through the ioctl or the syscall recvmsg.
>
> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Since, regardless of whether this is the final approach we will
take, it seems that sunrpc needs to be added to this patch.
So I'm definitely waiting for a new version.
Thanks.
next prev parent reply other threads:[~2018-12-22 23:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-21 20:27 Deepa Dinamani
2018-12-22 13:29 ` Arnd Bergmann
2018-12-22 16:34 ` Deepa Dinamani
2018-12-22 23:03 ` David Miller [this message]
2018-12-23 7:31 ` Eric Dumazet
2018-12-23 18:50 ` Deepa Dinamani
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=20181222.150333.1964216452010509730.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=arnd@arndb.de \
--cc=deepa.kernel@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=y2038@lists.linaro.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
all inboxes | Powered by JetHome®