Thread (13 messages) flat view 13 messages, 6 authors, 2012-09-20

Re: [PATCH v3] net-tcp: TCP/IP stack bypass for loopback connections

From: Bruce Curtis <hidden>
Date: 2012-09-17 23:08:26

On Mon, Sep 17, 2012 at 1:20 PM, Eric Dumazet [off-list ref] wrote:
On Mon, 2012-09-17 at 11:58 -0700, Bruce "Brutus" Curtis wrote:
quoted
From: "Bruce \"Brutus\" Curtis" <redacted>

TCP/IP loopback socket pair stack bypass, based on an idea by, and
rough upstream patch from, David Miller [off-list ref] called
"friends", the data structure modifcations and connection scheme are
reused with extensive data-path changes.
...
quoted
+             if (skb->friend) {
+                     /*
+                      * If friends haven't been made yet, our sk_friend
+                      * still == NULL, then update with the ACK's friend
+                      * value (the listen()er's sock addr) which is used
+                      * as a place holder.
+                      */
+                     cmpxchg(&sk->sk_friend, NULL, skb->friend);
+             }

There is a fundamental issue with this patch

Setting skb->friend to a socket structure, without holding a reference
on it is going to add subtle races and bugs.

In this code, we have no guarantee the socket pointed by skb->friend was
eventually freed and/or reused.

But adding references might be overkill, as we need to unref them in
some places, in hot path.
Yes, this could be a problem, putting a hold on the sk would be overkill for the
hot-path, working on it now, more soon.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help