linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme-tcp: don't poll a non-live queue
@ 2020-03-23 22:13 Sagi Grimberg
  2020-03-23 23:29 ` Wunderlich, Mark
  2020-03-23 23:39 ` Keith Busch
  0 siblings, 2 replies; 5+ messages in thread
From: Sagi Grimberg @ 2020-03-23 22:13 UTC (permalink / raw)
  To: linux-nvme, Keith Busch, Christoph Hellwig, Chaitanya Kulkarni
  Cc: Mark Wunderlich

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

Reported-by: Mark Wunderlich <mark.wunderlich@intel.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 drivers/nvme/host/tcp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index b545a9e96327..5d03a86fa69b 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -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);
-- 
2.20.1


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [PATCH] nvme-tcp: don't poll a non-live queue
  2020-03-23 22:13 [PATCH] nvme-tcp: don't poll a non-live queue Sagi Grimberg
@ 2020-03-23 23:29 ` Wunderlich, Mark
  2020-03-23 23:31   ` Sagi Grimberg
  2020-03-23 23:39 ` Keith Busch
  1 sibling, 1 reply; 5+ messages in thread
From: Wunderlich, Mark @ 2020-03-23 23:29 UTC (permalink / raw)
  To: Sagi Grimberg, linux-nvme, Keith Busch, Christoph Hellwig,
	Chaitanya Kulkarni


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

>Reported-by: Mark Wunderlich <mark.wunderlich@intel.com>
>Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
>---
 
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.

Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme-tcp: don't poll a non-live queue
  2020-03-23 23:29 ` Wunderlich, Mark
@ 2020-03-23 23:31   ` Sagi Grimberg
  0 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2020-03-23 23:31 UTC (permalink / raw)
  To: Wunderlich, Mark, linux-nvme, Keith Busch, Christoph Hellwig,
	Chaitanya Kulkarni

> 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

> 
> Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>

But thanks for verifying.

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme-tcp: don't poll a non-live queue
  2020-03-23 22:13 [PATCH] nvme-tcp: don't poll a non-live queue Sagi Grimberg
  2020-03-23 23:29 ` Wunderlich, Mark
@ 2020-03-23 23:39 ` Keith Busch
  2020-03-23 23:41   ` Sagi Grimberg
  1 sibling, 1 reply; 5+ messages in thread
From: Keith Busch @ 2020-03-23 23:39 UTC (permalink / raw)
  To: Sagi Grimberg
  Cc: Chaitanya Kulkarni, Mark Wunderlich, Christoph Hellwig, linux-nvme

On Mon, Mar 23, 2020 at 03:13:15PM -0700, Sagi Grimberg wrote:
> In error recovery we might be removing the queue so check we
> can actually poll before we do.
> 
> Reported-by: Mark Wunderlich <mark.wunderlich@intel.com>
> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
> ---
>  drivers/nvme/host/tcp.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index b545a9e96327..5d03a86fa69b 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -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
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme-tcp: don't poll a non-live queue
  2020-03-23 23:39 ` Keith Busch
@ 2020-03-23 23:41   ` Sagi Grimberg
  0 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2020-03-23 23:41 UTC (permalink / raw)
  To: Keith Busch
  Cc: Chaitanya Kulkarni, Mark Wunderlich, Christoph Hellwig, linux-nvme


> 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.

You are correct, I sent a patch that does not apply. Thanks for letting
me know, I'll send a v2.

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-23 23:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23 22:13 [PATCH] nvme-tcp: don't poll a non-live queue Sagi Grimberg
2020-03-23 23:29 ` Wunderlich, Mark
2020-03-23 23:31   ` Sagi Grimberg
2020-03-23 23:39 ` Keith Busch
2020-03-23 23:41   ` Sagi Grimberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).