mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: "'David Miller'" <davem@davemloft.net>, "arnd@arndb.de" <arnd@arndb.de>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"johannes.berg@intel.com" <johannes.berg@intel.com>,
	"aryabinin@virtuozzo.com" <aryabinin@virtuozzo.com>,
	"glider@google.com" <glider@google.com>,
	"dvyukov@google.com" <dvyukov@google.com>,
	"kasan-dev@googlegroups.com" <kasan-dev@googlegroups.com>,
	"nicolas.dichtel@6wind.com" <nicolas.dichtel@6wind.com>,
	"adobriyan@gmail.com" <adobriyan@gmail.com>,
	"daniel@iogearbox.net" <daniel@iogearbox.net>,
	"tgraf@suug.ch" <tgraf@suug.ch>,
	"edumazet@google.com" <edumazet@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] netlink: move nla_put_{u8,u16,u32} out of line
Date: Fri, 10 Feb 2017 12:06:56 +0000	[thread overview]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6DB0283526@AcuExch.aculab.com> (raw)
In-Reply-To: <20170209.163123.1938061993523088894.davem@davemloft.net>

From: David Miller
> Sent: 09 February 2017 21:31
> From: Arnd Bergmann <arnd@arndb.de>
> Date: Wed,  8 Feb 2017 22:18:26 +0100
> 
> > When CONFIG_KASAN is enabled, the "--param asan-stack=1" causes rather large
> > stack frames in some functions. This goes unnoticed normally because
> > CONFIG_FRAME_WARN is disabled with CONFIG_KASAN by default as of commit
> > 3f181b4d8652 ("lib/Kconfig.debug: disable -Wframe-larger-than warnings with
> > KASAN=y").
> >
> > The kernelci.org build bot however has the warning enabled and that led
> > me to investigate it a little further, as every build produces these warnings:
> >
> > net/wireless/nl80211.c:4389:1: warning: the frame size of 2240 bytes is larger than 2048 bytes [-
...
> >
> > It turns out that there is a relatively simple workaround for the netlink
> > users that currently use a local variable in order to do the type conversion:
> > Moving the three functions (for each of the typical sizes) to lib/nlattr.c
> > avoids using local variables in the caller, which drastically reduces the
> > stack usage for nl80211 and br_netlink.
> >
> > It would be good if we could enable the frame size check after that again,
> > but that should be a separate patch and it requires some more testing
> > to see which the largest acceptable frame size should be.
...
> You should only extern these things when KASAN is enabled.
> 
> The reason is that uninlining these routines makes attribute emission
> more expensive and for some applications performance of this matters.

If performance of nla_put() matters, then adding 1, 2 and 4 byte attributes
ought to be doable without writing the values to memory and later doing
(I presume) a memcpy().

I also can't help feeling that the gcc KASAN stuff needs some way to
annotate an 'extern' to say that a value passed by reference isn't
treated as an array.
Otherwise I suspect you get a lot of bloat all over the place.

	David

      reply	other threads:[~2017-02-10 12:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08 21:18 Arnd Bergmann
2017-02-09 11:28 ` Dmitry Vyukov
2017-02-09 11:55   ` Arnd Bergmann
2017-02-09 12:46     ` Dmitry Vyukov
2017-02-09 14:33       ` Arnd Bergmann
2017-02-09 15:51         ` Dmitry Vyukov
2017-02-09 17:00           ` Arnd Bergmann
2017-02-10 13:24             ` Arnd Bergmann
2017-02-13 15:03               ` Arnd Bergmann
2017-02-09 21:31 ` David Miller
2017-02-10 12:06   ` David Laight [this message]

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=063D6719AE5E284EB5DD2968C1650D6DB0283526@AcuExch.aculab.com \
    --to=david.laight@aculab.com \
    --cc=adobriyan@gmail.com \
    --cc=arnd@arndb.de \
    --cc=aryabinin@virtuozzo.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dvyukov@google.com \
    --cc=edumazet@google.com \
    --cc=glider@google.com \
    --cc=johannes.berg@intel.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=tgraf@suug.ch \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®