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 9AA9A46804; Tue, 27 May 2025 15:18:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 447A140A80; Tue, 27 May 2025 15:17:56 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by mails.dpdk.org (Postfix) with ESMTP id A8D6E40669 for ; Tue, 27 May 2025 15:17:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1748351875; x=1779887875; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/0O3x1TBLma/oq9aoAH+b1LJKbS3wLu41otoCYfLLuk=; b=crg4M59IygIlFDXVeGhi6Ufl49W+9A3yG2SoBxhAURu8bRCQeL0m8nMl iPnbkyCPHq7O4YaUuteVwexVVLFVBjxdOVHyyq0xB2ShDUF0HcQvt+Rcp x2CfQT5Hc4rPVtPFRDmVEkKxvhyvtLpUIosJ4j6dou8mLH+Gx5aho4xj+ 544VBjJve3TjI60r46XsOEFO0y8KUmPKJtS7sRNl5Ia++jc8JUWTIV+Tj 0JW5kcnAOEGk1Pv8l1Caw1l7Jym1kzNdxUHgsHRcsli+XEbjKMKFv91l9 jJLL8SwcwWVKGAakArSNYf+Tw7irV7htmTT2a4TjfV3jH/XY29MXM0WLm Q==; X-CSE-ConnectionGUID: 5zP4e5unRXy8rtVvexIO6Q== X-CSE-MsgGUID: 4DodkNrnSTKIo2kaVOgNhw== X-IronPort-AV: E=McAfee;i="6700,10204,11446"; a="67884839" X-IronPort-AV: E=Sophos;i="6.15,318,1739865600"; d="scan'208";a="67884839" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2025 06:17:54 -0700 X-CSE-ConnectionGUID: Pp5k6vtOTjOs3sLS2Kfquw== X-CSE-MsgGUID: i2Xk7Et0TzGrryxpkjH+mw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,318,1739865600"; d="scan'208";a="143150052" Received: from unknown (HELO silpixa00401120.ir.intel.com) ([10.55.128.58]) by fmviesa008.fm.intel.com with ESMTP; 27 May 2025 06:17:53 -0700 From: Dhanya Pillai To: Bruce Richardson , Anatoly Burakov Cc: dev@dpdk.org, Lukasz Krakowiak , Dhanya Pillai Subject: [PATCH v3 04/10] net/ice/base: set speculative execution barrier Date: Tue, 27 May 2025 13:17:23 +0000 Message-ID: <20250527131741.7606-5-dhanya.r.pillai@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250527131741.7606-1-dhanya.r.pillai@intel.com> References: <20250527131741.7606-1-dhanya.r.pillai@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Lukasz Krakowiak Fix 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 definitions. Signed-off-by: Lukasz Krakowiak Signed-off-by: Dhanya Pillai --- 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