This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: GCC options for kernel live-patching (Was: Add a new option to control inlining only on static functions)
- From: Qing Zhao <qing dot zhao at oracle dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: Martin Liška <mliska at suse dot cz>, Martin Jambor <mjambor at suse dot cz>, live-patching at vger dot kernel dot org, gcc Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 5 Nov 2018 16:26:42 -0600
- Subject: Re: GCC options for kernel live-patching (Was: Add a new option to control inlining only on static functions)
- References: <ri6d0ssu4rt.fsf@suse.cz> <5CB6BDBE-3F49-4BFE-AF10-5E8181C49181@oracle.com> <1a023bdc-28a6-eb41-b449-4d096f12064f@suse.cz> <048D9997-B7AF-444A-BF7E-79944DE8F174@oracle.com> <add5773e-0cea-58c9-b458-bf256f81d057@suse.cz> <3E37D3A8-2D19-41C2-BA8A-8F0EFA1B4D5C@oracle.com> <10a54034-279b-a406-8466-55558effbf24@suse.cz> <20181003090457.GJ57692@kam.mff.cuni.cz> <54a75932-201b-671c-0a63-d1a5d8d7b562@suse.cz> <90c91045-cb9d-0bd2-fad3-d16426ceede6@suse.cz> <20181105095135.j3mnzox6rkktkoto@kam.mff.cuni.cz>
>>>
>>>> - 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?
>
> In expand_call
>
> /* Figure out the amount to which the stack should be aligned. */
> preferred_stack_boundary = PREFERRED_STACK_BOUNDARY;
> if (fndecl)
> {
> struct cgraph_rtl_info *i = cgraph_node::rtl_info (fndecl);
> /* Without automatic stack alignment, we can't increase preferred
> stack boundary. With automatic stack alignment, it is
> unnecessary since unless we can guarantee that all callers will
> align the outgoing stack properly, callee has to align its
> stack anyway. */
> if (i
> && i->preferred_incoming_stack_boundary
> && i->preferred_incoming_stack_boundary < preferred_stack_boundary)
> preferred_stack_boundary = i->preferred_incoming_stack_boundary;
> }
>
As I checked, in the above, i->preferred_incoming_stack_boundary is set to non-zero
when "decl_binds_to_current_def_p ()” is TRUE as the following: (in rest_of_clean_state()
of final.c)
/* We can reduce stack alignment on call site only when we are sure that
the function body just produced will be actually used in the final
executable. */
if (decl_binds_to_current_def_p (current_function_decl))
{
unsigned int pref = crtl->preferred_stack_boundary;
if (crtl->stack_alignment_needed > crtl->preferred_stack_boundary)
pref = crtl->stack_alignment_needed;
cgraph_node::rtl_info (current_function_decl)
->preferred_incoming_stack_boundary = pref;
}
It looks like that “decl_binds_to_current_def_p()” will be FALSE when the routine
is live-patched, right?
So, should we disable all the places that guided by “decl_binds_to_current_def_p()”?
thanks.
Qing