public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: Qing Zhao <qing.zhao@oracle.com>
Cc: Miroslav Benes <mbenes@suse.cz>, Jan Hubicka <hubicka@ucw.cz>,
	Martin Jambor <mjambor@suse.cz>,
	live-patching@vger.kernel.org,
	gcc Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH][RFC] Come up with -flive-patching master option.
Date: Thu, 15 Nov 2018 08:41:00 -0000	[thread overview]
Message-ID: <568496ae-24cf-7453-57db-a2188d5d11c2@suse.cz> (raw)
In-Reply-To: <8F7AEFF2-5DCE-49B6-BC9E-34FC0DEF2A55@oracle.com>

On 11/14/18 6:54 PM, Qing Zhao wrote:
> Hi, 
> 
> 
>> On Nov 14, 2018, at 9:03 AM, Martin Liška <mliska@suse.cz> wrote:
>>
>>>>
>>> Yes, you are right. I added this into my patch.
>>>
>>> I am attaching the new patch here.
>>
>> Hello.
>>
>> Please use
>> git diff HEAD~ > /tmp/patch && ~/Programming/gcc/contrib/check_GNU_style.py /tmp/patch
>>
>> in order to address many formatting issues of the patch (skip the ones reported in common.opt).
> 
> will do and fix the style issues.
> 
>>
>>>
>>>
>>> +flive-patching
>>> +Common RejectNegative Alias(flive-patching=,inline-clone) Optimization
>>> +
>>> +flive-patching=
>>> +Common Report Joined RejectNegative Enum(live_patching_level) Var(flag_live_patching) Init(LIVE_NONE) Optimization
>>> +-flive-patching=[inline-only-static|inline-clone]	Control ipa optimizations to provide a 
>>
>> Please use 'IPA' instead of 'ipa', similarly in documentation.
> Okay.
>>
>>> --- a/gcc/doc/invoke.texi
>>> +++ b/gcc/doc/invoke.texi
>>> @@ -411,10 +411,11 @@ Objective-C and Objective-C++ Dialects}.
>>> -fgcse-sm  -fhoist-adjacent-loads  -fif-conversion @gol
>>> -fif-conversion2  -findirect-inlining @gol
>>> -finline-functions  -finline-functions-called-once  -finline-limit=@var{n} @gol
>>> --finline-small-functions  -fipa-cp  -fipa-cp-clone @gol
>>> +-finline-small-functions -fipa-cp  -fipa-cp-clone @gol
>>
>> This changes is probably not intended.
> No. will delete it.
> 
>>
>>>
>>> diff --git a/gcc/flag-types.h b/gcc/flag-types.h
>>> index 500f663..72e0f0f 100644
>>> --- a/gcc/flag-types.h
>>> +++ b/gcc/flag-types.h
>>> @@ -123,6 +123,14 @@ enum stack_reuse_level
>>>   SR_ALL
>>> };
>>>
>>> +/* The live patching level. */
>>> +enum live_patching_level
>>> +{
>>> +  LIVE_NONE = 0,
>>> +  LIVE_INLINE_ONLY_STATIC,
>>> +  LIVE_INLINE_CLONE
>>
>> Maybe better LIVE_PATCHING_INLINE_CLONE, without the 'PATCHING' the enum
>> values are bit unclear.
> 
> Okay.
>>
>>>
>>> +      /* visibility change should be excluded by !flag_whole_program 
>>> +	 && !in_lto_p && !flag_ipa_cp_clone && !flag_ipa_sra 
>>
>> You added sorry about LTO, maybe then !in_lto_p would be always true?
> 
> Yes, since live-patching does not support LTO currently,  !in_lto_p is always TRUE. that’s the reason no need for a new flag to disable visibility change. 

Hi.

Ok.

>>
>>> +	 && !flag_partial_inlining.  */
>>> +      if (!opts_set->x_flag_ipa_pta)
>>> +        opts->x_flag_ipa_pta = 0;
>>> +      if (!opts_set->x_flag_ipa_reference)
>>> +        opts->x_flag_ipa_reference = 0;
>>> +      if (!opts_set->x_flag_ipa_ra)
>>> +        opts->x_flag_ipa_ra = 0;
>>> +      if (!opts_set->x_flag_ipa_icf)
>>> +        opts->x_flag_ipa_icf = 0;
>>> +      if (!opts_set->x_flag_ipa_icf_functions)
>>> +        opts->x_flag_ipa_icf_functions = 0;
>>> +      if (!opts_set->x_flag_ipa_icf_variables)
>>> +        opts->x_flag_ipa_icf_variables = 0;
>>> +      if (!opts_set->x_flag_ipa_bit_cp)
>>> +        opts->x_flag_ipa_bit_cp = 0;
>>> +      if (!opts_set->x_flag_ipa_vrp)
>>> +        opts->x_flag_ipa_vrp = 0;
>>> +      if (!opts_set->x_flag_ipa_pure_const)
>>
>> Can you please explain why you included:
>>      if (!opts_set->x_flag_ipa_bit_cp)
>>        opts->x_flag_ipa_bit_cp = 0;
>>      if (!opts_set->x_flag_ipa_vrp)
>>        opts->x_flag_ipa_vrp = 0;
> 
> interprocedural bitwise constant propagation and interprocedural propagation of value ranges does not involve creating clones,
> and the bitwise constant and value ranges info extracted during ipa-cp phase are used later by other optimizations. their effect on 
> impact functions are not clear at this moment. that’s the reason I think we need to disable these two. 
> 
> Martin Jambor raised this issue during our previous discussion on 10/03/2018:
> “
> I was thinking a bit more about this and recalled that not all stuff
> that IPA-CP nowadays does involves creating clones, so we have to add
> also:
>  - -fno-ipa-bit-cp, and
>  - -fno-ipa-vrp.
> 
> These two just record info in the parameters of *callees* of functions
> from which it extracted info, without any cloning involved.  Both were
> introduced in GCC 7.
> 
> Thanks,
> 
> Martin
> “
> and I think he is right.

Great, thanks for clarification! I forgot about that.

And please can you mention in documentation which options are disabled with -flive-patching=*?
We usually do it, e.g. take a look at '-Os' option:

```
‘-Os’ disables the following optimization flags:
-falign-functions -falign-jumps -falign-loops
-falign-labels -freorder-blocks -freorder-blocks-algorithm=stc
-freorder-blocks-and-partition -fprefetch-loop-arrays
```

> 
> 
> 
>> ?
>>
>>> +        opts->x_flag_ipa_pure_const = 0;
>>> +      /* unreachable code removal.  */
>>> +      /* discovery of functions/variables with no address taken.  */
>>
>> ^^^ these 2 comments looks misaligned.
> 
> will fix them. 
>>
>>>
>>> +++ b/gcc/testsuite/gcc.dg/live-patching-1.c
>>> @@ -0,0 +1,22 @@
>>> +/* { dg-do compile } */
>>> +/* { dg-options "-O2 -flive-patching=inline-only-static -fdump-ipa-inline" } */
>>> +
>>> +extern int sum, n, m;
>>> +
>>> +int foo (int a)
>>> +{
>>> +  return a + n;
>>> +}
>>> +
>>> +static int bar (int b)
>>> +{
>>> +  return b * m;
>>> +}
>>> +
>>> +int main()
>>> +{
>>> +  sum = foo (m) + bar (n); 
>>> +  return 0;
>>> +}
>>> +
>>> +/* { dg-final { scan-ipa-dump "foo/0 function has external linkage when the user requests only inlining static for live patching"  "inline" } } */
>>> -- 1.9.1
>>
>> It would be also handy to test the newly added option.
> 
> not sure how to test it? any suggestion?

I would just e.g. copy test for recently added
gcc.target/i386/ipa-stack-alignment.c and replace the
option with corresponding -flive-patching option.

> 
>> Please add ChangeLog entry for the patch.
> 
> Okay.

That will help you to set up a skeleton:
./contrib/mklog /tmp/patch > /tmp/changelog

> 
>> Have you bootstrapped the patch and run test-suite?
> did on aarch64. I will do it on x86_64 as well.

Good, please mentioned that when sending a patch next time.

One more nit, please use gcc_unreachable instead of gcc_assert (0).

Thanks for working on that,
Martin

> 
> thanks.
> 
> Qing
> 

  reply	other threads:[~2018-11-15  8:41 UTC|newest]

Thread overview: 124+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-18 18:58 [PATCH][Middle-end][Version 3]Add a new option to control inlining only on static functions Qing Zhao
2018-09-18 23:18 ` Martin Sebor
2018-09-19 15:07   ` Qing Zhao
2018-09-21 15:19     ` [PATCH][Middle-end][Version 4]Add " Qing Zhao
2018-09-26  1:01       ` PING: " Qing Zhao
2018-09-26 11:20       ` Alexander Monakov
2018-09-26 12:49         ` Paolo Carlini
2018-09-26 14:43         ` Qing Zhao
2018-09-26 15:18           ` Alexander Monakov
2018-09-26 23:07             ` Qing Zhao
2018-09-26 23:54               ` Alexander Monakov
2018-09-27  5:16                 ` Qing Zhao
2018-09-27  7:46                   ` Richard Biener
2018-09-27 16:30                     ` Qing Zhao
2018-09-27  8:55                   ` Alexander Monakov
2018-09-27  8:58                 ` Jan Hubicka
2018-09-27 11:12                   ` Richard Biener
2018-09-26 13:24       ` Jason Merrill
2018-09-26 13:31         ` Richard Biener
2018-09-26 13:40           ` Jason Merrill
2018-09-26 14:46             ` Jeff Law
2018-09-26 14:58               ` Jason Merrill
2018-09-26 15:10                 ` Jan Hubicka
2018-09-26 17:12                   ` Qing Zhao
2018-09-26 17:22                     ` Jan Hubicka
2018-09-26 21:36                       ` Qing Zhao
2018-09-27  9:47                         ` Jan Hubicka
2018-09-27 12:29                           ` GCC options for kernel live-patching (Was: Add a new option to control inlining only on static functions) Martin Jambor
2018-09-27 16:40                             ` Qing Zhao
2018-10-01 17:14                             ` Qing Zhao
2018-10-02  8:38                               ` Martin Jambor
2018-10-02 14:00                                 ` Qing Zhao
2018-10-02 14:11                                   ` Martin Liška
2018-10-02 14:55                                     ` Qing Zhao
2018-10-02 14:59                                       ` Martin Liška
2018-10-02 15:24                                         ` Qing Zhao
2018-10-02 17:16                                           ` Martin Liška
2018-10-02 18:34                                             ` Richard Biener
2018-10-02 21:25                                               ` Qing Zhao
2018-10-03  9:05                                                 ` Martin Liška
2018-10-03 10:53                                                 ` Martin Jambor
2018-10-03 16:11                                                   ` Qing Zhao
2018-10-04 13:20                                                     ` Richard Biener
2018-10-18 19:36                                                       ` [RFC] GCC support for live-patching Qing Zhao
2018-10-19  8:53                                                         ` Bernhard Reutner-Fischer
2018-10-19 18:33                                                           ` Qing Zhao
2018-10-24 21:16                                                             ` Alexandre Oliva
2018-10-19 14:25                                                         ` Andi Kleen
2018-10-19 18:33                                                           ` Qing Zhao
2018-10-20  6:47                                                             ` Andi Kleen
2018-10-22 13:07                                                         ` Martin Jambor
2018-10-22 17:59                                                           ` Qing Zhao
2018-10-22 15:36                                                         ` Miroslav Benes
2018-10-22 21:01                                                           ` Qing Zhao
2018-10-23  9:37                                                             ` Miroslav Benes
2018-10-23 19:54                                                               ` Qing Zhao
2018-10-24 13:17                                                                 ` Miroslav Benes
2018-10-23 13:37                                                             ` Nicolai Stange
2018-10-23 20:34                                                               ` Qing Zhao
2018-10-23 21:18                                                                 ` Nicolai Stange
2018-10-24 17:19                                                                 ` Qing Zhao
2018-10-31 22:04                                                         ` [RFC] [2nd version] " Qing Zhao
2018-10-31 22:08                                                         ` [RFC] " Qing Zhao
2018-10-03  9:23                                             ` GCC options for kernel live-patching (Was: Add a new option to control inlining only on static functions) Jan Hubicka
2018-10-03 11:27                                               ` Martin Liška
2018-10-22 10:49                                                 ` Martin Liška
     [not found]                                                   ` <20181105095135.j3mnzox6rkktkoto@kam.mff.cuni.cz>
2018-11-05 22:26                                                     ` Qing Zhao
2018-11-07 14:22                                                     ` Martin Liška
2018-11-07 14:27                                                       ` Jan Hubicka
2018-11-07 14:44                                                         ` Martin Liška
2018-11-08 14:59                                                       ` Jan Hubicka
2018-11-09 15:33                                                         ` [PATCH][RFC] Come up with -flive-patching master option Martin Liška
2018-11-09 17:43                                                           ` Qing Zhao
2018-11-10  8:51                                                             ` Martin Liška
2018-11-12  2:28                                                               ` Qing Zhao
2018-11-12  8:53                                                                 ` Martin Liška
2018-11-12 22:29                                                                   ` Qing Zhao
2018-11-13 17:49                                                                     ` Qing Zhao
2018-11-13 19:18                                                                       ` Miroslav Benes
2018-11-13 21:16                                                                         ` Qing Zhao
2018-11-14 15:03                                                                           ` Martin Liška
2018-11-14 17:54                                                                             ` Qing Zhao
2018-11-15  8:41                                                                               ` Martin Liška [this message]
2018-11-15 15:41                                                                                 ` Qing Zhao
2018-11-16  1:36                                                                                   ` [PATCH]Come " Qing Zhao
2018-11-16 15:26                                                                                     ` Martin Liška
2018-11-16 15:51                                                                                       ` Jan Hubicka
2018-11-16 16:25                                                                                         ` Qing Zhao
2018-11-16 16:05                                                                                       ` Qing Zhao
2018-11-19  8:12                                                                                         ` Martin Liška
     [not found]                                                                                           ` <F78B52B9-9F9A-4FA0-91BF-A33307D87AA8@oracle.c! ! om>
2018-11-19 15:53                                                                                           ` Qing Zhao
2018-11-20 12:10                                                                                             ` Martin Liška
2018-11-20 15:32                                                                                               ` [PATCH][Version 3]Come " Qing Zhao
2018-11-26 15:54                                                                                                 ` PING: " Qing Zhao
2018-11-30 17:04                                                                                                   ` [wwwdocs] [PATCH]introduce new -flive-patching master option into gcc9 Qing Zhao
2018-11-30 18:29                                                                                                     ` Jeff Law
2018-11-30 20:44                                                                                                       ` Qing Zhao
2018-11-28 15:52                                                                                                 ` [PATCH][Version 3]Come up with -flive-patching master option Jan Hubicka
2018-11-28 20:25                                                                                                   ` Qing Zhao
2018-11-29 16:16                                                                                                     ` Qing Zhao
2018-12-05 23:16                                                                                                     ` Question on Disable no throw for " Qing Zhao
2019-01-02 11:47                                                                                                       ` Martin Liška
2019-01-09 11:28                                                                                                         ` Martin Liška
2018-12-07 13:07                                                                                                     ` [PATCH][Version 3]Come up with " Rainer Orth
2018-12-07 15:14                                                                                                       ` Qing Zhao
2019-04-10 14:46                                                                                                 ` Jonathan Wakely
2019-04-10 19:24                                                                                                   ` Qing Zhao
2019-04-10 20:01                                                                                                     ` Jonathan Wakely
2019-04-11  8:11                                                                                                       ` Richard Biener
2018-11-14 22:05                                                                           ` [PATCH][RFC] Come " Miroslav Benes
     [not found]                                                               ` <20181110170343.g3k7j7rlydid3ahr@kam.mff.cuni.cz>
2018-11-12  9:29                                                                 ` Martin Liška
2018-11-09 18:38                                                           ` Bernhard Reutner-Fischer
2018-11-10  8:48                                                           ` Martin Liška
2018-10-03 12:18                                               ` GCC options for kernel live-patching (Was: Add a new option to control inlining only on static functions) Martin Jambor
2018-10-03 16:00                                               ` Qing Zhao
2018-10-23 12:34                             ` Performance impact of disabling non-clone IPA optimizations for the Linux kernel (was: "GCC options for kernel live-patching") Nicolai Stange
2018-10-24 14:30                               ` Jiri Kosina
2018-10-24 14:44                                 ` Miroslav Benes
2018-09-27 16:32                           ` [PATCH][Middle-end][Version 4]Add a new option to control inlining only on static functions Qing Zhao
2018-09-26 22:42                       ` Qing Zhao
2018-09-26 16:02               ` Qing Zhao
2018-09-26 15:52           ` Qing Zhao
2018-09-26 16:02             ` Jan Hubicka
2018-09-26 18:51               ` Qing Zhao

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=568496ae-24cf-7453-57db-a2188d5d11c2@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mjambor@suse.cz \
    --cc=qing.zhao@oracle.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).