From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 9F0C91B494 for ; Fri, 23 Nov 2018 11:29:02 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C69FC04FF85; Fri, 23 Nov 2018 10:29:02 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id B27856A6B2; Fri, 23 Nov 2018 10:29:00 +0000 (UTC) From: Kevin Traynor To: Luca Boccassi Cc: Brian Russell , dpdk stable Date: Fri, 23 Nov 2018 10:26:17 +0000 Message-Id: <20181123102713.17309-13-ktraynor@redhat.com> In-Reply-To: <20181123102713.17309-1-ktraynor@redhat.com> References: <20181123102713.17309-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 23 Nov 2018 10:29:02 +0000 (UTC) Subject: [dpdk-stable] patch 'eal/linux: handle UIO read failure in interrupt handler' has been queued to stable release 18.08.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Nov 2018 10:29:03 -0000 Hi, FYI, your patch has been queued to stable release 18.08.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/29/18. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Kevin Traynor --- >>From 59824b4c554cab7bbd48a0a3112fe1a8f9241f4f Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Wed, 31 Oct 2018 18:39:45 +0000 Subject: [PATCH] eal/linux: handle UIO read failure in interrupt handler [ upstream commit 349ac52bbc5264d774c7e28c62c4e3941055b9c4 ] If a device is unplugged while an interrupt is pending, the read call to the uio device to remove it from the poll wait list can fail resulting in it being continually polled forever. This change checks for the read failing and if so, unregisters the device as an interrupt source and causes the wait list to be rebuilt. This race has been reported and observed in production. Fixes: 0a45657a6794 ("pci: rework interrupt handling") Signed-off-by: Brian Russell Signed-off-by: Luca Boccassi --- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c index 4076c6d6c..34584db88 100644 --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c @@ -628,5 +628,5 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) int n, bytes_read; struct rte_intr_source *src; - struct rte_intr_callback *cb; + struct rte_intr_callback *cb, *next; union rte_intr_read_buffer buf; struct rte_intr_callback active_cb; @@ -702,4 +702,21 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) events[n].data.fd, strerror(errno)); + /* + * The device is unplugged or buggy, remove + * it as an interrupt source and return to + * force the wait list to be rebuilt. + */ + rte_spinlock_lock(&intr_lock); + TAILQ_REMOVE(&intr_sources, src, next); + rte_spinlock_unlock(&intr_lock); + + for (cb = TAILQ_FIRST(&src->callbacks); cb; + cb = next) { + next = TAILQ_NEXT(cb, next); + TAILQ_REMOVE(&src->callbacks, cb, next); + free(cb); + } + free(src); + return -1; } else if (bytes_read == 0) RTE_LOG(ERR, EAL, "Read nothing from file " -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-23 10:22:54.583949694 +0000 +++ 0013-eal-linux-handle-UIO-read-failure-in-interrupt-handl.patch 2018-11-23 10:22:54.000000000 +0000 @@ -1,8 +1,10 @@ -From 349ac52bbc5264d774c7e28c62c4e3941055b9c4 Mon Sep 17 00:00:00 2001 +From 59824b4c554cab7bbd48a0a3112fe1a8f9241f4f Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Wed, 31 Oct 2018 18:39:45 +0000 Subject: [PATCH] eal/linux: handle UIO read failure in interrupt handler +[ upstream commit 349ac52bbc5264d774c7e28c62c4e3941055b9c4 ] + If a device is unplugged while an interrupt is pending, the read call to the uio device to remove it from the poll wait list can fail resulting in it being continually polled forever. This @@ -12,7 +14,6 @@ This race has been reported and observed in production. Fixes: 0a45657a6794 ("pci: rework interrupt handling") -Cc: stable@dpdk.org Signed-off-by: Brian Russell Signed-off-by: Luca Boccassi @@ -21,17 +22,17 @@ 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c -index 39252a887..cbac451e1 100644 +index 4076c6d6c..34584db88 100644 --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c -@@ -701,5 +701,5 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) +@@ -628,5 +628,5 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) int n, bytes_read; struct rte_intr_source *src; - struct rte_intr_callback *cb; + struct rte_intr_callback *cb, *next; union rte_intr_read_buffer buf; struct rte_intr_callback active_cb; -@@ -781,4 +781,21 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) +@@ -702,4 +702,21 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) events[n].data.fd, strerror(errno)); + /*