DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dhanya Pillai <dhanya.r.pillai@intel.com>
To: Bruce Richardson <bruce.richardson@intel.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>
Cc: dev@dpdk.org, Lukasz Krakowiak <lukaszx.krakowiak@intel.com>,
	Dhanya Pillai <dhanya.r.pillai@intel.com>
Subject: [PATCH v2 04/10] net/ice/base: set speculative execution barrier
Date: Mon, 26 May 2025 18:02:52 +0000	[thread overview]
Message-ID: <20250526180311.4573-5-dhanya.r.pillai@intel.com> (raw)
In-Reply-To: <20250526180311.4573-1-dhanya.r.pillai@intel.com>

From: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>

Fix Coverity issues related to SPECULATIVE_EXECUTION_DATA_LEAK.
This changes set speculative execution barrier to functions:

* ice_sched_add_vsi_child_nodes,
* ice_sched_add_vsi_support_nodes,
* ice_sched_move_vsi_to_agg,
* ice_prof_has_mask_idx,
* ice_alloc_prof_mask.

Also, Added memfence definations.

Coverity issue: 1207094, 1207095, 1207096, 1207099, 1207104
Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
Signed-off-by: Dhanya Pillai <dhanya.r.pillai@intel.com>
---
 drivers/net/intel/ice/base/ice_flex_pipe.c | 2 ++
 drivers/net/intel/ice/base/ice_osdep.h     | 6 ++++++
 drivers/net/intel/ice/base/ice_sched.c     | 3 +++
 3 files changed, 11 insertions(+)

diff --git a/drivers/net/intel/ice/base/ice_flex_pipe.c b/drivers/net/intel/ice/base/ice_flex_pipe.c
index 6dd5588f85..dc8c92e203 100644
--- a/drivers/net/intel/ice/base/ice_flex_pipe.c
+++ b/drivers/net/intel/ice/base/ice_flex_pipe.c
@@ -1280,6 +1280,7 @@ ice_prof_has_mask_idx(struct ice_hw *hw, enum ice_block blk, u8 prof, u16 idx,
 			if (hw->blk[blk].masks.masks[i].in_use &&
 			    hw->blk[blk].masks.masks[i].idx == idx) {
 				found = true;
+				ice_memfence_read();
 				if (hw->blk[blk].masks.masks[i].mask == mask)
 					match = true;
 				break;
@@ -1648,6 +1649,7 @@ ice_alloc_prof_mask(struct ice_hw *hw, enum ice_block blk, u16 idx, u16 mask,
 			/* if mask is in use and it exactly duplicates the
 			 * desired mask and index, then in can be reused
 			 */
+			ice_memfence_read();
 			if (hw->blk[blk].masks.masks[i].mask == mask &&
 			    hw->blk[blk].masks.masks[i].idx == idx) {
 				found_copy = true;
diff --git a/drivers/net/intel/ice/base/ice_osdep.h b/drivers/net/intel/ice/base/ice_osdep.h
index ad6cde9896..7588ad3dbc 100644
--- a/drivers/net/intel/ice/base/ice_osdep.h
+++ b/drivers/net/intel/ice/base/ice_osdep.h
@@ -203,6 +203,12 @@ struct __rte_packed_begin ice_virt_mem {
 #define ice_memset(a, b, c, d) memset((a), (b), (c))
 #define ice_memcpy(a, b, c, d) rte_memcpy((a), (b), (c))
 
+/* Memory fence barrier */
+#define ice_memfence_read()
+#define ice_memfence_read_write()
+#define ice_memfence_write()
+
+
 /* SW spinlock */
 struct ice_lock {
 	rte_spinlock_t spinlock;
diff --git a/drivers/net/intel/ice/base/ice_sched.c b/drivers/net/intel/ice/base/ice_sched.c
index a8a149f541..be9393a7d6 100644
--- a/drivers/net/intel/ice/base/ice_sched.c
+++ b/drivers/net/intel/ice/base/ice_sched.c
@@ -1748,6 +1748,7 @@ ice_sched_add_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,
 				node = node->sibling;
 			}
 		} else {
+			ice_memfence_read();
 			parent = parent->children[0];
 		}
 	}
@@ -1840,6 +1841,7 @@ ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_handle,
 		/* The newly added node can be a new parent for the next
 		 * layer nodes
 		 */
+		ice_memfence_read();
 		if (num_added)
 			parent = ice_sched_find_node_by_teid(tc_node,
 							     first_node_teid);
@@ -2431,6 +2433,7 @@ ice_sched_move_vsi_to_agg(struct ice_port_info *pi, u16 vsi_handle, u32 agg_id,
 		/* The newly added node can be a new parent for the next
 		 * layer nodes
 		 */
+		ice_memfence_read();
 		if (num_nodes_added)
 			parent = ice_sched_find_node_by_teid(tc_node,
 							     first_node_teid);
-- 
2.43.0


  parent reply	other threads:[~2025-05-26 18:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-26 18:02 [PATCH v2 00/10] Update ice base code Dhanya Pillai
2025-05-26 18:02 ` [PATCH v2 01/10] net/ice/base: type conversion fix Dhanya Pillai
2025-05-26 18:02 ` [PATCH v2 02/10] net/ice/base: typo fix in media type check Dhanya Pillai
2025-05-26 18:02 ` [PATCH v2 03/10] net/ice/base: integer overflow issue fix Dhanya Pillai
2025-05-26 18:02 ` Dhanya Pillai [this message]
2025-05-26 18:02 ` [PATCH v2 05/10] net/ice/base: typo fix in desc for dev ID 579F Dhanya Pillai
2025-05-26 18:02 ` [PATCH v2 06/10] net/ice/base: ptp minimal refactoring Dhanya Pillai
2025-05-26 18:02 ` [PATCH v2 07/10] net/ice/base: support for MAC rule with own filter flags Dhanya Pillai
2025-05-26 18:02 ` [PATCH v2 08/10] net/ice/base: configure PHY FEC error in logs for GNRD Dhanya Pillai
2025-05-26 18:02 ` [PATCH v2 09/10] net/ice/base: increase reset timeout to 20 seconds Dhanya Pillai
2025-05-26 18:02 ` [PATCH v2 10/10] net/ice/base: update version info Dhanya Pillai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250526180311.4573-5-dhanya.r.pillai@intel.com \
    --to=dhanya.r.pillai@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=lukaszx.krakowiak@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).