Index: homa_incoming.c |
diff --git a/homa_incoming.c b/homa_incoming.c |
index 965ece34f0ec39b21ef9dcfc538ad7b83a2a1f6b..5d23a7acee2dda94c7ee4fdc0906dc7ee4873938 100644 |
--- a/homa_incoming.c |
+++ b/homa_incoming.c |
@@ -1234,7 +1234,8 @@ int homa_register_interests(struct homa_interest *interest, |
/* Insert this thread at the *front* of the list; |
* we'll get better cache locality if we reuse |
* the same thread over and over, rather than |
- * round-robining between threads. Same below.*/ |
+ * round-robining between threads. Same below. |
+ */ |
list_add(&interest->response_links, |
&hsk->response_interests); |
} |
@@ -1242,6 +1243,11 @@ int homa_register_interests(struct homa_interest *interest, |
if (!list_empty(&hsk->ready_requests)) { |
rpc = list_first_entry(&hsk->ready_requests, |
struct homa_rpc, ready_links); |
+ /* Make sure the interest isn't on the response list; |
+ * otherwise it might receive a second RPC. |
+ */ |
+ if (interest->response_links.next != LIST_POISON1) |
+ list_del(&interest->response_links); |
goto claim_rpc; |
} |
list_add(&interest->request_links, &hsk->request_interests); |
@@ -1475,13 +1481,22 @@ void homa_rpc_ready(struct homa_rpc *rpc) |
/* Notify the poll mechanism. */ |
sk = (struct sock *) hsk; |
sk->sk_data_ready(sk); |
- tt_record1("homa_rpc_ready finished queuing id %d", rpc->id); |
+ tt_record2("homa_rpc_ready finished queuing id %d for port %d", |
+ rpc->id, hsk->port); |
+ if (!list_empty(&hsk->ready_requests)) { |
+ tt_record1("homa_rpc_ready found first ready request id %d", |
+ list_first_entry(&hsk->ready_requests, |
+ struct homa_rpc, ready_links)->id); |
+ } else { |
+ tt_record("homa_rpc_ready found no ready requests"); |
+ } |
return; |
handoff: |
/* We found a waiting thread. Wakeup the thread and cleanup its |
* interest info, so it won't have to acquire the socket lock |
- * again. |
+ * again. This is also needed so no-one else attempts to give |
+ * this interest an RPC. |
*/ |
if (interest->reg_rpc) { |
interest->reg_rpc->interest = NULL; |