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 A9CEF1B49C for ; Thu, 22 Nov 2018 17:52:36 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06CD23086265; Thu, 22 Nov 2018 16:52:36 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15644BA84; Thu, 22 Nov 2018 16:52:33 +0000 (UTC) From: Kevin Traynor To: Phil Yang Cc: Honnappa Nagarahalli , Gavin Hu , Ferruh Yigit , dpdk stable Date: Thu, 22 Nov 2018 16:49:30 +0000 Message-Id: <20181122164957.13003-38-ktraynor@redhat.com> In-Reply-To: <20181122164957.13003-1-ktraynor@redhat.com> References: <20181122164957.13003-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 22 Nov 2018 16:52:36 +0000 (UTC) Subject: [dpdk-stable] patch 'kni: fix kernel FIFO synchronization' 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: Thu, 22 Nov 2018 16:52:37 -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/28/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 efdbe3a293d9234454070c92036da3cc8de9cceb Mon Sep 17 00:00:00 2001 From: Phil Yang Date: Mon, 8 Oct 2018 17:11:45 +0800 Subject: [PATCH] kni: fix kernel FIFO synchronization [ upstream commit 711859cd0d076c7abc0c96ce637129a03280645f ] Adding memory barrier to make sure the values being synced before updating fifo_write in kni_fifo_put and fifo_read in kni_fifo_get. Fixes: 3fc5ca2f6352 ("kni: initial import") Signed-off-by: Phil Yang Reviewed-by: Honnappa Nagarahalli Reviewed-by: Gavin Hu Reviewed-by: Ferruh Yigit --- kernel/linux/kni/kni_fifo.h | 16 ++++++++++------ .../eal/include/exec-env/rte_kni_common.h | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/kernel/linux/kni/kni_fifo.h b/kernel/linux/kni/kni_fifo.h index 9a4762de2..2cb3a4a7b 100644 --- a/kernel/linux/kni/kni_fifo.h +++ b/kernel/linux/kni/kni_fifo.h @@ -17,5 +17,5 @@ kni_fifo_put(struct rte_kni_fifo *fifo, void **data, uint32_t num) uint32_t i = 0; uint32_t fifo_write = fifo->write; - uint32_t fifo_read = fifo->read; + uint32_t fifo_read = smp_load_acquire(&fifo->read); uint32_t new_write = fifo_write; @@ -28,5 +28,5 @@ kni_fifo_put(struct rte_kni_fifo *fifo, void **data, uint32_t num) fifo_write = new_write; } - fifo->write = fifo_write; + smp_store_release(&fifo->write, fifo_write); return i; @@ -41,5 +41,5 @@ kni_fifo_get(struct rte_kni_fifo *fifo, void **data, uint32_t num) uint32_t i = 0; uint32_t new_read = fifo->read; - uint32_t fifo_write = fifo->write; + uint32_t fifo_write = smp_load_acquire(&fifo->write); for (i = 0; i < num; i++) { @@ -50,5 +50,5 @@ kni_fifo_get(struct rte_kni_fifo *fifo, void **data, uint32_t num) new_read = (new_read + 1) & (fifo->len - 1); } - fifo->read = new_read; + smp_store_release(&fifo->read, new_read); return i; @@ -61,5 +61,7 @@ static inline uint32_t kni_fifo_count(struct rte_kni_fifo *fifo) { - return (fifo->len + fifo->write - fifo->read) & (fifo->len - 1); + uint32_t fifo_write = smp_load_acquire(&fifo->write); + uint32_t fifo_read = smp_load_acquire(&fifo->read); + return (fifo->len + fifo_write - fifo_read) & (fifo->len - 1); } @@ -70,5 +72,7 @@ static inline uint32_t kni_fifo_free_count(struct rte_kni_fifo *fifo) { - return (fifo->read - fifo->write - 1) & (fifo->len - 1); + uint32_t fifo_write = smp_load_acquire(&fifo->write); + uint32_t fifo_read = smp_load_acquire(&fifo->read); + return (fifo_read - fifo_write - 1) & (fifo->len - 1); } diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h index cfa9448bd..58e8533be 100644 --- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h +++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h @@ -9,4 +9,5 @@ #ifdef __KERNEL__ #include +#include #define RTE_STD_C11 #else -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-22 16:47:33.247181298 +0000 +++ 0038-kni-fix-kernel-FIFO-synchronization.patch 2018-11-22 16:47:32.000000000 +0000 @@ -1,14 +1,15 @@ -From 711859cd0d076c7abc0c96ce637129a03280645f Mon Sep 17 00:00:00 2001 +From efdbe3a293d9234454070c92036da3cc8de9cceb Mon Sep 17 00:00:00 2001 From: Phil Yang Date: Mon, 8 Oct 2018 17:11:45 +0800 Subject: [PATCH] kni: fix kernel FIFO synchronization +[ upstream commit 711859cd0d076c7abc0c96ce637129a03280645f ] + Adding memory barrier to make sure the values being synced before updating fifo_write in kni_fifo_put and fifo_read in kni_fifo_get. Fixes: 3fc5ca2f6352 ("kni: initial import") -Cc: stable@dpdk.org Signed-off-by: Phil Yang Reviewed-by: Honnappa Nagarahalli