All of lore.kernel.org
 help / color / mirror / Atom feed
From: huawei.libin@huawei.com (Li Bin)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 0/3] livepatch: arm64: add support for livepatch on arm64
Date: Wed, 16 Dec 2015 14:04:33 +0800	[thread overview]
Message-ID: <5670FEF1.1040104@huawei.com> (raw)
In-Reply-To: <20151215154356.GF3729@pathway.suse.cz>



on 2015/12/15 23:43, Petr Mladek wrote:
> On Mon 2015-12-14 20:49:35, Li Bin wrote:
>> This patchset depends on the on-going gcc feature "-fprolog-pad=N",
>> which will generate a pad of N nops at the beginning of each function.
>>
>> Livepatch on arm64 can using the feature (that always placing one nop
>> at the beginning of the function). And when enable/disable func patching,
>> just modify the pad code to nop or branch. And that NOP and B instruction
>> are both safe instructions on arm64 which called "concurrent modification
>> and execution of instructions", that can be executed by one thread of
>> execution as they are being modified by another thread of execution without
>> requiring explicit synchronization.
>>
>> And this method will improve performance significantly compared with the
>> method based on ftrace, especially for the critical function being frequently
>> called.
> It sounds like a great feature for ftrace. If the new prologue is usable
> for LivePatching, it should be usable to call the ftrace handler as
> well. If you teach ftrace to use the new prologue, you will not need
> all these crazy arch-specific hacks for LivePatching. Then both ftrace
> and livepatch will benefit from the feature.
>
> I suggest to read the ftrace documentation in Documentation/trace/,
> especially ftrace-design.txt. I have never ported ftrace to a new
> architecture. I guess that you need to teach scripts/recordmcount.c
>  to find the new location. Also you might need to update
> arch/arm/kernel/ftrace.c. Also please make sure that ftrace
> supports DYNAMIC_FTRACE_WITH_REGS on Arm.

Hi Petr,
I had posted one method for livepatch implementaion on arm64 based on ftrace with
DYNAMIC_FTRACE_WITH_REGS.
https://lwn.net/Articles/646317/

This requires GCC changes to support it, and I propose a method that implement -mfentry
feature which following some other arch such as x86/mips/s390 etc. This method is
architecture-specific, and Maxim Kuvyrkov propose a new method for gcc that implement
a target-independent option -fprolog-pad=N, which will generate a pad of N nops at the
beginning of each function.
https://gcc.gnu.org/ml/gcc/2015-05/msg00267.html

And based on this, DYNAMIC_FTRACE_WITH_REGS feature can be implemented as
mentioned in:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-November/386815.html

And in this patchset, I only concern the performance for livepatch on arm64, and I
hope this also can be resolved by improving ftrace, and thanks to Steve that he pointed
that he is working on a way to make ftrace a bit better for livepatch.

Thanks,
Li Bin

> It is harder but the right way to go. Your current patch set
> looks like a hack.
>
> Best Regards,
> Petr
>
> .
>

  reply	other threads:[~2015-12-16  6:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-14 12:49 [RFC PATCH 0/3] livepatch: arm64: add support for livepatch on arm64 Li Bin
2015-12-14 12:49 ` [RFC PATCH 1/3] livepatch: allow arch specific implementation Li Bin
2015-12-14 12:49 ` [RFC PATCH 2/3] livepatch: module: arm64: extract the relocation code for reuse Li Bin
2015-12-14 15:29   ` Josh Poimboeuf
2015-12-14 12:49 ` [RFC PATCH 3/3] livepatch: arm64: add support for livepatch on arm64 Li Bin
2015-12-14 15:27 ` [RFC PATCH 0/3] " Josh Poimboeuf
2015-12-15 15:43 ` Petr Mladek
2015-12-16  6:04   ` Li Bin [this message]
2015-12-17 12:36     ` Petr Mladek

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=5670FEF1.1040104@huawei.com \
    --to=huawei.libin@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.