From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7D73E426A1 for ; Mon, 2 Oct 2023 12:58:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5A62240294; Mon, 2 Oct 2023 12:58:49 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id F2A084003C; Mon, 2 Oct 2023 12:58:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696244328; x=1727780328; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1y6LRrikBdh0IqpuC6ss6GMZptkwAvWyKGgBmAdD1V4=; b=jHuJEl9leDhMFOe0w5+vamaCtXgCWC2RBVVX4iHes/tlhFva164BV7ZE krkzLGtl5TxR5kxv9QA1zt3knzl0x2wsQpqwOFF5e56hWHjMsjzoXvFaw ps0J/yUz1mdt/BafT0jopP53Wmaz+/FQeHsF+0kZz06QUo7/f6rUzO9mz 9+h6X+SF2sAlMw+9tulVELEfvG8lrJXuZ8oj+hpr7Ok46mbHHgHoWWPOy 9JRVqcXVnrufKmGHgNMIpfoXnEJhzCc+cEBBUpz12wpMe0u91UBiAfuN6 JNXfc7w+riMcTG8Ujn8lT3dJBdeiWbRcla7RNrfFJko8lDR2aPN51ur2J g==; X-IronPort-AV: E=McAfee;i="6600,9927,10850"; a="446772118" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="446772118" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 03:58:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="1494281" Received: from silpixa00401454.ir.intel.com ([10.55.128.147]) by fmviesa001.fm.intel.com with ESMTP; 02 Oct 2023 03:58:46 -0700 From: Harry van Haaren To: dev@dpdk.org Cc: jerinj@marvell.com, Harry van Haaren , stable@dpdk.org, Bruce Richardson Subject: [PATCH v3 1/2] event/sw: fix ordering corruption with op release Date: Mon, 2 Oct 2023 11:58:35 +0100 Message-Id: <20231002105836.3055379-1-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230914105852.82471-2-harry.van.haaren@intel.com> References: <20230914105852.82471-2-harry.van.haaren@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 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. There was a partial fix previously committed which is now being resolved for all cases in a more general way, hence the two fixlines here. Fixes: 2e516d18dc01 ("event/sw: fix events mis-identified as needing reorder") Fixes: 617995dfc5b2 ("event/sw: add scheduling logic") Cc: stable@dpdk.org Suggested-by: Bruce Richardson Signed-off-by: Harry van Haaren Acked-by: Bruce Richardson --- v3: - Fixup whitespace and line wrapping suggestions (Bruce) - Add Fixes lines (Bruce) - Cc stable, as this is a functionality bugfix - Including Ack from v2, as no significant code changes v2: - Rework fix to simpler suggestion (Bruce) - Respin patchset to "apply order" (Bruce) --- drivers/event/sw/sw_evdev_scheduler.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/event/sw/sw_evdev_scheduler.c b/drivers/event/sw/sw_evdev_scheduler.c index de6ed21643..cc652815e4 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,10 @@ 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; + p->hist_list[head] = (struct sw_hist_list_entry) { + .qid = qid_id, + .fid = SW_HASH_FLOWID(qe->flow_id), + }; if (keep_order) rob_ring_dequeue(qid->reorder_buffer_freelist, @@ -419,7 +423,6 @@ __pull_port_lb(struct sw_evdev *sw, uint32_t port_id, int allow_reorder) struct reorder_buffer_entry *rob_entry = hist_entry->rob_entry; - hist_entry->rob_entry = NULL; /* Although fragmentation not currently * supported by eventdev API, we support it * here. Open: How do we alert the user that -- 2.34.1