Skip to contentSkip to conversation

nvme-tcp: don't poll a non-live queue

PATCH Superseded Sagi Grimberg 3 participants 5 messages Mar 23, 2020 NVMe

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Sagi Grimberg

author maintainer
#0 lore raw

PATCH 1/1 nvme-tcp: don't poll a non-live queue

In error recovery we might be removing the queue so check we can actually poll before we do.

---
 drivers/nvme/host/tcp.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/nvme/host/tcp.c +3 -0
index b545a9e96327..5d03a86fa69b 100644
@@ -2327,6 +2327,9 @@ static int nvme_tcp_poll(struct blk_mq_hw_ctx *hctx)
 	struct nvme_tcp_queue *queue = hctx->driver_data;
 	struct sock *sk = queue->sock->sk;
 
+	if (!test_bit(NVME_TCP_Q_LIVE, &queue->flags))
+		return 0;
+
 	set_bit(NVME_TCP_Q_POLLING, &queue->flags);
 	if (sk_can_busy_loop(sk) && skb_queue_empty_lockless(&sk->sk_receive_queue))
 		sk_busy_loop(sk, true);
Signature · 7 lines
2.20.1


_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Tested-by on v1 1/1
#1 lore raw
Quoted 6 lines

In error recovery we might be removing the queue so check we can actually poll before we do.

---

Verified to remove kernel fault caused by invalid pointer reference, seen during large writes (512K) and queue depth 32 with batch of 8. Tested on branch nvme-5.6-rc6, after adding patch this patch on top of previous patch that adds POLLING flag use by nvme_tcp_poll.

_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

author maintainer
#2 lore raw
Quoted 2 lines

Verified to remove kernel fault caused by invalid pointer reference, seen during large writes (512K) and queue depth 32 with batch of 8. Tested on branch nvme-5.6-rc6, after adding patch this patch on top of previous patch that adds POLLING flag use by nvme_tcp_poll.

The POLLING patch is not upstream yet, but shouldn't make a difference

Quoted 2 lines

But thanks for verifying.

_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

maintainer
#3 lore raw
In reply to Sagi Grimberg
Quoted 15 lines · Sagi Grimberg

In error recovery we might be removing the queue so check we can actually poll before we do.

---
 drivers/nvme/host/tcp.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/nvme/host/tcp.c +0 -0
index b545a9e96327..5d03a86fa69b 100644

drivers/nvme/host/tcp.c static int nvme_tcp_poll(struct blk_mq_hw_ctx *hctx) · line 2335

Quoted 9 lines
drivers/nvme/host/tcp.c +3 -0
@@ -2327,6 +2327,9 @@ static int nvme_tcp_poll(struct blk_mq_hw_ctx *hctx)
 	struct nvme_tcp_queue *queue = hctx->driver_data;
 	struct sock *sk = queue->sock->sk;
 
+	if (!test_bit(NVME_TCP_Q_LIVE, &queue->flags))
+		return 0;
+
 	set_bit(NVME_TCP_Q_POLLING, &queue->flags);
 	if (sk_can_busy_loop(sk) && skb_queue_empty_lockless(&sk->sk_receive_queue))
 		sk_busy_loop(sk, true);

Did I miss a patch recently? I couldn't find the "NVME_TCP_Q_POLLING" flag in any tree, so this patch doesn't apply as-is.

_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme