drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:949:12: warning: stack frame size (1040) exceeds limit (1024) in 'hclge_dbg_dump_tm_pri'

From: kernel test robot
Date: Fri Feb 10 2023 - 19:59:58 EST


Hi Guangbin,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4cfd5afcd87eb213f08863b6f34944978b0a678d
commit: 04d96139ddb32dd15e5941c303f511a92759a5be net: hns3: refine function hclge_dbg_dump_tm_pri()
date: 1 year, 5 months ago
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20230211/202302110819.YzQu5wGF-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project db0e6591612b53910a1b366863348bdb9d7d2fb1)
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=04d96139ddb32dd15e5941c303f511a92759a5be
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 04d96139ddb32dd15e5941c303f511a92759a5be
# 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/hisilicon/hns3/hns3pf/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202302110819.YzQu5wGF-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:949:12: warning: stack frame size (1040) exceeds limit (1024) in 'hclge_dbg_dump_tm_pri' [-Wframe-larger-than]
static int hclge_dbg_dump_tm_pri(struct hclge_dev *hdev, char *buf, int len)
^
112/1040 (10.77%) spills, 928/1040 (89.23%) variables
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:722:12: warning: stack frame size (1072) exceeds limit (1024) in 'hclge_dbg_dump_tm_pg' [-Wframe-larger-than]
static int hclge_dbg_dump_tm_pg(struct hclge_dev *hdev, char *buf, int len)
^
116/1072 (10.82%) spills, 956/1072 (89.18%) variables
2 warnings generated.


vim +/hclge_dbg_dump_tm_pri +949 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c

04d96139ddb32d Guangbin Huang 2021-08-30 948
04987ca1b9b684 Guangbin Huang 2021-01-28 @949 static int hclge_dbg_dump_tm_pri(struct hclge_dev *hdev, char *buf, int len)
04987ca1b9b684 Guangbin Huang 2021-01-28 950 {
04d96139ddb32d Guangbin Huang 2021-08-30 951 char data_str[ARRAY_SIZE(tm_pri_items)][HCLGE_DBG_DATA_STR_LEN];
04d96139ddb32d Guangbin Huang 2021-08-30 952 struct hclge_tm_shaper_para c_shaper_para, p_shaper_para;
04d96139ddb32d Guangbin Huang 2021-08-30 953 char *result[ARRAY_SIZE(tm_pri_items)], *sch_mode_str;
04d96139ddb32d Guangbin Huang 2021-08-30 954 char content[HCLGE_DBG_TM_INFO_LEN];
04d96139ddb32d Guangbin Huang 2021-08-30 955 u8 pri_num, sch_mode, weight, i, j;
04d96139ddb32d Guangbin Huang 2021-08-30 956 int pos, ret;
04987ca1b9b684 Guangbin Huang 2021-01-28 957
04987ca1b9b684 Guangbin Huang 2021-01-28 958 ret = hclge_tm_get_pri_num(hdev, &pri_num);
04987ca1b9b684 Guangbin Huang 2021-01-28 959 if (ret)
04987ca1b9b684 Guangbin Huang 2021-01-28 960 return ret;
04987ca1b9b684 Guangbin Huang 2021-01-28 961
04d96139ddb32d Guangbin Huang 2021-08-30 962 for (i = 0; i < ARRAY_SIZE(tm_pri_items); i++)
04d96139ddb32d Guangbin Huang 2021-08-30 963 result[i] = &data_str[i][0];
04d96139ddb32d Guangbin Huang 2021-08-30 964
04d96139ddb32d Guangbin Huang 2021-08-30 965 hclge_dbg_fill_content(content, sizeof(content), tm_pri_items,
04d96139ddb32d Guangbin Huang 2021-08-30 966 NULL, ARRAY_SIZE(tm_pri_items));
04d96139ddb32d Guangbin Huang 2021-08-30 967 pos = scnprintf(buf, len, "%s", content);
04987ca1b9b684 Guangbin Huang 2021-01-28 968
04987ca1b9b684 Guangbin Huang 2021-01-28 969 for (i = 0; i < pri_num; i++) {
04987ca1b9b684 Guangbin Huang 2021-01-28 970 ret = hclge_tm_get_pri_sch_mode(hdev, i, &sch_mode);
04987ca1b9b684 Guangbin Huang 2021-01-28 971 if (ret)
04987ca1b9b684 Guangbin Huang 2021-01-28 972 return ret;
04987ca1b9b684 Guangbin Huang 2021-01-28 973
04987ca1b9b684 Guangbin Huang 2021-01-28 974 ret = hclge_tm_get_pri_weight(hdev, i, &weight);
04987ca1b9b684 Guangbin Huang 2021-01-28 975 if (ret)
04987ca1b9b684 Guangbin Huang 2021-01-28 976 return ret;
04987ca1b9b684 Guangbin Huang 2021-01-28 977
04987ca1b9b684 Guangbin Huang 2021-01-28 978 ret = hclge_tm_get_pri_shaper(hdev, i,
04987ca1b9b684 Guangbin Huang 2021-01-28 979 HCLGE_OPC_TM_PRI_C_SHAPPING,
04987ca1b9b684 Guangbin Huang 2021-01-28 980 &c_shaper_para);
04987ca1b9b684 Guangbin Huang 2021-01-28 981 if (ret)
04987ca1b9b684 Guangbin Huang 2021-01-28 982 return ret;
04987ca1b9b684 Guangbin Huang 2021-01-28 983
04987ca1b9b684 Guangbin Huang 2021-01-28 984 ret = hclge_tm_get_pri_shaper(hdev, i,
04987ca1b9b684 Guangbin Huang 2021-01-28 985 HCLGE_OPC_TM_PRI_P_SHAPPING,
04987ca1b9b684 Guangbin Huang 2021-01-28 986 &p_shaper_para);
04987ca1b9b684 Guangbin Huang 2021-01-28 987 if (ret)
04987ca1b9b684 Guangbin Huang 2021-01-28 988 return ret;
04987ca1b9b684 Guangbin Huang 2021-01-28 989
04987ca1b9b684 Guangbin Huang 2021-01-28 990 sch_mode_str = sch_mode & HCLGE_TM_TX_SCHD_DWRR_MSK ? "dwrr" :
04987ca1b9b684 Guangbin Huang 2021-01-28 991 "sp";
04987ca1b9b684 Guangbin Huang 2021-01-28 992
04d96139ddb32d Guangbin Huang 2021-08-30 993 j = 0;
04d96139ddb32d Guangbin Huang 2021-08-30 994 sprintf(result[j++], "%04u", i);
04d96139ddb32d Guangbin Huang 2021-08-30 995 sprintf(result[j++], "%4s", sch_mode_str);
04d96139ddb32d Guangbin Huang 2021-08-30 996 sprintf(result[j++], "%3u", weight);
04d96139ddb32d Guangbin Huang 2021-08-30 997 hclge_dbg_fill_shaper_content(&c_shaper_para, result, &j);
04d96139ddb32d Guangbin Huang 2021-08-30 998 hclge_dbg_fill_shaper_content(&p_shaper_para, result, &j);
04d96139ddb32d Guangbin Huang 2021-08-30 999 hclge_dbg_fill_content(content, sizeof(content), tm_pri_items,
04d96139ddb32d Guangbin Huang 2021-08-30 1000 (const char **)result,
04d96139ddb32d Guangbin Huang 2021-08-30 1001 ARRAY_SIZE(tm_pri_items));
04d96139ddb32d Guangbin Huang 2021-08-30 1002 pos += scnprintf(buf + pos, len - pos, "%s", content);
04987ca1b9b684 Guangbin Huang 2021-01-28 1003 }
04987ca1b9b684 Guangbin Huang 2021-01-28 1004
04987ca1b9b684 Guangbin Huang 2021-01-28 1005 return 0;
04987ca1b9b684 Guangbin Huang 2021-01-28 1006 }
04987ca1b9b684 Guangbin Huang 2021-01-28 1007

:::::: The code at line 949 was first introduced by commit
:::::: 04987ca1b9b6841cfa5f9b459c5a270b75c89345 net: hns3: add debugfs support for tm nodes, priority and qset info

:::::: TO: Guangbin Huang <huangguangbin2@xxxxxxxxxx>
:::::: CC: Jakub Kicinski <kuba@xxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests