From patchwork Thu Sep 14 10:58:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Van Haaren, Harry" X-Patchwork-Id: 131412 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 19F9042596; Thu, 14 Sep 2023 12:59:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EEA4E402AD; Thu, 14 Sep 2023 12:59:04 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 74ABF40289 for ; Thu, 14 Sep 2023 12:59:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694689143; x=1726225143; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FKx2uFTbBSHDDo++vSt0B/vIzZWTZiqm9L1F4WDg4hQ=; b=KnuPbFBAgA3vC5Su/W9rWzPvjHcr4RhZCcC+C9rBHU7YoGDyhsU/dX7B jv6WFp7ZHYSuTwZyCu/KjYPXRl2VYSId0GVJvVAKUFSZM3dkhF2SEeVhl oUDFWgokWnMPThFOeTnts141X2rx8zijxzBrGLobQU5acjtdGYDwlOyWG JjXr7rJHj8kKWE0lJUg8JbvOpXokorgiSHE35gNHXfRmSx35ImmZ+fj3P rn906+mC+/ONbHTKgyF1G+Z9sBEgKDHoy+vF100fV+luoN9hG+4X/aJkj hiuNKTZ32Noph6UUMrX64CSx7ewj3SUcqqpYEjdkCDDM+m/XaI7UYAgJZ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10832"; a="382721330" X-IronPort-AV: E=Sophos;i="6.02,145,1688454000"; d="scan'208";a="382721330" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2023 03:59:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10832"; a="991353631" X-IronPort-AV: E=Sophos;i="6.02,145,1688454000"; d="scan'208";a="991353631" Received: from silpixa00401454.ir.intel.com ([10.55.128.147]) by fmsmga006.fm.intel.com with ESMTP; 14 Sep 2023 03:59:01 -0700 From: Harry van Haaren To: dev@dpdk.org Cc: bruce-richardson@intel.com, Harry van Haaren , Bruce Richardson Subject: [PATCH v2 1/2] event/sw: fix ordering corruption with op release Date: Thu, 14 Sep 2023 11:58:51 +0100 Message-Id: <20230914105852.82471-1-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230831164736.2472671-2-harry.van.haaren@intel.com> References: <20230831164736.2472671-2-harry.van.haaren@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This commit changes the logic in the scheduler to always reset reorder-buffer (and QID/FID) entries when writing them. This avoids stale ROB/QID/FID data re-use, which previously caused ordering issues. Before this commit, release events left the history-list in an inconsistent state, and future events with op type of forward could be incorrectly reordered. Suggested-by: Bruce Richardson Signed-off-by: Harry van Haaren Acked-by: Bruce Richardson --- v2: - Rework fix to simpler suggestion (Bruce) - Respin patchset to "apply order" (Bruce) --- drivers/event/sw/sw_evdev_scheduler.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/event/sw/sw_evdev_scheduler.c b/drivers/event/sw/sw_evdev_scheduler.c index de6ed21643..21c360770e 100644 --- a/drivers/event/sw/sw_evdev_scheduler.c +++ b/drivers/event/sw/sw_evdev_scheduler.c @@ -90,8 +90,10 @@ sw_schedule_atomic_to_cq(struct sw_evdev *sw, struct sw_qid * const qid, sw->cq_ring_space[cq]--; int head = (p->hist_head++ & (SW_PORT_HIST_LIST-1)); - p->hist_list[head].fid = flow_id; - p->hist_list[head].qid = qid_id; + p->hist_list[head] = (struct sw_hist_list_entry) { + .qid = qid_id, + .fid = flow_id, + }; p->stats.tx_pkts++; qid->stats.tx_pkts++; @@ -162,8 +164,13 @@ sw_schedule_parallel_to_cq(struct sw_evdev *sw, struct sw_qid * const qid, qid->stats.tx_pkts++; const int head = (p->hist_head & (SW_PORT_HIST_LIST-1)); - p->hist_list[head].fid = SW_HASH_FLOWID(qe->flow_id); - p->hist_list[head].qid = qid_id; + const uint32_t fid = SW_HASH_FLOWID(qe->flow_id); + p->hist_list[head] = (struct sw_hist_list_entry) { + .qid = qid_id, + .fid = fid, + }; + + if (keep_order) rob_ring_dequeue(qid->reorder_buffer_freelist,