GCC options for kernel live-patching (Was: Add a new option to control inlining only on static functions)
Martin Liška
mliska@suse.cz
Wed Oct 3 11:27:00 GMT 2018
On 10/3/18 11:04 AM, Jan Hubicka wrote:
>>
>> That was promised to be done by Honza Hubièka. He's very skilled in IPA optimizations and he's aware
>> of optimizations that cause troubles for live-patching.
>
> :) I am not sure how skilful I am, but here is what I arrived to.
Heh! Thanks for the analysis.
>
> We have transformations that are modeled as clonning, which are
> - inlining (can't be disabled completely because of always inline, but -fno-inline
> does most of stuff)
> - cloning (disabled via -fno-ipa-cp)
> - ipa-sra (-fno-ipa-sra)
> - splitting (-fno-partial-inlining)
> These should play well with Martin's tracking code
I hope so!
>
> We propagate info about side effects of function:
> - function attribute discovery (pure, const, nothrow, malloc)
> Some of this can be disabled by -fno-ipa-pure-const, but not all
> of it.
Would it be possible to add option for the remaining ones?
Nothrow does not have flag but it is obviously not a concern
> for C++
s/C++/C?
> - ipa-pta (disabled by default, -fno-ipa-pta)
> - ipa-reference (list of accessed/modified global vars), disable by -fno-ipa-refernece
> - stack alignment requirements (no flag to disable)
Would it be possible to add flag for it? Can you please point to a location where
the optimization happen?
> - inter-procedural register allocation (-fno-ipa-ra)
>
> We perform discovery of functions/variables with no address taken and
> optimizations that are not valid otherwise such as duplicating them
> or doing skipping them for alias analysis (no flag to disable)
Can you be please more verbose here? What optimizations do you mean?
>
> Identical code folding merges function bodies that are semanticaly equivalent
> and thus one can't patch one without patching another, -fno-ipa-icf
Agree, I recommend disabling that.
>
> Unreachable code/variable removal may be concern too (no flag to disable)
For functions that should be fine and handled by my script.
For variables can be problem when a variable becomes alive But that
should be extremely rare for live-patching.
>
> Write only global variable discovery (no flag to dosable)
Similarly.
>
> Visibility changes with -flto and/or -fwhole-program
>
> We also have profile propagation (discovery of cuntions used only in cold regions,
> but that I guess is only performance issue not correctness)
> No flag to disable
Hope these 2 does not happen for current Linux kernel.
Martin
>
> Honza
>
>>
>> Martin
>>
>>>
>>> thanks.
>>>
>>> Qing
>>>
>>
More information about the Gcc-patches
mailing list