From: Arnd Bergmann Date: Thu, 7 Mar 2019 15:58:35 +0000 (+0100) Subject: ethtool: reduce stack usage with clang X-Git-Tag: accepted/tizen/unified/20191111.065916~130 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=06a68d6dc846bd4f1765573031108c6241ec40e0;p=platform%2Fkernel%2Flinux-rpi.git ethtool: reduce stack usage with clang clang inlines the dev_ethtool() more aggressively than gcc does, leading to a larger amount of used stack space: net/core/ethtool.c:2536:24: error: stack frame size of 1216 bytes in function 'dev_ethtool' [-Werror,-Wframe-larger-than=] Marking the sub-functions that require the most stack space as noinline_for_stack gives us reasonable behavior on all compilers. Signed-off-by: Arnd Bergmann Reviewed-by: Michal Kubecek Signed-off-by: David S. Miller [sw0312.kim: cherry-pick mainline commit 3499e87ea041 to remove frame-larger-than build warning with llvm/clang] Signed-off-by: Seung-Woo Kim Change-Id: I99a8ba2db0d81a6181096ef649531e7d3fcaf3eb --- diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 996813f..ecb991b 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -2411,9 +2411,10 @@ static int ethtool_set_tunable(struct net_device *dev, void __user *useraddr) return ret; } -static int ethtool_get_per_queue_coalesce(struct net_device *dev, - void __user *useraddr, - struct ethtool_per_queue_op *per_queue_opt) +static noinline_for_stack int +ethtool_get_per_queue_coalesce(struct net_device *dev, + void __user *useraddr, + struct ethtool_per_queue_op *per_queue_opt) { u32 bit; int ret; @@ -2441,9 +2442,10 @@ static int ethtool_get_per_queue_coalesce(struct net_device *dev, return 0; } -static int ethtool_set_per_queue_coalesce(struct net_device *dev, - void __user *useraddr, - struct ethtool_per_queue_op *per_queue_opt) +static noinline_for_stack int +ethtool_set_per_queue_coalesce(struct net_device *dev, + void __user *useraddr, + struct ethtool_per_queue_op *per_queue_opt) { u32 bit; int i, ret = 0; @@ -2497,7 +2499,7 @@ roll_back: return ret; } -static int ethtool_set_per_queue(struct net_device *dev, +static int noinline_for_stack ethtool_set_per_queue(struct net_device *dev, void __user *useraddr, u32 sub_cmd) { struct ethtool_per_queue_op per_queue_opt;