aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2010-09-08RDS: use locking on the connection hash listChris Mason1-0/+3
rds_conn_destroy really needs locking while it changes the connection hash. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2010-09-08rds: Fix RDMA message reference countingChris Mason2-8/+14
The RDS send_xmit code was trying to get fancy with message counting and was dropping the final reference on the RDMA messages too early. This resulted in memory corruption and oopsen. The fix here is to always add a ref as the parts of the message passes through rds_send_xmit, and always drop a ref as the parts of the message go through completion handling. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2010-09-08rds: don't let RDS shutdown a connection while senders are presentChris Mason5-16/+26
This is the first in a long line of patches that tries to fix races between RDS connection shutdown and RDS traffic. Here we are maintaining a count of active senders to make sure the connection doesn't go away while they are using it. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2010-09-08rds: Use RCU for the bind lookup searchesChris Mason4-45/+57
The RDS bind lookups are somewhat expensive in terms of CPU time and locking overhead. This commit changes them into a faster RCU based hash tree instead of the rbtrees they were using before. On large NUMA systems it is a significant improvement. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2010-09-08RDS/IB: add _to_node() macros for numa and use {k,v}malloc_node()Andy Grover4-5/+14
Allocate send/recv rings in memory that is node-local to the HCA. This significantly helps performance. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS/IB: Remove unused variable in ib_remove_addr()Andy Grover1-1/+1
Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08rds: rcu-ize rds_ib_get_device()Chris Mason2-8/+17
rds_ib_get_device is called very often as we turn an ip address into a corresponding device structure. It currently take a global spinlock as it walks different lists to find active devices. This commit changes the lists over to RCU, which isn't very complex because they are not updated very often at all. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2010-09-08rds: per-rm flush_wait waitqChris Mason2-4/+5
This removes a global waitqueue used to wait for rds messages and replaces it with a waitqueue inside the rds_message struct. The global waitqueue turns into a global lock and significantly bottlenecks operations on large machines. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2010-09-08rds: switch to rwlock on bind_lockChris Mason1-7/+7
The bind_lock is almost entirely readonly, but it gets hammered during normal operations and is a major bottleneck. This commit changes it to an rwlock, which takes it from 80% of the system time on a big numa machine down to much lower numbers. A better fix would involve RCU, which is done in a later commit Signed-off-by: Chris Mason <chris.mason@oracle.com>
2010-09-08RDS: Update comments in rds_send_xmit()Andy Grover1-3/+2
Update comments to reflect changes in previous commit. Keeping as separate commits due to different authorship. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Use a generation counter to avoid rds_send_xmit loopChris Mason3-4/+9
rds_send_xmit is required to loop around after it releases the lock because someone else could done a trylock, found someone working on the list and backed off. But, once we drop our lock, it is possible that someone else does come in and make progress on the list. We should detect this and not loop around if another process is actually working on the list. This patch adds a generation counter that is bumped every time we get the lock and do some send work. If the retry notices someone else has bumped the generation counter, it does not need to loop around and continue working. Signed-off-by: Chris Mason <chris.mason@oracle.com> Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Get pong working againAndy Grover1-1/+4
Call send_xmit() directly from pong() Set pongs as op_active Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Do wait_event_interruptible instead of wait_eventAndy Grover1-2/+2
Can't see a reason not to allow signals to interrupt the wait. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Remove send_quota from send_xmit()Andy Grover1-15/+15
The purpose of the send quota was really to give fairness when different connections were all using the same workq thread to send backlogged msgs -- they could only send so many before another connection could make progress. Now that each connection is pushing the backlog from its completion handler, they are all guaranteed to make progress and the quota isn't needed any longer. A thread *will* have to send all previously queued data, as well as any further msgs placed on the queue while while c_send_lock was held. In a pathological case a single process can get roped into doing this for long periods while other threads get off free. But, since it can only do this until the transport reports full, this is a bounded scenario. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Move atomic stats from general to ib-specific areaAndy Grover5-6/+6
Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: rds_message_unmapped() doesn't need to check if queue activeAndy Grover1-2/+1
If the queue has nobody on it, then wake_up does nothing. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Fix locking in send on m_rs_lockAndy Grover1-2/+3
Do not nest m_rs_lock under c_lock Disable interrupts in {rdma,atomic}_send_complete Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Use NOWAIT in message_map_pages()Andy Grover1-1/+1
Can no longer block, so use NOWAIT. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Bypass workqueue when queueing cong updatesAndy Grover1-1/+1
Now that rds_send_xmit() does not block, we can call it directly instead of going through the helper thread. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Call rds_send_xmit() directly from sendmsg()Andy Grover1-1/+1
rds_sendmsg() is calling the send worker function to send the just-queued datagrams, presumably because it wants the behavior where anything not sent will re-call the send worker. We now ensure all queued datagrams are sent by retrying from the send completion handler, so this isn't needed any more. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: rds_send_xmit() locking/irq fixesAndy Grover1-9/+12
rds_message_put() cannot be called with irqs off, so move it after irqs are re-enabled. Spinlocks throughout the function do not to use _irqsave because the lock of c_send_lock at top already disabled irqs. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Change send lock from a mutex to a spinlockAndy Grover4-29/+18
This change allows us to call rds_send_xmit() from a tasklet, which is crucial to our new operating model. * Change c_send_lock to a spinlock * Update stats fields "sem_" to "_lock" * Remove unneeded rds_conn_is_sending() About locking between shutdown and send -- send checks if the connection is up. Shutdown puts the connection into DISCONNECTING. After this, all threads entering send will exit immediately. However, a thread could be *in* send_xmit(), so shutdown acquires the c_send_lock to ensure everyone is out before proceeding with connection shutdown. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Refill recv ring directly from taskletAndy Grover3-17/+10
Performance is better if we use allocations that don't block to refill the receive ring. Since the whole reason we were kicking out to the worker thread was so we could do blocking allocs, we no longer need to do this. Remove gfp params from rds_ib_recv_refill(); we always use GFP_NOWAIT. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Stop supporting old cong map sending methodAndy Grover8-106/+13
We now ask the transport to give us a rm for the congestion map, and then we handle it normally. Previously, the transport defined a function that we would call to send a congestion map. Convert TCP and loop transports to new cong map method. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS/IB: Do not wait for send ring to be empty on conn shutdownAndy Grover1-1/+4
Now that we are signaling send completions much less, we are likely to have dirty entries in the send queue when the connection is shut down (on rmmod, for example.) These are cleaned up a little further down in conn_shutdown, but if we wait on the ring_empty_wait for them, it'll never happen, and we hand on unload. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Perform unmapping ops in stagesAndy Grover5-126/+142
Previously, RDS would wait until the final send WR had completed and then handle cleanup. With silent ops, we do not know if an atomic, rdma, or data op will be last. This patch handles any of these cases by keeping a pointer to the last op in the message in m_last_op. When the TX completion event fires, rds dispatches to per-op-type cleanup functions, and then does whole-message cleanup, if the last op equalled m_last_op. This patch also moves towards having op-specific functions take the op struct, instead of the overall rm struct. rds_ib_connection has a pointer to keep track of a a partially- completed data send operation. This patch changes it from an rds_message pointer to the narrower rm_data_op pointer, and modifies places that use this pointer as needed. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Make sure cmsgs aren't used in improper waysAndy Grover1-0/+9
It hasn't cropped up in the field, but this code ensures it is impossible to issue operations that pass an rdma cookie (DEST, MAP) in the same sendmsg call that's actually initiating rdma or atomic ops. Disallowing this perverse-but-technically-allowed usage makes silent RDMA heuristics slightly easier. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Add flag for silent ops. Do atomic op before RDMAAndy Grover4-24/+36
Add a flag to the API so users can indicate they want silent operations. This is needed because silent ops cannot be used with USE_ONCE MRs, so we can't just assume silent. Also, change send_xmit to do atomic op before rdma op if both are present, and centralize the hairy logic to determine if we want to attempt silent, or not. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Move some variables around for consistencyAndy Grover2-4/+7
Also, add a comment. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: queue failure notifications for dropped atomic opsAndy Grover1-2/+10
When dropping ops in the send queue, we notify the client of failed rdma ops they asked for notifications on, but not atomic ops. It should be for both. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Add a warning if trying to allocate 0 sgsAndy Grover1-0/+1
rds_message_alloc_sgs() only works when nents is nonzero. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Do not set op_active in r_m_copy_from_user().Andy Grover2-7/+8
Do not allocate sgs for data for 0-length datagrams Set data.op_active in rds_sendmsg() instead of rds_message_copy_from_user(). Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Rewrite rds_send_xmitAndy Grover2-63/+73
Simplify rds_send_xmit(). Send a congestion map (via xmit_cong_map) without decrementing send_quota. Move resetting of conn xmit variables to end of loop. Update comments. Implement a special case to turn off sending an rds header when there is an atomic op and no other data. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Rename data op members prefix from m_ to op_Andy Grover6-51/+51
For consistency. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Remove struct rds_rdma_opAndy Grover8-148/+145
A big changeset, but it's all pretty dumb. struct rds_rdma_op was already embedded in struct rm_rdma_op. Remove rds_rdma_op and put its members in rm_rdma_op. Rename members with "op_" prefix instead of "r_", for consistency. Of course this breaks a lot, so fixup the code accordingly. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: purge atomic resources too in rds_message_purge()Andy Grover3-0/+22
Add atomic_free_op function, analogous to rdma_free_op, and call it in rds_message_purge(). Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Inline rdma_prepare into cmsg_rdma_argsAndy Grover1-26/+12
cmsg_rdma_args just calls rdma_prepare and does a little arg checking -- not quite enough to justify its existence. Plus, it is the only caller of rdma_prepare(). Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Implement silent atomicsAndy Grover5-35/+45
Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Move loop-only function to loop.cAndy Grover2-8/+13
Also, try to better-document the locking around the rm and its m_inc in loop.c. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS/IB: Make all flow control code conditional on i_flowctlAndy Grover1-6/+8
Maybe things worked fine with the flow control code running even in the non-flow-control case, but making it explicitly conditional helps the non-fc case be easier to read. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Remove unsignaled_bytes sysctlAndy Grover3-21/+0
Removed unsignaled_bytes sysctl and code to signal based on it. I believe unsignaled_wrs is more than sufficient for our purposes. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: rewrite rds_ib_xmitAndy Grover1-78/+45
Now that the header always goes first, it is possible to simplify rds_ib_xmit. Instead of having a path to handle 0-byte dgrams and another path to handle >0, these can both be handled in one path. This lets us eliminate xmit_populate_wr(). Rename sent to bytes_sent, to differentiate better from other variable named "send". Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS/IB: Remove ib_[header/data]_sge() functionsAndy Grover3-55/+23
These functions were to cope with differently ordered sg entries depending on RDS 3.0 or 3.1+. Now that we've dropped 3.0 compatibility we no longer need them. Also, modify usage sites for these to refer to sge[0] or [1] directly. Reorder code to initialize header sgs first. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS/IB: Remove dead codeAndy Grover1-14/+0
Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS/IB: Disallow connections less than RDS 3.1Andy Grover2-47/+16
RDS 3.0 connections (in OFED 1.3 and earlier) put the header at the end. 3.1 connections put it at the head. The code has significant added complexity in order to handle both configurations. In OFED 1.6 we can drop this and simplify the code by only supporting "header-first" configuration. This patch checks the protocol version, and if prior to 3.1, does not complete the connection. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS/IB: eliminate duplicate codeAndy Grover1-19/+11
both atomics and rdmas need to convert ib-specific completion codes into RDS status codes. Rename rds_ib_rdma_send_complete to rds_ib_send_complete, and have it take a pointer to the function to call with the new error code. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: inc_purge() transport function unused - remove itAndy Grover12-18/+3
Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: WhitespaceAndy Grover3-4/+3
Tidy up some whitespace issues. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Do not mask address when pinning pagesAndy Grover1-2/+2
This does not appear to be necessary. Signed-off-by: Andy Grover <andy.grover@oracle.com>
2010-09-08RDS: Base init_depth and responder_resources on hw valuesAndy Grover4-11/+24
Instead of using a constant for initiator_depth and responder_resources, read the per-QP values when the device is enumerated, and then use these values when creating the connection. Signed-off-by: Andy Grover <andy.grover@oracle.com>