From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by dpdk.org (Postfix) with ESMTP id BD1984C8C for ; Thu, 8 Nov 2018 19:01:24 +0100 (CET) Received: by mail-wm1-f44.google.com with SMTP id 124-v6so2190682wmw.0 for ; Thu, 08 Nov 2018 10:01:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4EIXQgZLC5bsdJm+05NcnWKf/NXjvi4Yh+jfi8Kd/6U=; b=jGw8s6Gq3ZwcgcJAq9BibJVtMxjKt+teJ+R3WP8WbdJ6bFqJ83adH/JzbK27uQR5XY 10GVss+zVEXwtwMN+PBlwIYxSVMVdp2ot4YRjLwS/QcHiUZklMkjxKU9SDeJpoJDFGHI CZ2pyCcLSSybMZoZZ5GdRiV9zkVBDP/LCKKYQLmg8KIt+QPUQHeLbgZ0ovNm/hwAL3+z lO8VpSNaApbUJk6QgXPMVG+M8xecS05aW/iZQg+5dPHNOP6mvxJ4bdquaboHkXnpILFu pXSCdbnd5PbdDbOQBr587lmSGQnUToV9d8j0NukfMyUM6GRhosTmaht0PbxbFDuww8kw L/oQ== X-Gm-Message-State: AGRZ1gI6JTDFFAxwiLX7Ml1d2ZjhrlO5RZBS7Ye9AAKoj9NH0rK2pllz XOu1OJ+jYH+NbMEHrgpYXEw= X-Google-Smtp-Source: AJdET5d1UDgjpDSA8J+7nHYembtXasfytb3r7s/sGAxBIAq5eu33cLuFYaP2vUaXqgvlT5lu/Dfadw== X-Received: by 2002:a1c:4d10:: with SMTP id o16-v6mr1977513wmh.95.1541700084301; Thu, 08 Nov 2018 10:01:24 -0800 (PST) Received: from localhost ([2a01:4b00:f419:6f00:8361:8946:ba2b:d556]) by smtp.gmail.com with ESMTPSA id z6-v6sm5901770wrs.19.2018.11.08.10.01.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Nov 2018 10:01:23 -0800 (PST) From: Luca Boccassi To: Luca Boccassi Cc: Brian Russell , dpdk stable Date: Thu, 8 Nov 2018 18:00:58 +0000 Message-Id: <20181108180111.25873-2-bluca@debian.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108180111.25873-1-bluca@debian.org> References: <20181029125329.17729-20-bluca@debian.org> <20181108180111.25873-1-bluca@debian.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'eal/linux: handle UIO read failure in interrupt handler' has been queued to LTS release 16.11.9 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: Thu, 08 Nov 2018 18:01:25 -0000 Hi, FYI, your patch has been queued to LTS release 16.11.9 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/10/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. Luca Boccassi --- >>From e8861c76c1613cb7eb785ff9b23e80f617f6994b 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 7f739140a..cce69285b 100644 --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c @@ -647,7 +647,7 @@ 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; @@ -713,6 +713,23 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) "descriptor %d: %s\n", 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 " "descriptor %d\n", events[n].data.fd); -- 2.19.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-08 17:59:30.105047182 +0000 +++ 0002-eal-linux-handle-UIO-read-failure-in-interrupt-handl.patch 2018-11-08 17:59:30.044751011 +0000 @@ -1,8 +1,10 @@ -From 349ac52bbc5264d774c7e28c62c4e3941055b9c4 Mon Sep 17 00:00:00 2001 +From e8861c76c1613cb7eb785ff9b23e80f617f6994b 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,11 +22,11 @@ 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 7f739140a..cce69285b 100644 --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c -@@ -700,7 +700,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) - bool call = false; +@@ -647,7 +647,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) + { int n, bytes_read; struct rte_intr_source *src; - struct rte_intr_callback *cb; @@ -33,7 +34,7 @@ union rte_intr_read_buffer buf; struct rte_intr_callback active_cb; -@@ -780,6 +780,23 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) +@@ -713,6 +713,23 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) "descriptor %d: %s\n", events[n].data.fd, strerror(errno));