All of lore.kernel.org
 help / color / mirror / Atom feed
From: Torsten Duwe <duwe@lst.de>
To: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
	Balbir Singh <bsingharora@gmail.com>,
	"Naveen N . Rao" <naveen.n.rao@linux.vnet.ibm.com>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Jessica Yu <jeyu@kernel.org>,
	Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
	Aravinda Prasad <aravinda@linux.vnet.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, live-patching@vger.kernel.org
Subject: Re: [PATCH v2] kernel/module_64.c: Add REL24 relocation support of livepatch symbols
Date: Thu, 5 Oct 2017 14:43:13 +0200	[thread overview]
Message-ID: <20171005124313.GA25100@lst.de> (raw)
In-Reply-To: <20171004152516.25803-1-kamalesh@linux.vnet.ibm.com>

On Wed, Oct 04, 2017 at 11:25:16AM -0400, Kamalesh Babulal wrote:
> 
> Both the failures with REL24 livepatch symbols relocation, can be
> resolved by constructing a new livepatch stub. The newly setup klp_stub
> mimics the functionality of entry_64.S::livepatch_handler introduced by
> commit 85baa095497f ("powerpc/livepatch: Add live patching support on
> ppc64le").

So, do I get his right that this patch is based on your June 13 proposal
"powerpc/modules: Introduce new stub code for SHN_LIVEPATCH symbols" ?
I guess you lost many of us already at that point. What is the new, much
bigger stub code needed for? Stub code should do only the very bare minimum,
all common functionality is handled in the kernel main object.

What exactly is the problem you're trying to solve, what is to be achieved?

> +
> +	/*
> +	 * Patch the code required to load the trampoline address into r11,
> +	 * function global entry point into r12, ctr.
> +	 */
> +	entry->jump[klp_stub_idx++] = (PPC_INST_ADDIS | ___PPC_RT(11) |
> +					___PPC_RA(2) | PPC_HA(reladdr));
> +
> +	entry->jump[klp_stub_idx++] = (PPC_INST_ADDI | ___PPC_RT(11) |
> +					 ___PPC_RA(11) | PPC_LO(reladdr));
> +
> +	entry->jump[klp_stub_idx++] = (PPC_INST_LD | ___PPC_RT(12) |
> +					 ___PPC_RA(11) | 128);
							 ^^^
Also, I was a bit puzzled by this constant, BTW.
Can you #define a meaning to this, perhaps?

> @@ -201,8 +204,33 @@ livepatch_handler:
>  	ori     r12, r12, STACK_END_MAGIC@l
>  	std	r12, -8(r11)
>  
> +	/*
> +	 * klp_stub_insn/klp_stub_insn_end marks the beginning/end of the
> +	 * additional instructions, which gets patched by create_klp_stub()
> +	 * for livepatch symbol relocation stub. The instructions are:
> +	 *
> +	 * Load TOC relative address into r11. module_64.c::klp_stub_for_addr()
> +	 * identifies the available free stub slot and loads the address into
> +	 * r11 with two instructions.
> +	 *
> +	 * addis r11, r2, stub_address@ha
> +	 * addi  r11, r11, stub_address@l
> +	 *
> +	 * Load global entry into r12 from entry->funcdata offset
> +	 * ld    r12, 128(r11)

Is that the same 128 as above? Then it should definitely be a #define to
avoid inconsistencies.

	Torsten

  parent reply	other threads:[~2017-10-05 12:50 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-04 15:25 [PATCH v2] kernel/module_64.c: Add REL24 relocation support of livepatch symbols Kamalesh Babulal
2017-10-05  6:56 ` Naveen N . Rao
2017-10-05 12:43 ` Torsten Duwe [this message]
2017-10-06  5:43   ` Kamalesh Babulal
2017-10-11  9:44     ` Kamalesh Babulal
2017-10-06  5:57   ` Kamalesh Babulal
2017-10-17 14:47     ` Torsten Duwe
2017-10-18  6:17       ` Kamalesh Babulal
2017-10-20 12:07         ` Torsten Duwe
2017-10-21  0:59           ` Balbir Singh
2017-10-23  8:19             ` Kamalesh Babulal
2017-12-12 11:39               ` [PATCH] On ppc64le we HAVE_RELIABLE_STACKTRACE Torsten Duwe
2017-12-12 12:12                 ` Miroslav Benes
2017-12-12 13:02                   ` Torsten Duwe
2018-02-27 16:09                   ` [PATCH 2/2] ppc64le save_stack_trace_tsk_reliable (Was: HAVE_RELIABLE_STACKTRACE) Torsten Duwe
2018-03-08 21:43                     ` Balbir Singh
2018-03-09 15:54                       ` Torsten Duwe
2017-12-12 14:05                 ` [PATCH] On ppc64le we HAVE_RELIABLE_STACKTRACE Josh Poimboeuf
2017-12-15  9:40                   ` Nicholas Piggin
2017-12-18  2:58                     ` Josh Poimboeuf
2017-12-18  3:39                       ` Balbir Singh
2017-12-18  4:01                         ` Josh Poimboeuf
2017-12-18  5:33                       ` Nicholas Piggin
2017-12-18 18:56                         ` Josh Poimboeuf
2017-12-19  2:46                           ` Nicholas Piggin
2017-12-19 11:28                           ` Torsten Duwe
2017-12-19 21:46                             ` Josh Poimboeuf
2017-12-21 12:10                               ` Michael Ellerman
2017-12-23  4:00                                 ` Josh Poimboeuf

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=20171005124313.GA25100@lst.de \
    --to=duwe@lst.de \
    --cc=ananth@linux.vnet.ibm.com \
    --cc=aravinda@linux.vnet.ibm.com \
    --cc=bsingharora@gmail.com \
    --cc=jeyu@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=kamalesh@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.vnet.ibm.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 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.