]> git.baikalelectronics.ru Git - kernel.git/commit
cxgb4: reduce kernel stack usage in cudbg_collect_mem_region()
authorArnd Bergmann <arnd@arndb.de>
Fri, 12 Jul 2019 09:06:33 +0000 (11:06 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 12 Jul 2019 22:36:14 +0000 (15:36 -0700)
commita5d412eb6df8c450282cd20a5363d40cd5df2b80
tree51b466cf24f9aff768aaf8aad976da0adc9723e5
parent2264d6084a2f23c2628a32869f5df6168ba29322
cxgb4: reduce kernel stack usage in cudbg_collect_mem_region()

The cudbg_collect_mem_region() and cudbg_read_fw_mem() both use several
hundred kilobytes of kernel stack space. One gets inlined into the other,
which causes the stack usage to be combined beyond the warning limit
when building with clang:

drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c:1057:12: error: stack frame size of 1244 bytes in function 'cudbg_collect_mem_region' [-Werror,-Wframe-larger-than=]

Restructuring cudbg_collect_mem_region() lets clang do the same
optimization that gcc does and reuse the stack slots as it can
see that the large variables are never used together.

A better fix might be to avoid using cudbg_meminfo on the stack
altogether, but that requires a larger rewrite.

Fixes: 75c85be3c1f6 ("cxgb4: collect MC memory dump")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c