From: Menglong Dong <menglong8.dong@gmail.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>,
kuba@kernel.org, miguel.ojeda.sandonis@gmail.com,
ojeda@kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, asml.silence@gmail.com, imagedong@tencent.com,
luiz.von.dentz@intel.com, vasily.averin@linux.dev,
jk@codeconstruct.com.au, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, kernel test robot <lkp@intel.com>,
linux-toolchains <linux-toolchains@vger.kernel.org>
Subject: Re: [PATCH net-next v4] net: skb: prevent the split of kfree_skb_reason() by gcc
Date: Fri, 19 Aug 2022 22:55:42 +0800 [thread overview]
Message-ID: <CADxym3YEfSASDg9ppRKtZ16NLh_NhH253frd5LXZLGTObsVQ9g@mail.gmail.com> (raw)
In-Reply-To: <20220818165838.GM25951@gate.crashing.org>
Hello,
On Fri, Aug 19, 2022 at 1:00 AM Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> Hi!
>
> On Fri, Aug 19, 2022 at 12:31:44AM +0800, Menglong Dong wrote:
> > On Wed, Aug 17, 2022 at 11:54 PM Nick Desaulniers
> > <ndesaulniers@google.com> wrote:
> > > Perhaps noipa might also work here?
> >
> > In my testing, both 'noclone' and 'noipa' both work! As for the
> > '-fdisable-ipa-fnsplit', it seems it's not supported by gcc, and I
> > failed to find any documentation of it.
>
> noipa is noinline+noclone+no_icf plus assorted not separately enablable
> things. There is no reason you would want to disable all
> inter-procedural optimisations here, so you don't need noipa.
>
> You need both noinline and no_icf if you want all calls to this to be
> actual function calls, and using this specific function name. If you
> don't have noinline some calls may go missing (which may be fine for
> how you use it). If you don't have no_icf the compiler may replace the
> call with a call to another function, if that does the same thing
> semantically. You may want to prevent that as well, depending on
> exactly what you have this for.
>
Thanks for your explanation about the usage of 'noinline' and 'no_icf'!
I think 'noclone' seems enough in this case? As the function
'kfree_skb_reason' we talk about is a global function, I think that the
compiler has no reason to make it inline, or be merged with another
function.
Meanwhile, I think that the functions which use '__builtin_return_address'
should consider the optimization you mentioned above, and
I'll have a check on them by the way.
Thanks!
Menglong Dong
>
> Segher
next prev parent reply other threads:[~2022-08-19 14:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220816032846.2579217-1-imagedong@tencent.com>
2022-08-17 15:54 ` [PATCH net-next v4] net: skb: prevent the split of kfree_skb_reason() by gcc Nick Desaulniers
2022-08-18 16:31 ` Menglong Dong
2022-08-18 16:58 ` Segher Boessenkool
2022-08-19 14:55 ` Menglong Dong [this message]
2022-08-19 15:21 ` Segher Boessenkool
2022-08-20 11:00 ` Menglong Dong
2022-08-22 8:01 ` Florian Weimer
2022-08-23 16:23 ` Menglong Dong
2022-09-06 12:37 ` Florian Weimer
2022-09-06 15:30 ` Segher Boessenkool
2022-09-07 18:59 ` Florian Weimer
2022-09-07 19:47 ` Segher Boessenkool
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=CADxym3YEfSASDg9ppRKtZ16NLh_NhH253frd5LXZLGTObsVQ9g@mail.gmail.com \
--to=menglong8.dong@gmail.com \
--cc=asml.silence@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=imagedong@tencent.com \
--cc=jk@codeconstruct.com.au \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-toolchains@vger.kernel.org \
--cc=lkp@intel.com \
--cc=luiz.von.dentz@intel.com \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=ndesaulniers@google.com \
--cc=netdev@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=pabeni@redhat.com \
--cc=segher@kernel.crashing.org \
--cc=vasily.averin@linux.dev \
/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;
as well as URLs for NNTP newsgroup(s).