lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202212181121.n4ylwqv0-lkp@intel.com>
Date:   Sun, 18 Dec 2022 11:33:57 +0800
From:   kernel test robot <lkp@...el.com>
To:     Yevgeny Kliteynik <kliteyn@...dia.com>
Cc:     llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
        linux-kernel@...r.kernel.org, Saeed Mahameed <saeedm@...dia.com>,
        Alex Vesker <valex@...dia.com>
Subject: drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c:1087:1:
 warning: stack frame size (1072) exceeds limit (1024) in
 'dr_rule_create_rule_nic'

Hi Yevgeny,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f9ff5644bcc04221bae56f922122f2b7f5d24d62
commit: b9b81e1e93820eb47aeaf0fe7cdda535adf8e7a4 net/mlx5: DR, For short chains of STEs, avoid allocating ste_arr dynamically
date:   7 weeks ago
config: powerpc-allyesconfig
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 98b13979fb05f3ed288a900deb843e7b27589e58)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b9b81e1e93820eb47aeaf0fe7cdda535adf8e7a4
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout b9b81e1e93820eb47aeaf0fe7cdda535adf8e7a4
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/net/ethernet/mellanox/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c:1087:1: warning: stack frame size (1072) exceeds limit (1024) in 'dr_rule_create_rule_nic' [-Wframe-larger-than]
   dr_rule_create_rule_nic(struct mlx5dr_rule *rule,
   ^
   235/1072 (21.92%) spills, 837/1072 (78.08%) variables
   1 warning generated.


vim +/dr_rule_create_rule_nic +1087 drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c

41d07074154c67 Alex Vesker       2019-08-19  1085  
41d07074154c67 Alex Vesker       2019-08-19  1086  static int
41d07074154c67 Alex Vesker       2019-08-19 @1087  dr_rule_create_rule_nic(struct mlx5dr_rule *rule,
41d07074154c67 Alex Vesker       2019-08-19  1088  			struct mlx5dr_rule_rx_tx *nic_rule,
41d07074154c67 Alex Vesker       2019-08-19  1089  			struct mlx5dr_match_param *param,
41d07074154c67 Alex Vesker       2019-08-19  1090  			size_t num_actions,
41d07074154c67 Alex Vesker       2019-08-19  1091  			struct mlx5dr_action *actions[])
41d07074154c67 Alex Vesker       2019-08-19  1092  {
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1093  	u8 hw_ste_arr_optimized[DR_RULE_MAX_STE_CHAIN_OPTIMIZED * DR_STE_SIZE] = {};
41d07074154c67 Alex Vesker       2019-08-19  1094  	struct mlx5dr_ste_send_info *ste_info, *tmp_ste_info;
41d07074154c67 Alex Vesker       2019-08-19  1095  	struct mlx5dr_matcher *matcher = rule->matcher;
41d07074154c67 Alex Vesker       2019-08-19  1096  	struct mlx5dr_domain *dmn = matcher->tbl->dmn;
41d07074154c67 Alex Vesker       2019-08-19  1097  	struct mlx5dr_matcher_rx_tx *nic_matcher;
41d07074154c67 Alex Vesker       2019-08-19  1098  	struct mlx5dr_domain_rx_tx *nic_dmn;
41d07074154c67 Alex Vesker       2019-08-19  1099  	struct mlx5dr_ste_htbl *htbl = NULL;
41d07074154c67 Alex Vesker       2019-08-19  1100  	struct mlx5dr_ste_htbl *cur_htbl;
41d07074154c67 Alex Vesker       2019-08-19  1101  	struct mlx5dr_ste *ste = NULL;
41d07074154c67 Alex Vesker       2019-08-19  1102  	LIST_HEAD(send_ste_list);
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1103  	bool hw_ste_arr_is_opt;
41d07074154c67 Alex Vesker       2019-08-19  1104  	u8 *hw_ste_arr = NULL;
41d07074154c67 Alex Vesker       2019-08-19  1105  	u32 new_hw_ste_arr_sz;
41d07074154c67 Alex Vesker       2019-08-19  1106  	int ret, i;
41d07074154c67 Alex Vesker       2019-08-19  1107  
41d07074154c67 Alex Vesker       2019-08-19  1108  	nic_matcher = nic_rule->nic_matcher;
41d07074154c67 Alex Vesker       2019-08-19  1109  	nic_dmn = nic_matcher->nic_tbl->nic_dmn;
41d07074154c67 Alex Vesker       2019-08-19  1110  
46f2a8ae8a7008 Yevgeny Kliteynik 2021-07-04  1111  	if (dr_rule_skip(dmn->type, nic_dmn->type, &matcher->mask, param,
01723919675dfa Hamdan Igbaria    2020-06-15  1112  			 rule->flow_source))
41d07074154c67 Alex Vesker       2019-08-19  1113  		return 0;
41d07074154c67 Alex Vesker       2019-08-19  1114  
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1115  	ret = mlx5dr_matcher_select_builders(matcher,
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1116  					     nic_matcher,
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1117  					     dr_rule_get_ipv(&param->outer),
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1118  					     dr_rule_get_ipv(&param->inner));
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1119  	if (ret)
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1120  		return ret;
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1121  
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1122  	hw_ste_arr_is_opt = nic_matcher->num_of_builders <= DR_RULE_MAX_STES_OPTIMIZED;
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1123  	if (likely(hw_ste_arr_is_opt)) {
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1124  		hw_ste_arr = hw_ste_arr_optimized;
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1125  	} else {
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1126  		hw_ste_arr = kzalloc((nic_matcher->num_of_builders + DR_ACTION_MAX_STES) *
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1127  				     DR_STE_SIZE, GFP_KERNEL);
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1128  
ed03a418abe8e5 Alex Vesker       2020-05-20  1129  		if (!hw_ste_arr)
ed03a418abe8e5 Alex Vesker       2020-05-20  1130  			return -ENOMEM;
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1131  	}
ed03a418abe8e5 Alex Vesker       2020-05-20  1132  
ed03a418abe8e5 Alex Vesker       2020-05-20  1133  	mlx5dr_domain_nic_lock(nic_dmn);
ed03a418abe8e5 Alex Vesker       2020-05-20  1134  
cc2295cd54e483 Yevgeny Kliteynik 2021-10-14  1135  	ret = mlx5dr_matcher_add_to_tbl_nic(dmn, nic_matcher);
cc2295cd54e483 Yevgeny Kliteynik 2021-10-14  1136  	if (ret)
cc2295cd54e483 Yevgeny Kliteynik 2021-10-14  1137  		goto free_hw_ste;
cc2295cd54e483 Yevgeny Kliteynik 2021-10-14  1138  
41d07074154c67 Alex Vesker       2019-08-19  1139  	/* Set the tag values inside the ste array */
41d07074154c67 Alex Vesker       2019-08-19  1140  	ret = mlx5dr_ste_build_ste_arr(matcher, nic_matcher, param, hw_ste_arr);
41d07074154c67 Alex Vesker       2019-08-19  1141  	if (ret)
cc2295cd54e483 Yevgeny Kliteynik 2021-10-14  1142  		goto remove_from_nic_tbl;
41d07074154c67 Alex Vesker       2019-08-19  1143  
41d07074154c67 Alex Vesker       2019-08-19  1144  	/* Set the actions values/addresses inside the ste array */
41d07074154c67 Alex Vesker       2019-08-19  1145  	ret = mlx5dr_actions_build_ste_arr(matcher, nic_matcher, actions,
41d07074154c67 Alex Vesker       2019-08-19  1146  					   num_actions, hw_ste_arr,
41d07074154c67 Alex Vesker       2019-08-19  1147  					   &new_hw_ste_arr_sz);
41d07074154c67 Alex Vesker       2019-08-19  1148  	if (ret)
cc2295cd54e483 Yevgeny Kliteynik 2021-10-14  1149  		goto remove_from_nic_tbl;
41d07074154c67 Alex Vesker       2019-08-19  1150  
41d07074154c67 Alex Vesker       2019-08-19  1151  	cur_htbl = nic_matcher->s_htbl;
41d07074154c67 Alex Vesker       2019-08-19  1152  
41d07074154c67 Alex Vesker       2019-08-19  1153  	/* Go over the array of STEs, and build dr_ste accordingly.
41d07074154c67 Alex Vesker       2019-08-19  1154  	 * The loop is over only the builders which are equal or less to the
41d07074154c67 Alex Vesker       2019-08-19  1155  	 * number of stes, in case we have actions that lives in other stes.
41d07074154c67 Alex Vesker       2019-08-19  1156  	 */
41d07074154c67 Alex Vesker       2019-08-19  1157  	for (i = 0; i < nic_matcher->num_of_builders; i++) {
41d07074154c67 Alex Vesker       2019-08-19  1158  		/* Calculate CRC and keep new ste entry */
41d07074154c67 Alex Vesker       2019-08-19  1159  		u8 *cur_hw_ste_ent = hw_ste_arr + (i * DR_STE_SIZE);
41d07074154c67 Alex Vesker       2019-08-19  1160  
41d07074154c67 Alex Vesker       2019-08-19  1161  		ste = dr_rule_handle_ste_branch(rule,
41d07074154c67 Alex Vesker       2019-08-19  1162  						nic_rule,
41d07074154c67 Alex Vesker       2019-08-19  1163  						&send_ste_list,
41d07074154c67 Alex Vesker       2019-08-19  1164  						cur_htbl,
41d07074154c67 Alex Vesker       2019-08-19  1165  						cur_hw_ste_ent,
41d07074154c67 Alex Vesker       2019-08-19  1166  						i + 1,
41d07074154c67 Alex Vesker       2019-08-19  1167  						&htbl);
41d07074154c67 Alex Vesker       2019-08-19  1168  		if (!ste) {
41d07074154c67 Alex Vesker       2019-08-19  1169  			mlx5dr_err(dmn, "Failed creating next branch\n");
41d07074154c67 Alex Vesker       2019-08-19  1170  			ret = -ENOENT;
41d07074154c67 Alex Vesker       2019-08-19  1171  			goto free_rule;
41d07074154c67 Alex Vesker       2019-08-19  1172  		}
41d07074154c67 Alex Vesker       2019-08-19  1173  
41d07074154c67 Alex Vesker       2019-08-19  1174  		cur_htbl = ste->next_htbl;
41d07074154c67 Alex Vesker       2019-08-19  1175  
41d07074154c67 Alex Vesker       2019-08-19  1176  		mlx5dr_ste_get(ste);
8a015baef50a7b Yevgeny Kliteynik 2021-07-08  1177  		mlx5dr_rule_set_last_member(nic_rule, ste, true);
41d07074154c67 Alex Vesker       2019-08-19  1178  	}
41d07074154c67 Alex Vesker       2019-08-19  1179  
41d07074154c67 Alex Vesker       2019-08-19  1180  	/* Connect actions */
41d07074154c67 Alex Vesker       2019-08-19  1181  	ret = dr_rule_handle_action_stes(rule, nic_rule, &send_ste_list,
41d07074154c67 Alex Vesker       2019-08-19  1182  					 ste, hw_ste_arr, new_hw_ste_arr_sz);
41d07074154c67 Alex Vesker       2019-08-19  1183  	if (ret) {
41d07074154c67 Alex Vesker       2019-08-19  1184  		mlx5dr_dbg(dmn, "Failed apply actions\n");
41d07074154c67 Alex Vesker       2019-08-19  1185  		goto free_rule;
41d07074154c67 Alex Vesker       2019-08-19  1186  	}
41d07074154c67 Alex Vesker       2019-08-19  1187  	ret = dr_rule_send_update_list(&send_ste_list, dmn, true);
41d07074154c67 Alex Vesker       2019-08-19  1188  	if (ret) {
41d07074154c67 Alex Vesker       2019-08-19  1189  		mlx5dr_err(dmn, "Failed sending ste!\n");
41d07074154c67 Alex Vesker       2019-08-19  1190  		goto free_rule;
41d07074154c67 Alex Vesker       2019-08-19  1191  	}
41d07074154c67 Alex Vesker       2019-08-19  1192  
41d07074154c67 Alex Vesker       2019-08-19  1193  	if (htbl)
41d07074154c67 Alex Vesker       2019-08-19  1194  		mlx5dr_htbl_put(htbl);
41d07074154c67 Alex Vesker       2019-08-19  1195  
cc2295cd54e483 Yevgeny Kliteynik 2021-10-14  1196  	nic_matcher->rules++;
cc2295cd54e483 Yevgeny Kliteynik 2021-10-14  1197  
ed03a418abe8e5 Alex Vesker       2020-05-20  1198  	mlx5dr_domain_nic_unlock(nic_dmn);
ed03a418abe8e5 Alex Vesker       2020-05-20  1199  
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1200  	if (unlikely(!hw_ste_arr_is_opt))
260986fcff81a0 Alex Vesker       2019-10-29  1201  		kfree(hw_ste_arr);
260986fcff81a0 Alex Vesker       2019-10-29  1202  
41d07074154c67 Alex Vesker       2019-08-19  1203  	return 0;
41d07074154c67 Alex Vesker       2019-08-19  1204  
41d07074154c67 Alex Vesker       2019-08-19  1205  free_rule:
41d07074154c67 Alex Vesker       2019-08-19  1206  	dr_rule_clean_rule_members(rule, nic_rule);
41d07074154c67 Alex Vesker       2019-08-19  1207  	/* Clean all ste_info's */
41d07074154c67 Alex Vesker       2019-08-19  1208  	list_for_each_entry_safe(ste_info, tmp_ste_info, &send_ste_list, send_list) {
41d07074154c67 Alex Vesker       2019-08-19  1209  		list_del(&ste_info->send_list);
41d07074154c67 Alex Vesker       2019-08-19  1210  		kfree(ste_info);
41d07074154c67 Alex Vesker       2019-08-19  1211  	}
cc2295cd54e483 Yevgeny Kliteynik 2021-10-14  1212  
cc2295cd54e483 Yevgeny Kliteynik 2021-10-14  1213  remove_from_nic_tbl:
cc2295cd54e483 Yevgeny Kliteynik 2021-10-14  1214  	mlx5dr_matcher_remove_from_tbl_nic(dmn, nic_matcher);
cc2295cd54e483 Yevgeny Kliteynik 2021-10-14  1215  
41d07074154c67 Alex Vesker       2019-08-19  1216  free_hw_ste:
ed03a418abe8e5 Alex Vesker       2020-05-20  1217  	mlx5dr_domain_nic_unlock(nic_dmn);
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1218  
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1219  	if (unlikely(!hw_ste_arr_is_opt))
41d07074154c67 Alex Vesker       2019-08-19  1220  		kfree(hw_ste_arr);
b9b81e1e93820e Yevgeny Kliteynik 2022-03-29  1221  
41d07074154c67 Alex Vesker       2019-08-19  1222  	return ret;
41d07074154c67 Alex Vesker       2019-08-19  1223  }
41d07074154c67 Alex Vesker       2019-08-19  1224  

:::::: The code at line 1087 was first introduced by commit
:::::: 41d07074154c67a587b12d2b8a8cec3707e51eb7 net/mlx5: DR, Expose steering rule functionality

:::::: TO: Alex Vesker <valex@...lanox.com>
:::::: CC: Saeed Mahameed <saeedm@...lanox.com>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (329095 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ