From: Steve Wise <hidden> Date: 2007-08-07 14:38:07
Networking experts,
I'd like input on the patch below, and help in solving this bug
properly. iWARP devices that support both native stack TCP and iWARP
(aka RDMA over TCP/IP/Ethernet) connections on the same interface need
the fix below or some similar fix to the RDMA connection manager.
This is a BUG in the Linux RDMA-CMA code as it stands today.
Here is the issue:
Consider an mpi cluster running mvapich2. And the cluster runs
MPI/Sockets jobs concurrently with MPI/RDMA jobs. It is possible,
without the patch below, for MPI/Sockets processes to mistakenly get
incoming RDMA connections and vice versa. The way mvapich2 works is
that the ranks all bind and listen to a random port (retrying new random
ports if the bind fails with "in use"). Once they get a free port and
bind/listen, they advertise that port number to the peers to do
connection setup. Currently, without the patch below, the mpi/rdma
processes can end up binding/listening to the _same_ port number as the
mpi/sockets processes running over the native tcp stack. This is due to
duplicate port spaces for native stack TCP and the rdma cm's RDMA_PS_TCP
port space. If this happens, then the connections can get screwed up.
The correct solution in my mind is to use the host stack's TCP port
space for _all_ RDMA_PS_TCP port allocations. The patch below is a
minimal delta to unify the port spaces by using the kernel stack to bind
ports. This is done by allocating a kernel socket and binding to the
appropriate local addr/port. It also allows the kernel stack to pick
ephemeral ports by virtue of just passing in port 0 on the kernel bind
operation.
There has been a discussion already on the RDMA list if anyone is
interested:
http://www.mail-archive.com/general@lists.openfabrics.org/msg05162.html
Thanks,
Steve.
---
RDMA/CMA: Allocate PS_TCP ports from the host TCP port space.
This is needed for iwarp providers that support native and rdma
connections over the same interface.
Signed-off-by: Steve Wise <redacted>
---
drivers/infiniband/core/cma.c | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
Hi Steve.
On Tue, Aug 07, 2007 at 09:37:41AM -0500, Steve Wise (swise@opengridcomputing.com) wrote:
+static int cma_get_tcp_port(struct rdma_id_private *id_priv)
+{
+ int ret;
+ struct socket *sock;
+
+ ret = sock_create_kern(AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock);
+ if (ret)
+ return ret;
+ ret = sock->ops->bind(sock,
+ (struct socketaddr
*)&id_priv->id.route.addr.src_addr,
+ ip_addr_size(&id_priv->id.route.addr.src_addr));
If get away from talks about broken offloading, this one will result in
the case, when usual network dataflow can enter private rdma land, i.e.
after bind succeeded this socket is accessible via any other network
device. Is it inteded?
And this is quite noticeble overhead per rdma connection, btw.
--
Evgeniy Polyakov
From: Steve Wise <hidden> Date: 2007-08-07 15:06:40
Evgeniy Polyakov wrote:
Hi Steve.
On Tue, Aug 07, 2007 at 09:37:41AM -0500, Steve Wise (swise@opengridcomputing.com) wrote:
quoted
+static int cma_get_tcp_port(struct rdma_id_private *id_priv)
+{
+ int ret;
+ struct socket *sock;
+
+ ret = sock_create_kern(AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock);
+ if (ret)
+ return ret;
+ ret = sock->ops->bind(sock,
+ (struct socketaddr
*)&id_priv->id.route.addr.src_addr,
+ ip_addr_size(&id_priv->id.route.addr.src_addr));
If get away from talks about broken offloading, this one will result in
the case, when usual network dataflow can enter private rdma land, i.e.
after bind succeeded this socket is accessible via any other network
device. Is it inteded?
And this is quite noticeble overhead per rdma connection, btw.
I'm not sure I understand your question? What do you mean by
"accessible"? The intention is to _just_ reserve the addr/port.
The socket struct alloc and bind was a simple way to do this. I
assume we'll have to come up with a better way though.
Namely provide a low level interface to the port space allocator
allowing both rdma and the host tcp stack to share the space without
requiring a socket struct for rdma connections.
Or maybe we'll come up a different and better solution to this issue...
Steve.
On Tue, Aug 07, 2007 at 10:06:29AM -0500, Steve Wise (swise@opengridcomputing.com) wrote:
quoted
On Tue, Aug 07, 2007 at 09:37:41AM -0500, Steve Wise
(swise@opengridcomputing.com) wrote:
quoted
+static int cma_get_tcp_port(struct rdma_id_private *id_priv)
+{
+ int ret;
+ struct socket *sock;
+
+ ret = sock_create_kern(AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock);
+ if (ret)
+ return ret;
+ ret = sock->ops->bind(sock,
+ (struct socketaddr
*)&id_priv->id.route.addr.src_addr,
+ ip_addr_size(&id_priv->id.route.addr.src_addr));
If get away from talks about broken offloading, this one will result in
the case, when usual network dataflow can enter private rdma land, i.e.
after bind succeeded this socket is accessible via any other network
device. Is it inteded?
And this is quite noticeble overhead per rdma connection, btw.
I'm not sure I understand your question? What do you mean by
"accessible"? The intention is to _just_ reserve the addr/port.
Above RDMA ->bind() ends up with tcp_v4_get_port(), which will only add
socket into bhash, but it is only accessible for new sockets created for
listening connections or expilicit bind, network traffic checks only
listening and establised hashes, which are not affected by above change,
so it was false alarm from my side. It does allow to 'grab' a port and
forbid its possible reuse.
--
Evgeniy Polyakov
From: Steve Wise <hidden> Date: 2007-08-09 18:50:27
Any more comments?
Steve Wise wrote:
quoted hunk
Networking experts,
I'd like input on the patch below, and help in solving this bug
properly. iWARP devices that support both native stack TCP and iWARP
(aka RDMA over TCP/IP/Ethernet) connections on the same interface need
the fix below or some similar fix to the RDMA connection manager.
This is a BUG in the Linux RDMA-CMA code as it stands today.
Here is the issue:
Consider an mpi cluster running mvapich2. And the cluster runs
MPI/Sockets jobs concurrently with MPI/RDMA jobs. It is possible,
without the patch below, for MPI/Sockets processes to mistakenly get
incoming RDMA connections and vice versa. The way mvapich2 works is
that the ranks all bind and listen to a random port (retrying new random
ports if the bind fails with "in use"). Once they get a free port and
bind/listen, they advertise that port number to the peers to do
connection setup. Currently, without the patch below, the mpi/rdma
processes can end up binding/listening to the _same_ port number as the
mpi/sockets processes running over the native tcp stack. This is due to
duplicate port spaces for native stack TCP and the rdma cm's RDMA_PS_TCP
port space. If this happens, then the connections can get screwed up.
The correct solution in my mind is to use the host stack's TCP port
space for _all_ RDMA_PS_TCP port allocations. The patch below is a
minimal delta to unify the port spaces by using the kernel stack to bind
ports. This is done by allocating a kernel socket and binding to the
appropriate local addr/port. It also allows the kernel stack to pick
ephemeral ports by virtue of just passing in port 0 on the kernel bind
operation.
There has been a discussion already on the RDMA list if anyone is
interested:
http://www.mail-archive.com/general@lists.openfabrics.org/msg05162.html
Thanks,
Steve.
---
RDMA/CMA: Allocate PS_TCP ports from the host TCP port space.
This is needed for iwarp providers that support native and rdma
connections over the same interface.
Signed-off-by: Steve Wise <redacted>
---
drivers/infiniband/core/cma.c | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
}
+static int cma_get_tcp_port(struct rdma_id_private *id_priv)
+{
+ int ret;
+ struct socket *sock;
+
+ ret = sock_create_kern(AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock);
+ if (ret)
+ return ret;
+ ret = sock->ops->bind(sock,
+ (struct sockaddr *)&id_priv->id.route.addr.src_addr,
+ ip_addr_size(&id_priv->id.route.addr.src_addr));
+ if (ret) {
+ sock_release(sock);
+ return ret;
+ }
+ id_priv->sock = sock;
+ return 0;
+}
+
static int cma_get_port(struct rdma_id_private *id_priv)
{
struct idr *ps;
@@ -1801,6 +1823,9 @@ static int cma_get_port(struct rdma_id_p break; case RDMA_PS_TCP: ps = &tcp_ps;+ ret = cma_get_tcp_port(id_priv); /* Synch with native stack */+ if (ret)+ goto out; break; case RDMA_PS_UDP: ps = &udp_ps;
@@ -1815,7 +1840,7 @@ static int cma_get_port(struct rdma_id_p else ret = cma_use_port(ps, id_priv); mutex_unlock(&lock);-+out: return ret;
}
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: David Miller <davem@davemloft.net> Date: 2007-08-09 21:55:52
From: Sean Hefty <redacted>
Date: Thu, 09 Aug 2007 14:40:16 -0700
Steve Wise wrote:
quoted
Any more comments?
Does anyone have ideas on how to reserve the port space without using a
struct socket?
How about we just remove the RDMA stack altogether? I am not at all
kidding. If you guys can't stay in your sand box and need to cause
problems for the normal network stack, it's unacceptable. We were
told all along the if RDMA went into the tree none of this kind of
stuff would be an issue.
These are exactly the kinds of problems for which people like myself
were dreading. These subsystems have no buisness using the TCP port
space of the Linux software stack, absolutely none.
After TCP port reservation, what's next? It seems an at least
bi-monthly event that the RDMA folks need to put their fingers
into something else in the normal networking stack. No more.
I will NACK any patch that opens up sockets to eat up ports or
anything stupid like that.
From: Sean Hefty <hidden> Date: 2007-08-09 23:23:03
How about we just remove the RDMA stack altogether? I am not at all
kidding. If you guys can't stay in your sand box and need to cause
problems for the normal network stack, it's unacceptable. We were
told all along the if RDMA went into the tree none of this kind of
stuff would be an issue.
There are currently two RDMA solutions available. Each solution has
different requirements and uses the normal network stack differently.
Infiniband uses its own transport. iWarp runs over TCP.
We have tried to leverage the existing infrastructure where it makes sense.
After TCP port reservation, what's next? It seems an at least
bi-monthly event that the RDMA folks need to put their fingers
into something else in the normal networking stack. No more.
Currently, the RDMA stack uses its own port space. This causes a
problem for iWarp, and is what Steve is looking for a solution for. I'm
not an iWarp guru, so I don't know what options exist. Can iWarp use
its own address family? Identify specific IP addresses for iWarp use?
Restrict iWarp to specific port numbers? Let the app control the
correct operation? I don't know.
Steve merely defined a problem and suggested a possible solution. He's
looking for constructive help trying to solve the problem.
- Sean
From: Steve Wise <hidden> Date: 2007-08-15 14:42:54
David Miller wrote:
From: Sean Hefty <redacted>
Date: Thu, 09 Aug 2007 14:40:16 -0700
quoted
Steve Wise wrote:
quoted
Any more comments?
Does anyone have ideas on how to reserve the port space without using a
struct socket?
How about we just remove the RDMA stack altogether? I am not at all
kidding. If you guys can't stay in your sand box and need to cause
problems for the normal network stack, it's unacceptable. We were
told all along the if RDMA went into the tree none of this kind of
stuff would be an issue.
I think removing the RDMA stack is the wrong thing to do, and you
shouldn't just threaten to yank entire subsystems because you don't like
the technology. Lets keep this constructive, can we? RDMA should get
the respect of any other technology in Linux. Maybe its a niche in your
opinion, but come on, there's more RDMA users than say, the sparc64
port. Eh?
These are exactly the kinds of problems for which people like myself
were dreading. These subsystems have no buisness using the TCP port
space of the Linux software stack, absolutely none.
Ok, although IMO its the correct solution. But I'll propose other
solutions below. I ask for your feedback (and everyones!) on these
alternate solutions.
After TCP port reservation, what's next? It seems an at least
bi-monthly event that the RDMA folks need to put their fingers
into something else in the normal networking stack. No more.
The only other change requested and commited, if I recall correctly, was
for netevents, and that enabled both Infiniband and iWARP to integrate
with the neighbour subsystem. I think that was a useful and needed
change. Prior to that, these subsystems were snooping ARP replies to
trigger events. That was back in 2.6.18 or 2.6.19 I think...
I will NACK any patch that opens up sockets to eat up ports or
anything stupid like that.
Got it.
Here are alternate solutions that avoid the need to share the port space:
Solution 1)
1) admins must setup an alias interface on the iwarp device for use with
rdma. This interface will have to be a separate subnet from the "TCP
used" interface. And with a canonical name that indicates its "for rdma
only". Like eth2:iw or eth2:rdma. There can be many of these per device.
2) admins make sure their sockets/tcp services don't use the interface
configured in #1, and their rdma service do use said interface.
3) iwarp providers must translation binds to ipaddr 0.0.0.0 to the
associated "for rdma only" ip addresses. They can do this by searching
for all aliases of the canonical name that are aliases of the TCP
interface for their nic device. Or: somehow not handle incoming
connections to any address but the "for rdma use" addresses and instead
pass them up and not offload them.
This will avoid the collisions as long as the above steps are followed.
Solution 2)
Another possibility would be for the driver to create two net devices
(and hence two interace names) like "eth2" and "iw2", and artificially
separate the RDMA stuff that way.
These two solutions are similar in that they create a "rdma only" interface.
Pros:
- is not intrusive into the core networking code
- very minimal changes needed and in the iwarp provider's code, who are
the ones with this problem
- makes it clear which subnets are RDMA only
Cons:
- relies on system admin to set it up correctly.
- native stack can still "use" this rdma-only interface and the same
port space issue will exist.
For the record, here are possible port-sharing solutions Dave sez he'll NAK:
Solution NAK-1)
The rdma-cma just allocates a socket and binds it to reserve TCP ports.
Pros:
- minimal changes needed to implement (always a plus in my mind :)
- simple, clean, and it works (KISS)
- if no RDMA is in use, there is no impact on the native stack
- no need for a seperate RDMA interface
Cons:
- wastes memory
- puts a TCP socket in the "CLOSED" state in the pcb tables.
- Dave will NAK it :)
Solution NAK-2)
Create a low-level sockets-agnostic port allocation service that is
shared by both TCP and RDMA. This way, the rdma-cm can reserve ports in
an efficient manor instead of doing it via kernel_bind() using a sock
struct.
Pros:
- probably the correct solution (my opinion :) if we went down the path
of sharing port space
- if no RDMA is in use, there is no impact on the native stack
- no need for a separate RDMA interface
Cons:
- very intrusive change because the port allocations stuff is tightly
bound to the host stack and sock struct, etc.
- Dave will NAK it :)
Steve.
From: Jeff Garzik <hidden> Date: 2007-08-16 02:27:24
Steve Wise wrote:
David Miller wrote:
quoted
From: Sean Hefty <redacted>
Date: Thu, 09 Aug 2007 14:40:16 -0700
quoted
Steve Wise wrote:
quoted
Any more comments?
Does anyone have ideas on how to reserve the port space without using
a struct socket?
How about we just remove the RDMA stack altogether? I am not at all
kidding. If you guys can't stay in your sand box and need to cause
problems for the normal network stack, it's unacceptable. We were
told all along the if RDMA went into the tree none of this kind of
stuff would be an issue.
I think removing the RDMA stack is the wrong thing to do, and you
shouldn't just threaten to yank entire subsystems because you don't like
the technology. Lets keep this constructive, can we? RDMA should get
the respect of any other technology in Linux. Maybe its a niche in your
opinion, but come on, there's more RDMA users than say, the sparc64
port. Eh?
It's not about being a niche. It's about creating a maintainable
software net stack that has predictable behavior.
Needing to reach out of the RDMA sandbox and reserve net stack resources
away from itself travels a path we've consistently avoided.
quoted
I will NACK any patch that opens up sockets to eat up ports or
anything stupid like that.
From: Sean Hefty <hidden> Date: 2007-08-16 03:27:43
It's not about being a niche. It's about creating a maintainable
software net stack that has predictable behavior.
Needing to reach out of the RDMA sandbox and reserve net stack resources
away from itself travels a path we've consistently avoided.
We need to ensure that we're also creating a maintainable kernel. RDMA doesn't
use sockets, but that doesn't mean it's not part of the networking support
provided by the Linux kernel. Making blanket statements that RDMA should stay
within a sandbox is equivalent to saying that RDMA should duplicate any network
related functionality that it might need.
quoted
quoted
I will NACK any patch that opens up sockets to eat up ports or
anything stupid like that.
Ditto for me as well.
I agree that using a socket is the wrong approach, but my guess is that it was
suggested as a possibility because of the attempt to keep RDMA in its 'sandbox'.
The iWarp architecture implements RDMA over TCP; it just doesn't use sockets.
The Linux network stack doesn't easily support this possibility. Are there any
reasonable ways to enable this to the degree necessary for iWarp?
- Sean
From: Tom Tucker <hidden> Date: 2007-08-16 14:09:25
On Wed, 2007-08-15 at 22:26 -0400, Jeff Garzik wrote:
[...snip...]
quoted
I think removing the RDMA stack is the wrong thing to do, and you
shouldn't just threaten to yank entire subsystems because you don't like
the technology. Lets keep this constructive, can we? RDMA should get
the respect of any other technology in Linux. Maybe its a niche in your
opinion, but come on, there's more RDMA users than say, the sparc64
port. Eh?
It's not about being a niche. It's about creating a maintainable
software net stack that has predictable behavior.
Isn't RDMA _part_ of the "software net stack" within Linux? Why isn't
making RDMA stable, supportable and maintainable equally as important as
any other subsystem?
Needing to reach out of the RDMA sandbox and reserve net stack resources
away from itself travels a path we've consistently avoided.
quoted
quoted
I will NACK any patch that opens up sockets to eat up ports or
anything stupid like that.
Got it.
Ditto for me as well.
Jeff
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: David Miller <davem@davemloft.net> Date: 2007-08-16 21:18:09
From: Tom Tucker <redacted>
Date: Thu, 16 Aug 2007 08:43:11 -0500
Isn't RDMA _part_ of the "software net stack" within Linux?
It very much is not so.
When using RDMA you lose the capability to do packet shaping,
classification, and all the other wonderful networking facilities
you've grown to love and use over the years.
I'm glad this is a surprise to you, because it illustrates the
point some of us keep trying to make about technologies like
this.
Imagine if you didn't know any of this, you purchase and begin to
deploy a huge piece of RDMA infrastructure, you then get the mandate
from IT that you need to add firewalling on the RDMA connections at
the host level, and "oh shit" you can't?
This is why none of us core networking developers like RDMA at all.
It's totally not integrated with the rest of the Linux stack and on
top of that it even gets in the way. It's an abberation, an eye sore,
and a constant source of consternation.
From: Steve Wise <hidden> Date: 2007-10-08 21:55:04
David Miller wrote:
From: Sean Hefty <redacted>
Date: Thu, 09 Aug 2007 14:40:16 -0700
quoted
Steve Wise wrote:
quoted
Any more comments?
Does anyone have ideas on how to reserve the port space without using a
struct socket?
How about we just remove the RDMA stack altogether? I am not at all
kidding. If you guys can't stay in your sand box and need to cause
problems for the normal network stack, it's unacceptable. We were
told all along the if RDMA went into the tree none of this kind of
stuff would be an issue.
These are exactly the kinds of problems for which people like myself
were dreading. These subsystems have no buisness using the TCP port
space of the Linux software stack, absolutely none.
After TCP port reservation, what's next? It seems an at least
bi-monthly event that the RDMA folks need to put their fingers
into something else in the normal networking stack. No more.
I will NACK any patch that opens up sockets to eat up ports or
anything stupid like that.
Hey Dave,
The hack to use a socket and bind it to claim the port was just for
demostrating the idea. The correct solution, IMO, is to enhance the
core low level 4-tuple allocation services to be more generic (eg: not
be tied to a struct sock). Then the host tcp stack and the host rdma
stack can allocate TCP/iWARP ports/4tuples from this common exported
service and share the port space. This allocation service could also be
used by other deep adapters like iscsi adapters if needed.
Will you NAK such a solution if I go implement it and submit for review?
The dual ip subnet solution really sux, and I'm trying one more time
to see if you will entertain the common port space solution, if done
correctly.
Thanks,
Steve.
From: James Lentini <hidden> Date: 2007-10-09 13:44:33
On Mon, 8 Oct 2007, Steve Wise wrote:
The correct solution, IMO, is to enhance the core low level 4-tuple
allocation services to be more generic (eg: not be tied to a struct
sock). Then the host tcp stack and the host rdma stack can allocate
TCP/iWARP ports/4tuples from this common exported service and share
the port space. This allocation service could also be used by other
deep adapters like iscsi adapters if needed.
As a developer of an RDMA ULP, NFS-RDMA, I like this approach because
it will simplify the configuration of an RDMA device and the services
that use it.
From: Sean Hefty <hidden> Date: 2007-10-10 21:02:59
The hack to use a socket and bind it to claim the port was just for
demostrating the idea. The correct solution, IMO, is to enhance the
core low level 4-tuple allocation services to be more generic (eg: not
be tied to a struct sock). Then the host tcp stack and the host rdma
stack can allocate TCP/iWARP ports/4tuples from this common exported
service and share the port space. This allocation service could also be
used by other deep adapters like iscsi adapters if needed.
Since iWarp runs on top of TCP, the port space is really the same.
FWIW, I agree that this proposal is the correct solution to support iWarp.
- Sean
From: David Miller <davem@davemloft.net> Date: 2007-10-10 23:05:06
From: Sean Hefty <redacted>
Date: Wed, 10 Oct 2007 14:01:07 -0700
quoted
The hack to use a socket and bind it to claim the port was just for
demostrating the idea. The correct solution, IMO, is to enhance the
core low level 4-tuple allocation services to be more generic (eg: not
be tied to a struct sock). Then the host tcp stack and the host rdma
stack can allocate TCP/iWARP ports/4tuples from this common exported
service and share the port space. This allocation service could also be
used by other deep adapters like iscsi adapters if needed.
Since iWarp runs on top of TCP, the port space is really the same.
FWIW, I agree that this proposal is the correct solution to support iWarp.
But you can be sure it's not going to happen, sorry.
It would mean that we'd need to export the entire TCP socket table so
then when iWARP connections are created you can search to make sure
there is not an existing full 4-tuple that is the same.
It is not just about local TCP ports.
iWARP needs to live in it's seperate little container and not
contaminate the rest of the networking, this is the deal. Any
suggested such change which breaks that deal will be NACK'd by all of
the core networking developers.