From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8AC5EA04DD for ; Wed, 28 Oct 2020 11:55:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 83E27CABF; Wed, 28 Oct 2020 11:55:52 +0100 (CET) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 8DB66CABF for ; Wed, 28 Oct 2020 11:55:50 +0100 (CET) Received: by mail-wr1-f67.google.com with SMTP id g12so5142107wrp.10 for ; Wed, 28 Oct 2020 03:55:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Vu4arJkPLtlNa2jYKZEWqa4EQjkQL0aognBGWOn0MvY=; b=nhhe3kUPeHvSnK4ZXNX94dfLA9IeWDRyz/mdGeyH0meNCfsnLd+HS2kP0/Kx2FIrhJ lu7wMUkcjOpNq2Vra9b9KM5PrJDLLu8K0GUdPUYKvDKcG2EB/xq+KeR7lTWbCb/LeFix vviOQGHf7zn+5XvurlfqHlav5mlXCkwpuZRl2gCVmicBnOx0ENvdi6ro/BetpGeCvkyr M35RUu+e/8C6wRP11J200oJY35n34KpfvvgcyxiFBG2ej2yMkOMjsfWsRaBUiwKzTyrO f94oxcohOStvd3h+WC+HIQG84VPDXIC3SB/hHSzmrwDzaMngtDUf2K/xo0Xqiax49urQ CtLw== 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=Vu4arJkPLtlNa2jYKZEWqa4EQjkQL0aognBGWOn0MvY=; b=uTYqmPqYZZRJkuvCOb+/tBdBcKWDbZbadT5F+3biOud2DklhJQHES1pJsXEvH6qjjv 0MXoybGyxDtyCQMYvT7xy53oK2ShNLxBvyOy7m3l8rneghwYhACNObMLuOdVGK/gkpjO jSNaRP9MARws9vITzkqM28PsEjH900jFySNGqfiYnd88QUb4F1NNfaQx4aafzmW3cuic 0jthZBTkaemn05Pt+9/FApUrkaxI4GwcEscBDf1n7TgGy0Z3lGVrqDIjTjVhQanuI/Op 1kK7+uErS+ojFSrDlfGXSi2/HnPUtN6ILc6sE55pZ7VasAMweOMhvN5C7JBpVYZ96fHx SbPw== X-Gm-Message-State: AOAM532ohxyGcExEKMjpsMsQMoplQBApyXFV6c1vEvRXKbAJizDdwjSE HNKQ/pjgg5wfCW9pvpd6dS4= X-Google-Smtp-Source: ABdhPJzb+sE84gGtwLYslHFfdd+qi0e6GfafIblwpSdvUpuyxcFR7gTRUu64NLSd5cX9fh+Vf5sa9g== X-Received: by 2002:adf:9d81:: with SMTP id p1mr7876429wre.13.1603882550303; Wed, 28 Oct 2020 03:55:50 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id v14sm1566870wrq.46.2020.10.28.03.55.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 03:55:49 -0700 (PDT) From: luca.boccassi@gmail.com To: Lukasz Wojciechowski Cc: David Hunt , Honnappa Nagarahalli , dpdk stable Date: Wed, 28 Oct 2020 10:45:41 +0000 Message-Id: <20201028104606.3504127-182-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201028104606.3504127-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'distributor: fix handshake synchronization' has been queued to stable release 19.11.6 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: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/30/20. 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. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From c4f615c8172d4fa24d2e8486bfe0b0386b13838e Mon Sep 17 00:00:00 2001 From: Lukasz Wojciechowski Date: Sat, 17 Oct 2020 05:06:45 +0200 Subject: [PATCH] distributor: fix handshake synchronization [ upstream commit bea84d5592eb2658cf8c36214a9db75d398efa1c ] rte_distributor_return_pkt function which is run on worker cores must wait for distributor core to clear handshake on retptr64 before using those buffers. While the handshake is set distributor core controls buffers and any operations on worker side might overwrite buffers which are unread yet. Same situation appears in the legacy single distributor. Function rte_distributor_return_pkt_single shouldn't modify the bufptr64 until handshake on it is cleared by distributor lcore. Fixes: 775003ad2f96 ("distributor: add new burst-capable library") Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt Reviewed-by: Honnappa Nagarahalli --- lib/librte_distributor/rte_distributor.c | 12 ++++++++++++ lib/librte_distributor/rte_distributor_single.c | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c index 1c047f065a..c6b19a3886 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -169,6 +169,18 @@ rte_distributor_return_pkt(struct rte_distributor *d, return -EINVAL; } + /* Spin while handshake bits are set (scheduler clears it). + * Sync with worker on GET_BUF flag. + */ + while (unlikely(__atomic_load_n(&(buf->retptr64[0]), __ATOMIC_RELAXED) + & RTE_DISTRIB_GET_BUF)) { + rte_pause(); + uint64_t t = rte_rdtsc()+100; + + while (rte_rdtsc() < t) + rte_pause(); + } + /* Sync with distributor to acquire retptrs */ __atomic_thread_fence(__ATOMIC_ACQUIRE); for (i = 0; i < RTE_DIST_BURST_SIZE; i++) diff --git a/lib/librte_distributor/rte_distributor_single.c b/lib/librte_distributor/rte_distributor_single.c index abaf7730c3..f4725b1d0b 100644 --- a/lib/librte_distributor/rte_distributor_single.c +++ b/lib/librte_distributor/rte_distributor_single.c @@ -74,6 +74,10 @@ rte_distributor_return_pkt_single(struct rte_distributor_single *d, union rte_distributor_buffer_single *buf = &d->bufs[worker_id]; uint64_t req = (((int64_t)(uintptr_t)oldpkt) << RTE_DISTRIB_FLAG_BITS) | RTE_DISTRIB_RETURN_BUF; + while (unlikely(__atomic_load_n(&buf->bufptr64, __ATOMIC_RELAXED) + & RTE_DISTRIB_FLAGS_MASK)) + rte_pause(); + /* Sync with distributor on RETURN_BUF flag. */ __atomic_store_n(&(buf->bufptr64), req, __ATOMIC_RELEASE); return 0; -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-10-28 10:35:17.363747343 +0000 +++ 0182-distributor-fix-handshake-synchronization.patch 2020-10-28 10:35:11.796834322 +0000 @@ -1,8 +1,10 @@ -From bea84d5592eb2658cf8c36214a9db75d398efa1c Mon Sep 17 00:00:00 2001 +From c4f615c8172d4fa24d2e8486bfe0b0386b13838e Mon Sep 17 00:00:00 2001 From: Lukasz Wojciechowski Date: Sat, 17 Oct 2020 05:06:45 +0200 Subject: [PATCH] distributor: fix handshake synchronization +[ upstream commit bea84d5592eb2658cf8c36214a9db75d398efa1c ] + rte_distributor_return_pkt function which is run on worker cores must wait for distributor core to clear handshake on retptr64 before using those buffers. While the handshake is set distributor @@ -13,7 +15,6 @@ handshake on it is cleared by distributor lcore. Fixes: 775003ad2f96 ("distributor: add new burst-capable library") -Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt