All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: <Daniel.Machon@microchip.com>
Cc: <petrm@nvidia.com>, <oe-kbuild-all@lists.linux.dev>,
	<linux-mm@kvack.org>, <pabeni@redhat.com>
Subject: Re: [linux-next:master 4744/6155] net/dcb/dcbnl.c:1230:1: warning: the frame size of 1244 bytes is larger than 1024 bytes
Date: Tue, 8 Nov 2022 12:49:19 +0100	[thread overview]
Message-ID: <87cz9xpslm.fsf@nvidia.com> (raw)
In-Reply-To: <Y2luYj9zmLDuiTnl@DEN-LT-70577>


<Daniel.Machon@microchip.com> writes:

>> kernel test robot <lkp@intel.com> writes:
>> 
>> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
>> > head:   d8e87774068af213ab5b058b1b114dc397b577aa
>> > commit: 6182d5875c330a5a611687caa05f47752455720c [4744/6155] net: dcb: add new apptrust attribute
>> > config: i386-buildonly-randconfig-r006-20221107
>> > compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
>> > reproduce (this is a W=1 build):
>> >         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=6182d5875c330a5a611687caa05f47752455720c
>> >         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
>> >         git fetch --no-tags linux-next master
>> >         git checkout 6182d5875c330a5a611687caa05f47752455720c
>> >         # save the config file
>> >         mkdir build_dir && cp config build_dir/.config
>> >         make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash net/dcb/
>> >
>> > If you fix the issue, kindly add following tag where applicable
>> > | Reported-by: kernel test robot <lkp@intel.com>
>> >
>> > All warnings (new ones prefixed by >>):
>> >
>> >    net/dcb/dcbnl.c: In function 'dcbnl_ieee_fill':
>> >>> net/dcb/dcbnl.c:1230:1: warning: the frame size of 1244 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>> 
>> The on-stack array that was added is pushing things:
>> 
>> > 6182d5875c330a Daniel Machon   2022-11-01  1170       if (ops->dcbnl_getapptrust) {
>> > 6182d5875c330a Daniel Machon   2022-11-01  1171               u8 selectors[IEEE_8021QAZ_APP_SEL_MAX + 1] = {0};
>> > 6182d5875c330a Daniel Machon   2022-11-01  1172               int nselectors, i;
>> > 6182d5875c330a Daniel Machon   2022-11-01  1173
>> > 6182d5875c330a Daniel Machon   2022-11-01  1174               apptrust = nla_nest_start(skb, DCB_ATTR_DCB_APP_TRUST_TABLE);
>> > 6182d5875c330a Daniel Machon   2022-11-01  1175               if (!apptrust)
>> > 6182d5875c330a Daniel Machon   2022-11-01  1176                       return -EMSGSIZE;
>> > 6182d5875c330a Daniel Machon   2022-11-01  1177
>> > 6182d5875c330a Daniel Machon   2022-11-01  1178               err = ops->dcbnl_getapptrust(netdev, selectors, &nselectors);
>> > 6182d5875c330a Daniel Machon   2022-11-01  1179               if (!err) {
>> > 6182d5875c330a Daniel Machon   2022-11-01  1180                       for (i = 0; i < nselectors; i++) {
>> > 6182d5875c330a Daniel Machon   2022-11-01  1181                               enum ieee_attrs_app type =
>> > 6182d5875c330a Daniel Machon   2022-11-01  1182                                       dcbnl_app_attr_type_get(selectors[i]);
>> > 6182d5875c330a Daniel Machon   2022-11-01  1183                               err = nla_put_u8(skb, type, selectors[i]);
>> > 6182d5875c330a Daniel Machon   2022-11-01  1184                               if (err) {
>> > 6182d5875c330a Daniel Machon   2022-11-01  1185                                       nla_nest_cancel(skb, apptrust);
>> > 6182d5875c330a Daniel Machon   2022-11-01  1186                                       return err;
>> > 6182d5875c330a Daniel Machon   2022-11-01  1187                               }
>> > 6182d5875c330a Daniel Machon   2022-11-01  1188                       }
>> > 6182d5875c330a Daniel Machon   2022-11-01  1189               }
>> > 6182d5875c330a Daniel Machon   2022-11-01  1190
>> > 6182d5875c330a Daniel Machon   2022-11-01  1191               nla_nest_end(skb, apptrust);
>> > 6182d5875c330a Daniel Machon   2022-11-01  1192       }
>> 
>> I think this should either be converted to dynamic allocation, or the
>> array size should be reduced to number of unique selectors, instead of
>> the value of the highest selector.
>
> Yep. Dynamic allocation sounds good to me. Alternatively, could we move
> the getapptrust part to a separate noinline function?

I think the reasoning behind the warning is that functions with large
frames consume too much stack space, which is scarce in kernel. Moving
the logic to a separate function might silence the warning, but wouldn't
make the issue go away.

Extracting the logic to a separate function might still make sense,
because it's going to make it easier to manage the dynamic allocation,
but is not enough on its own.

  reply	other threads:[~2022-11-08 11:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 14:39 [linux-next:master 4744/6155] net/dcb/dcbnl.c:1230:1: warning: the frame size of 1244 bytes is larger than 1024 bytes kernel test robot
2022-11-07 16:18 ` Petr Machata
2022-11-07 20:34   ` Daniel.Machon
2022-11-08 11:49     ` Petr Machata [this message]
2022-11-09  9:26       ` Daniel.Machon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cz9xpslm.fsf@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=Daniel.Machon@microchip.com \
    --cc=linux-mm@kvack.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.