public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ramana Radhakrishnan <ramana.radhakrishnan@foss.arm.com>
To: Alexander Monakov <amonakov@ispras.ru>,
	Ramana Radhakrishnan <ramana.gcc@googlemail.com>
Cc: Szabolcs Nagy <szabolcs.nagy@arm.com>,
	Andrew Pinski <pinskia@gmail.com>,
	Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>,
	Li Bin <huawei.libin@huawei.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	Marcus Shawcroft <marcus.shawcroft@arm.com>,
	Richard Earnshaw <richard.earnshaw@arm.com>,
	andrew.wafaa@arm.com, masami.hiramatsu.pt@hitachi.com,
	geoff@infradead.org, Takahiro Akashi <takahiro.akashi@linaro.org>,
	guohanjun@huawei.com, "Yangfei (Felix)" <felix.yang@huawei.com>,
	jiangjiji@huawei.com, nd <nd@arm.com>
Subject: Re: [PATCH] [AArch64] support -mfentry feature for arm64
Date: Mon, 18 Apr 2016 13:57:00 -0000	[thread overview]
Message-ID: <5714E7C3.5030704@foss.arm.com> (raw)
In-Reply-To: <alpine.LNX.2.20.1604181636380.3543@monopod.intra.ispras.ru>



On 18/04/16 14:44, Alexander Monakov wrote:
> On Mon, 18 Apr 2016, Ramana Radhakrishnan wrote:
>> On Mon, Apr 18, 2016 at 2:26 PM, Alexander Monakov <amonakov@ispras.ru> wrote:
>>> On Thu, 14 Apr 2016, Szabolcs Nagy wrote:
>>>> looking at [2] i don't see why
>>>>
>>>> func:
>>>>   mov x9, x30
>>>>   bl _tracefunc
>>>>   <function body>
>>>>
>>>> is not good for the kernel.
>>>>
>>>> mov x9, x30 is a nop at function entry, so in
>>>> theory 4 byte atomic write should be enough
>>>> to enable/disable tracing.
>>>
>>> Overwriting x9 can be problematic because GCC has gained the ability to track
>>> register usage interprocedurally: if foo() calls bar(), and GCC has already
>>> emitted code for bar() and knows that it cannot change x9, it can use that
>>> knowledge to avoid saving/restoring x9 in foo() around calls to bar(). See
>>> option '-fipa-ra'.
>>>
>>> If there's no register that can be safely used in place of x9 here, then
>>> the backend should emit the entry/pad appropriately (e.g. with an unspec that
>>> clobbers the possibly-overwritten register).
>>
>> Can you not use one of x16 / x17 the intra-procedure-call scratch
>> registers as per the PCS ?
> 
> As long as:
> 
> - there's a guarantee that the call to _tracefunc wouldn't need some kind of
>   veneer that would clobber those; I don't know enough about AArch64 to say;
> 

A veneer could clobber them, yeah .

> - and GCC is not smart enough to be aware that intra-TU calls to 'func' (the
>   function we're instrumenting) don't touch x16/x17.  And GCC should be that
>   smart, if it's not, it's a bug, right? :)
> 

That it already is - IIRC. Otherwise -fipa-ra wouldn't work .

Alternatively just add x9 to the list for fipa-ra the same way as x16 / x17 are handled already , no ?

Ramana

> Thanks.
> Alexander
> 

  reply	other threads:[~2016-04-18 13:57 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-14  8:13 Li Bin
2016-03-14  8:12 ` Li Bin
2016-04-14 13:08 ` Maxim Kuvyrkov
2016-04-14 13:15   ` Andrew Pinski
2016-04-14 15:58     ` Szabolcs Nagy
2016-04-18 13:26       ` Alexander Monakov
2016-04-18 13:34         ` Ramana Radhakrishnan
2016-04-18 13:44           ` Alexander Monakov
2016-04-18 13:57             ` Ramana Radhakrishnan [this message]
2016-04-18 14:03               ` Alexander Monakov
2016-04-18 14:31         ` Szabolcs Nagy
2016-04-18 15:54           ` Alexander Monakov
2016-04-19  6:46             ` AKASHI Takahiro
2016-04-19  6:13       ` AKASHI Takahiro
2016-04-19  6:44         ` Alexander Monakov
2016-04-20  0:33           ` AKASHI Takahiro
2016-04-20 10:02             ` Szabolcs Nagy
2016-04-15 15:40   ` Michael Matz
2016-04-15 17:29     ` Alexander Monakov
2016-04-17 15:06       ` Alexander Monakov
2016-04-18 12:12         ` Michael Matz
2016-04-19  6:26           ` AKASHI Takahiro
2016-04-19  6:39             ` Alexander Monakov
2016-04-20  1:23               ` AKASHI Takahiro
2016-04-20 16:45                 ` Szabolcs Nagy
2016-04-19 16:03           ` Torsten Duwe
2016-04-18 14:32       ` Andrew Haley
2016-04-18 17:13         ` Michael Matz
2016-04-18 17:17           ` Andrew Haley
2016-04-18 17:34             ` Michael Matz
2016-04-19  8:00               ` Andrew Haley
2016-04-19 13:19                 ` Michael Matz
2016-04-19 13:25                   ` Andrew Haley
2016-04-19 14:38                     ` Pedro Alves
2016-04-19 15:02                       ` Andrew Haley
2016-04-19  6:08   ` AKASHI Takahiro
  -- strict thread matches above, loose matches on Subject: below --
2015-10-22 13:24 Li Bin
2015-10-22 13:53 ` Marcus Shawcroft

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=5714E7C3.5030704@foss.arm.com \
    --to=ramana.radhakrishnan@foss.arm.com \
    --cc=amonakov@ispras.ru \
    --cc=andrew.wafaa@arm.com \
    --cc=felix.yang@huawei.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=geoff@infradead.org \
    --cc=guohanjun@huawei.com \
    --cc=huawei.libin@huawei.com \
    --cc=jiangjiji@huawei.com \
    --cc=marcus.shawcroft@arm.com \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=maxim.kuvyrkov@linaro.org \
    --cc=nd@arm.com \
    --cc=pinskia@gmail.com \
    --cc=ramana.gcc@googlemail.com \
    --cc=richard.earnshaw@arm.com \
    --cc=szabolcs.nagy@arm.com \
    --cc=takahiro.akashi@linaro.org \
    /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).