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 Nov 7 14:44:00 GMT 2018


On 11/7/18 3:27 PM, Jan Hubicka wrote:
>> On 11/5/18 10:51 AM, Jan Hubicka wrote:
>>>> @honza: PING
>>>>
>>>> On 10/3/18 12:53 PM, Martin Liška wrote:
>>>>> 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?
>>>
>>> Sure, I can prepare patch unless you beat me :)
>>
>> Are you sure there's a call to 'analyze_function' where the analysis is done
>> when one sets -fno-ipa-pure-const?
> 
> In set_nothrow_function_flags.  Probably would be good to grep for
> places where node->set_XXXX_flag is used.

Ok, so for nothrow there are 2 extra passes (GIMPLE and RTL "nothrow" pass) that set it.
But, If I'm correct we should not case in case of C language, right?

- set_malloc_flag - only called from pass_local_pure_const pass
- set_pure_flag
  a) call from set_const_flag_1 - should be fine as it's from set_const context
  b) from pass_ipa_pure_const::
  c) from tree-profile.c: 	node->set_pure_flag (false, false); - which is fine
- set_const_flag - likewise to set_pure_const (except set_const_flag_1)

>> 2018-11-07  Martin Liska  <mliska@suse.cz>
>>
>> 	* common.opt: Add -fipa-stack-alignment flag.
>> 	* doc/invoke.texi: Document it.
>> 	* final.c (rest_of_clean_state): Guard stack
>> 	shrinking with flag.
>>
>> gcc/testsuite/ChangeLog:
>>
>> 2018-11-07  Martin Liska  <mliska@suse.cz>
>>
>> 	* gcc.target/i386/ipa-stack-alignment.c: New test.
>> From 8691490a142228021ed65313a72d176d06966829 Mon Sep 17 00:00:00 2001
>> From: marxin <mliska@suse.cz>
>> Date: Wed, 7 Nov 2018 13:31:41 +0100
>> Subject: [PATCH 1/2] Come up with -fipa-reference-addressable flag.
>>
>> gcc/ChangeLog:
>>
>> 2018-11-07  Martin Liska  <mliska@suse.cz>
>>
>> 	* cgraph.h (ipa_discover_readonly_nonaddressable_vars): Rename
>> 	to ...
>> 	(ipa_discover_nonaddressable_vars): ... this.
>> 	* common.opt: Come up with new flag -fipa-reference-addressable.
>> 	* doc/invoke.texi: Document it.
>> 	* ipa-reference.c (propagate): Call the renamed fn.
>> 	* ipa-visibility.c (whole_program_function_and_variable_visibility):
>> 	Likewise.
>> 	* ipa.c (ipa_discover_readonly_nonaddressable_vars): Renamed to
>> 	...
>> 	(ipa_discover_nonaddressable_vars): ... this.  Discove
>> 	non-addressable variables only with the newly added flag.
>> 	* opts.c: Enable the newly added flag with -O1 and higher
>> 	optimization level.
> 
> Hmm, the write-only and readonly flags are not handled in here?

You mean the ChangeLog is not mentioning that ipa_discover_nonaddressable_vars
does read-only and write-only discovery?

Martin

> 
> Honza
> 



More information about the Gcc-patches mailing list