From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424781AbcBRCUU (ORCPT ); Wed, 17 Feb 2016 21:20:20 -0500 Received: from mail-ob0-f181.google.com ([209.85.214.181]:34194 "EHLO mail-ob0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422762AbcBRCUS (ORCPT ); Wed, 17 Feb 2016 21:20:18 -0500 Subject: Re: [PATCH] staging: rtl8712: reduce stack usage To: Arnd Bergmann , Florian Schilhabel , Greg Kroah-Hartman References: <1455698012-814399-1-git-send-email-arnd@arndb.de> Cc: linux-arm-kernel@lists.infradead.org, Luis de Bethencourt , Joshua Clayton , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org From: Larry Finger Message-ID: <56C52A5F.2030302@lwfinger.net> Date: Wed, 17 Feb 2016 20:20:15 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <1455698012-814399-1-git-send-email-arnd@arndb.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/17/2016 02:32 AM, Arnd Bergmann wrote: > The "translate_scan" function in rtl8712 uses a lot of stack, and > gets inlined into its single caller, r8711_wx_get_scan, which > in some configurations now blows the 1024 byte stack warning > limit: > > drivers/staging/rtl8712/rtl871x_ioctl_linux.c: In function 'r8711_wx_get_scan': > drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1227:1: error: the frame size of 1032 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] > > This somewhat reduces the stack usage by moving the translate_scan > function out of line with the noinline_for_stack annotation. > It might be possible to modify translate_scan() a little further > to reduce the stack usage, but with this patch, we can build without > the warning, the the call chain to get here is rather predictable > (sys_ioctl->vfs_ioctl->sock_ioctl->dev_ioctl->wext_ioctl-> > r8711_wx_get_scan). > > Signed-off-by: Arnd Bergmann > --- > drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) As there is no reason for translate_scan() to be inlined, this patch seems reasonable The largest user of stack likely comes from the line "struct iw_event iwe". Changing that to a pointer, and using kalloc to acquire the space would likely clear the compile message, but that would require many more changes. Acked-by: Larry Finger Larry > > diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c > index db2e31bcdd77..a15f3ce70223 100644 > --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c > +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c > @@ -137,7 +137,7 @@ static inline void handle_group_key(struct ieee_param *param, > } > } > > -static inline char *translate_scan(struct _adapter *padapter, > +static noinline_for_stack char *translate_scan(struct _adapter *padapter, > struct iw_request_info *info, > struct wlan_network *pnetwork, > char *start, char *stop) >