Re: [PATCH] rt2500usb: don't mark register accesses as inline

2 messages, 2 authors, 2017-02-15 · open the first message on its own page

Re: [PATCH] rt2500usb: don't mark register accesses as inline

From: Kalle Valo <hidden>
Date: 2017-02-15 05:50:00

Arnd Bergmann [off-list ref] writes:
When CONFIG_KASAN is set, we get a rather large stack here:

drivers/net/wireless/ralink/rt2x00/rt2500usb.c: In function 'rt2500usb_set_device_state':
drivers/net/wireless/ralink/rt2x00/rt2500usb.c:1074:1: error: the frame size of 3032 bytes is larger than 100 bytes [-Werror=frame-larger-than=]

If we don't force those functions to be inline, the compiler can figure this
out better itself and not inline the functions when doing so would be harmful,
reducing the stack size to a merge 256 bytes.

Note that there is another problem that manifests in this driver, as a result
of the typecheck() macro causing even larger stack frames.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
[...]
-static inline void rt2500usb_register_multiread(struct rt2x00_dev *rt2x00dev,
-						const unsigned int offset,
-						void *value, const u16 length)
-{
-	rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_READ,
-				      USB_VENDOR_REQUEST_IN, offset,
-				      value, length);
-}
-
I guess you removed this because it was not actually used anywhere? Just
checking.

-- 
Kalle Valo

Re: [PATCH] rt2500usb: don't mark register accesses as inline

From: Arnd Bergmann <arnd@arndb.de>
Date: 2017-02-15 07:49:03

On Wed, Feb 15, 2017 at 6:49 AM, Kalle Valo [off-list ref] wrote:
Arnd Bergmann [off-list ref] writes:
quoted
When CONFIG_KASAN is set, we get a rather large stack here:

drivers/net/wireless/ralink/rt2x00/rt2500usb.c: In function 'rt2500usb_set_device_state':
drivers/net/wireless/ralink/rt2x00/rt2500usb.c:1074:1: error: the frame size of 3032 bytes is larger than 100 bytes [-Werror=frame-larger-than=]

If we don't force those functions to be inline, the compiler can figure this
out better itself and not inline the functions when doing so would be harmful,
reducing the stack size to a merge 256 bytes.

Note that there is another problem that manifests in this driver, as a result
of the typecheck() macro causing even larger stack frames.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
[...]
quoted
-static inline void rt2500usb_register_multiread(struct rt2x00_dev *rt2x00dev,
-                                             const unsigned int offset,
-                                             void *value, const u16 length)
-{
-     rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_READ,
-                                   USB_VENDOR_REQUEST_IN, offset,
-                                   value, length);
-}
-
I guess you removed this because it was not actually used anywhere? Just
checking.
Correct, if I just remove the 'inline' annotation, we get a warning about an
unused function here. Sorry for not mentioning that in the changelog.

    Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help