Re: ppc64le reliable stack unwinder and scheduled tasks

2019-01-13 Thread Torsten Duwe
On Sun, 13 Jan 2019 23:33:56 +1100 Balbir Singh wrote: > On Sat, Jan 12, 2019 at 02:45:41AM -0600, Segher Boessenkool wrote: > > On Sat, Jan 12, 2019 at 12:09:14PM +1100, Balbir Singh wrote: > > > Could you please define interesting frame on top a bit more? > > > Usually the topmost return

Re: [PATCH v3] ppc64le livepatch: implement reliable stacktrace for newer consistency models

2018-05-09 Thread Torsten Duwe
On Wed, May 09, 2018 at 11:41:09AM +1000, Michael Ellerman wrote: > Josh Poimboeuf writes: > > > Generally we refer to it as "the consistency model". [...] > > We use "powerpc" as the prefix. > > So I've used: > > powerpc/livepatch: Implement reliable stack tracing for

Re: [PATCH v3] ppc64le livepatch: implement reliable stacktrace for newer consistency models

2018-05-08 Thread Torsten Duwe
On Mon, 7 May 2018 10:42:08 -0500 Josh Poimboeuf wrote: > The subject doesn't actively describe what the patch does, maybe > change it to something like: > > powerpc: Add support for HAVE_RELIABLE_STACKTRACE > > or maybe > > powerpc: Add support for livepatch

[PATCH v3] On ppc64le we HAVE_RELIABLE_STACKTRACE

2018-05-04 Thread Torsten Duwe
or ppc64le that checks for the above conditions, where possible. Signed-off-by: Torsten Duwe <d...@suse.de> Signed-off-by: Nicolai Stange <nsta...@suse.de> --- v3: * big bunch of fixes, credits go to Nicolai Stange: - get the correct return address from the graph tracer, should

Re: [PATCH v2] On ppc64le we HAVE_RELIABLE_STACKTRACE

2018-03-09 Thread Torsten Duwe
On Thu, 8 Mar 2018 10:26:16 -0600 Josh Poimboeuf wrote: > This doesn't seem to address some of my previous concerns: You're right. That discussion quickly headed towards objtool and I forgot about this one paragraph with the remarks. > - Bailing on interrupt/exception

Re: [PATCH 2/2] ppc64le save_stack_trace_tsk_reliable (Was: HAVE_RELIABLE_STACKTRACE)

2018-03-09 Thread Torsten Duwe
On Fri, 9 Mar 2018 08:43:33 +1100 Balbir Singh <bsinghar...@gmail.com> wrote: > On Tue, 27 Feb 2018 17:09:24 +0100 > Torsten Duwe <d...@lst.de> wrote: > > +save_stack_trace_tsk_reliable(struct task_struct *tsk, > > + struct stack_tr

[PATCH v2] On ppc64le we HAVE_RELIABLE_STACKTRACE

2018-03-05 Thread Torsten Duwe
patch may be unneccessarily limited to ppc64le, but OTOH the only user of this flag so far is livepatching, which is only implemented on PPCs with 64-LE, a.k.a. ELF ABI v2. This change also implements save_stack_trace_tsk_reliable() for ppc64 that checks for the above conditions, where possible. Signed-off-by:

[PATCH 2/2] ppc64le save_stack_trace_tsk_reliable (Was: HAVE_RELIABLE_STACKTRACE)

2018-02-27 Thread Torsten Duwe
cessful exit stricter, i.e. hit the initial stack value exactly instead of just a window. Also, the check for kernel code looks clumsy IMHO. IOW: Comments more than welcome! Most of it is Copy, nonetheless: Signed-off-by: Torsten Duwe <d...@suse.de> diff --git a/arch/powerpc/kernel/stacktrac

Re: [PATCH] On ppc64le we HAVE_RELIABLE_STACKTRACE

2017-12-19 Thread Torsten Duwe
On Mon, Dec 18, 2017 at 12:56:22PM -0600, Josh Poimboeuf wrote: > On Mon, Dec 18, 2017 at 03:33:34PM +1000, Nicholas Piggin wrote: > > On Sun, 17 Dec 2017 20:58:54 -0600 > > Josh Poimboeuf wrote: > > > > > On Fri, Dec 15, 2017 at 07:40:09PM +1000, Nicholas Piggin wrote: > >

Re: [PATCH] On ppc64le we HAVE_RELIABLE_STACKTRACE

2017-12-12 Thread Torsten Duwe
On Tue, Dec 12, 2017 at 01:12:37PM +0100, Miroslav Benes wrote: > > I think that this is not enough. You need to also implement > save_stack_trace_tsk_reliable() for powerpc defined as __weak in > kernel/stacktrace.c. See arch/x86/kernel/stacktrace.c for reference, but I > think it would be

[PATCH] On ppc64le we HAVE_RELIABLE_STACKTRACE

2017-12-12 Thread Torsten Duwe
patch may be unneccessarily limited to ppc64le, but OTOH the only user of this flag so far is livepatching, which is only implemented on PPCs with 64-LE, a.k.a. ELF ABI v2. Signed-off-by: Torsten Duwe <d...@suse.de> --- diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index c51e6ce42e

Re: [PATCH v3] kernel/module_64.c: Add REL24 relocation support of livepatch symbols

2017-11-07 Thread Torsten Duwe
On Tue, Nov 07, 2017 at 07:34:29PM +1100, Michael Ellerman wrote: > Josh Poimboeuf <jpoim...@redhat.com> writes: > > > On Tue, Oct 31, 2017 at 07:39:59PM +0100, Torsten Duwe wrote: > >> On Tue, Oct 31, 2017 at 09:53:16PM +0530, Naveen N . Rao wrote: > >> &

Re: [PATCH v3] kernel/module_64.c: Add REL24 relocation support of livepatch symbols

2017-10-31 Thread Torsten Duwe
On Tue, Oct 31, 2017 at 09:53:16PM +0530, Naveen N . Rao wrote: > On 2017/10/31 03:30PM, Torsten Duwe wrote: > > > > Maybe I failed to express my views properly; I find the whole approach [...] > > NAK'd-by: Torsten Duwe <d...@suse.de> > > Hmm... that wasn't evid

Re: [PATCH v3] kernel/module_64.c: Add REL24 relocation support of livepatch symbols

2017-10-31 Thread Torsten Duwe
asked questions previously because it would have never come to my mind that someone would deliberately, without a compelling reason, creates broken live patch modules and then tries to fix them up with some ugly band-aid in the kernel. So for the record: NAK'd-by: Torsten Duwe <d...@suse.de> Torsten

Re: [PATCH v2] kernel/module_64.c: Add REL24 relocation support of livepatch symbols

2017-10-20 Thread Torsten Duwe
On Wed, Oct 18, 2017 at 11:47:35AM +0530, Kamalesh Babulal wrote: > > Consider a trivial patch, supplied to kpatch tool for generating a > livepatch module: > > --- a/fs/proc/meminfo.c > +++ b/fs/proc/meminfo.c > @@ -132,7 +132,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) >

Re: [PATCH v2] kernel/module_64.c: Add REL24 relocation support of livepatch symbols

2017-10-17 Thread Torsten Duwe
On Fri, Oct 06, 2017 at 11:27:42AM +0530, Kamalesh Babulal wrote: > > Consider the livepatch sequence[1]. Where function A calls B, B is the > function which has been livepatched and the call to function B is > redirected to patched version P. P calls the function C in M2, whereas > C was local to

Re: [PATCH v2] kernel/module_64.c: Add REL24 relocation support of livepatch symbols

2017-10-05 Thread Torsten Duwe
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

Re: [PATCH] powerpc: conditionally compile platform-specific serial drivers

2017-06-28 Thread Torsten Duwe
those embedded platforms. > Signed-off-by: Hannes Reinecke <h...@suse.com> Reviewed-by: Torsten Duwe <d...@suse.de> > --- > arch/powerpc/boot/Makefile | 7 --- > arch/powerpc/boot/serial.c | 4 > 2 files changed, 8 insertions(+), 3 deletions(-) > > diff --

Re: [PATCH] powerpc: add kernel parameter iommu_alloc_quiet

2016-09-01 Thread Torsten Duwe
On Thu, Sep 01, 2016 at 09:56:42AM -0300, Mauricio Faria de Oliveira wrote: > This patch introduces the 'iommu_alloc_quiet=driver_name' parameter > to suppress the 'iommu_alloc failures' messages for that one driver. > > This is an additional approach for this 'problem' of flooding logs, > not as

Re: [PATCH 0/5] Live patching for powerpc

2016-04-14 Thread Torsten Duwe
On Thu, Apr 14, 2016 at 11:08:02PM +1000, Michael Ellerman wrote: > On Thu, 2016-04-14 at 14:57 +0200, Torsten Duwe wrote: > > > FTR: then I still have a few ppc64 hunks floating around to support certain > > consistency > > models... > > OK. I'm not quite su

Re: [PATCH 0/5] Live patching for powerpc

2016-04-14 Thread Torsten Duwe
On Thu, Apr 14, 2016 at 04:49:50PM +1000, Michael Ellerman wrote: > On Wed, 2016-04-13 at 15:22 +0200, Jiri Kosina wrote: > > On Wed, 13 Apr 2016, Miroslav Benes wrote: > > > > This series adds live patching support for powerpc (ppc64le only ATM). > > > > > > > > It's unchanged since the version

Re: [PATCH 6/6] powerpc/livepatch: Add live patching support on ppc64le

2016-03-24 Thread Torsten Duwe
nd realloc in klp_arch_set_pc when it's full? Maybe along with a warning message? That way a live patched kernel will not run into stack size problems any earlier than an unpatched kernel would. Just a thought. Anyway, patch 5+6 Reviewed-by: Torsten Duwe <d...@suse.de> Torsten

Re: [PATCH/RFC] ppc64 livepatch: frameless klp_return_helper using odd TOC

2016-03-24 Thread Torsten Duwe
On Thu, Mar 24, 2016 at 03:44:55PM +0530, Kamalesh Babulal wrote: > * Torsten Duwe <d...@lst.de> [2016-03-23 16:58:58]: > > > > > Since nobody liked the extra stack frame nor its workarounds, here is > > the next attempt. Assumptions: > > > > 1. Heurist

Re: [PATCH/RFC] ppc64 livepatch: frameless klp_return_helper using odd TOC

2016-03-24 Thread Torsten Duwe
On Thu, Mar 24, 2016 at 01:23:01PM +1100, Balbir Singh wrote: > On 24/03/16 02:58, Torsten Duwe wrote: > > > > 1. Heuristics are bad. The better they are, the more subtly the > >way they might fail. [...] > I missed this yesterday, not on cc, but caught it on t

[PATCH/RFC] ppc64 livepatch: frameless klp_return_helper using odd TOC

2016-03-23 Thread Torsten Duwe
to be compiled using the -fno-optimize-sibling-calls compiler flag! Thanks go to Michael Matz and Richard Biener for reassurance about heuristics and pointers to the compiler flag. Signed-off-by: Torsten Duwe <d...@suse.de> diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/en

Re: [v3,1/8] powerpc: Create a helper for getting the kernel toc value

2016-03-20 Thread Torsten Duwe
On Wed, Mar 16, 2016 at 09:23:19PM +1100, Michael Ellerman wrote: > > Sure. I'll try and get something working, though this merge window is not > starting well so I may not get time for a few weeks :) Do you already have something in mind? Can you give us a hint? Torsten

Re: [PATCH][v6][RFC] livepatch/ppc: Enable livepatching on powerpc

2016-03-19 Thread Torsten Duwe
On Wed, Mar 09, 2016 at 05:59:40PM +1100, Balbir Singh wrote: > > Changelog v6: > 1. Experimental changes -- need loads of testing > Based on the assumption that very far TOC and LR values > indicate the call happened through a stub and the > stub return works

Re: [v3,1/8] powerpc: Create a helper for getting the kernel toc value

2016-03-19 Thread Torsten Duwe
On Thu, Mar 17, 2016 at 10:58:42AM +1100, Balbir Singh wrote: > > To be honest I think my v6 works well, but I don't have complete confidence > due to the lack of proper testing. livepatch samples plus some others I wrote > and I one Petr wrote all work (calling patched from within patched), I

Re: [PATCH 2/2] ppc64le live patch: get rid of mini stack frame

2016-03-10 Thread Torsten Duwe
On Thu, Mar 10, 2016 at 01:51:16PM +0100, Petr Mladek wrote: > On Thu 2016-03-10 13:25:08, Petr Mladek wrote: > > On Wed 2016-03-09 18:30:17, Torsten Duwe wrote: > > > After the mini stack frame is no longer required for TOC storage, it can > > > be elimi

[PATCH 2/2] ppc64le live patch: get rid of mini stack frame

2016-03-09 Thread Torsten Duwe
, LRSAVE(r0) /* get the real return address */ add r2, r2, r0 /* Add the current LR to offset */ Signed-off-by: Torsten Duwe <d...@suse.de> --- This is solution 1 now. Do we really want that? I don't think so; this is merely to illustrate what the alternative to klp_return_

[PATCH 1/2] ppc64le live patch: clear out storage location(s) in mini stack frame

2016-03-09 Thread Torsten Duwe
om the ABI compliant location 24(r1) right after return. Signed-off-by: Torsten Duwe <d...@suse.de> --- This is only the preparation for dumping the mini stack frame. It shouldn't break anything, bisecting-wise. --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S @@

Re: [v5][PATCH] livepatch/ppc: Enable livepatching on powerpc

2016-03-09 Thread Torsten Duwe
On Wed, Mar 09, 2016 at 05:10:25PM +0100, Petr Mladek wrote: > On Tue 2016-03-08 16:34:35, Torsten Duwe wrote: > > /* compile using "-ffixed-r14"! */ > > register unsigned long pass_TOC asm("r14"); > > BTW: Is this reentrant, please? I mean, is it poss

Re: [PATCH][v6][RFC] livepatch/ppc: Enable livepatching on powerpc

2016-03-09 Thread Torsten Duwe
On Wed, Mar 09, 2016 at 11:13:05AM +0100, Jiri Kosina wrote: > On Wed, 9 Mar 2016, Torsten Duwe wrote: > > was my first choice. Arguments on the stack? I thought we'll deal with them > > once we get there (e.g. _really_ need to patch a varargs function or one > > with a silly

Re: [PATCH][v6][RFC] livepatch/ppc: Enable livepatching on powerpc

2016-03-09 Thread Torsten Duwe
On Wed, Mar 09, 2016 at 10:44:23AM +0100, Petr Mladek wrote: > find a solution that would work transparently. I mean that adding > an extra hacks into selected functions in the patch might be quite > error prone and problems hard to debug. I think that we all want this > but I wanted to be sure

Re: [PATCH][v6][RFC] livepatch/ppc: Enable livepatching on powerpc

2016-03-09 Thread Torsten Duwe
On Wed, Mar 09, 2016 at 05:59:40PM +1100, Balbir Singh wrote: > > The previous revision was nacked by Torsten, but compared to the alternatives I nacked it because I was confident it couldn't work. Same goes for this one, sorry. My good intention was to save us all some work. > @@ -1265,6

Re: [v5][PATCH] livepatch/ppc: Enable livepatching on powerpc

2016-03-08 Thread Torsten Duwe
On Wed, Mar 09, 2016 at 12:52:03AM +1100, Balbir Singh wrote: > > On 08/03/16 21:45, Torsten Duwe wrote: > > To be fair, my last mail still was not 100% correct, but the conclusion Wrote a correction to the correction. It should be clear now. Please nag me if it isn't clear why klp_r

Re: [PATCH][v4] livepatch/ppc: Enable livepatching on powerpc

2016-03-08 Thread Torsten Duwe
On Fri, Mar 04, 2016 at 08:22:22PM +0100, Torsten Duwe wrote: > On Fri, Mar 04, 2016 at 07:16:57PM +0100, Torsten Duwe wrote: > > On Fri, Mar 04, 2016 at 02:01:37PM +0100, Petr Mladek wrote: > > > > > > Do I understand it correctly that we could not patch function

Re: [v5][PATCH] livepatch/ppc: Enable livepatching on powerpc

2016-03-08 Thread Torsten Duwe
r0, LRSAVE(r1) /* save the real return address */ > + mtlrr0 > + blr > +#endif NAKed-by: Torsten Duwe <d...@suse.de> Torsten ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH][v4] livepatch/ppc: Enable livepatching on powerpc

2016-03-04 Thread Torsten Duwe
On Fri, Mar 04, 2016 at 07:16:57PM +0100, Torsten Duwe wrote: > On Fri, Mar 04, 2016 at 02:01:37PM +0100, Petr Mladek wrote: > > > > Do I understand it correctly that we could not patch functions that > > pass arguments on the stack with this implementation? If yes, how har

Re: [PATCH][v4] livepatch/ppc: Enable livepatching on powerpc

2016-03-04 Thread Torsten Duwe
On Fri, Mar 04, 2016 at 02:01:37PM +0100, Petr Mladek wrote: > > Do I understand it correctly that we could not patch functions that > pass arguments on the stack with this implementation? If yes, how hard > would be to get it working, please? At least, it would be great to > catch this problem

Re: [PATCH][v4] livepatch/ppc: Enable livepatching on powerpc

2016-03-04 Thread Torsten Duwe
On Thu, Mar 03, 2016 at 05:52:01PM +0100, Petr Mladek wrote: [...] > index ec7f8aada697..2d5333c228f1 100644 > --- a/arch/powerpc/kernel/entry_64.S > +++ b/arch/powerpc/kernel/entry_64.S > @@ -1265,6 +1271,31 @@ ftrace_call: > ld r0, LRSAVE(r1) > mtlrr0 > > +#ifdef

Re: [PATCH v2 2/8] powerpc/module: Only try to generate the ftrace_caller() stub once

2016-03-01 Thread Torsten Duwe
On Mon, Feb 29, 2016 at 08:26:23PM +1100, Michael Ellerman wrote: [...] > diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c > index 2c01665eb410..dd095496d225 100644 > --- a/arch/powerpc/kernel/module_32.c > +++ b/arch/powerpc/kernel/module_32.c > @@ -294,11 +294,19 @@

Re: [PATCH v2 1/8] powerpc: Create a helper for getting the kernel toc value

2016-03-01 Thread Torsten Duwe
lerman.id.au> Reviewed-by: Torsten Duwe <d...@suse.de> ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 07/12] powerpc/ftrace: FTRACE_WITH_REGS implementation for ppc64le

2016-02-25 Thread Torsten Duwe
On Thu, Feb 25, 2016 at 11:48:59AM +1100, Balbir Singh wrote: > > @@ -608,6 +621,9 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, > > return -ENOENT; > > if (!restore_r2((u32 *)location + 1, me)) > >

Re: [PATCH 10/12] powerpc/ftrace: FTRACE_WITH_REGS configuration variables

2016-02-25 Thread Torsten Duwe
rote this test, Michael insisted it was a feature :-) > > +/bin/echo -e "#include \nnotrace int func() { return 0; > > }" | \ > > +$* -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \ > > +grep -q "mcount" > > + > > +notrace_result=$? > &

Re: [PATCH 08/12] powerpc/ftrace: Rework ftrace_caller()

2016-02-25 Thread Torsten Duwe
the SPR loads to hopefully speed them up a bit. > Also comment the asm much more, to hopefully make it clearer. > > Signed-off-by: Michael Ellerman <m...@ellerman.id.au> Reviewed-by: Torsten Duwe <d...@suse.de> Torsten ___ L

Re: [PATCH 06/12] powerpc/module: Rework is_early_mcount_callsite()

2016-02-25 Thread Torsten Duwe
need to do this anymore? > > Yes. Otherwise the code in apply_relocate_add() will see a far call with no > nop > slot after it to do the toc restore, and it considers that a bug (which it > usually is, except mcount is special). > > As we discussed today I'm hoping we can c

Re: [PATCH 05/12] powerpc/ftrace: ftrace_graph_caller() needs to save/restore toc

2016-02-25 Thread Torsten Duwe
t; > + /* Restore callee's TOC */ > > + ld r2, 24(r1) > > + > > addir1, r1, 112 > > mflrr0 > > std r0, LRSAVE(r1) > > Reviewed-by: Balbir Singh <bsinghar...@gmail.com> Reviewed-by: Torsten Duwe <d...@suse.de> Torsten ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 04/12] powerpc/ftrace: Prepare for -mprofile-kernel

2016-02-25 Thread Torsten Duwe
1; return 0; leaves less freedom for the compiler to "optimise". Signed-off-by: Torsten Duwe <d...@suse.de> Torsten ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 03/12] powerpc/module: Create a special stub for ftrace_caller()

2016-02-25 Thread Torsten Duwe
ntime each time? It's a bit tricky to get the +- 0x8000 right OTOH... I wrote: extern unsigned long __toc_start; reladdr = addr - ((unsigned long)(&__toc_start) + 0x8000UL); looks a bit odd, but evaluates to a constant for ftrace_caller. Either way is fine with me: Signed-off-by: Torst

Re: [PATCH 02/12] powerpc/module: Mark module stubs with a magic value

2016-02-25 Thread Torsten Duwe
n > practice. The actual magic value is sort of debatable; it should be "improbable" enough. But this can be changed easily, for each kernel compile, even. > Signed-off-by: Michael Ellerman <m...@ellerman.id.au> Reviewed-by: Torsten Duwe <d...@suse.de> [for reference:] >

Re: [PATCH 01/12] powerpc/module: Only try to generate the ftrace_caller() stub once

2016-02-25 Thread Torsten Duwe
e ftrace_caller() stub once, > from module_finalize(). An additional benefit is we can clean the ifdefs > up a little. > > Finally we must propagate the const'ness of some of the pointers passed > to module_finalize(), but that is also an improvement. > > Signed-off-by: Michael

Re: [PATCH v8 8/8] livepatch: Detect offset for the ftrace location during build

2016-02-24 Thread Torsten Duwe
On Wed, Feb 24, 2016 at 05:55:35PM +1100, Balbir Singh wrote: > > > We need to remove the SQUASH_TOC_SAVE_INSNS bits as well, now that the > ppc64_profile_stub_insns does not save r2 Sure -- this was meant to _replace_ the changes from patch 2/8, not on top. And yes, it exposes duplicate

Re: [PATCH v8 8/8] livepatch: Detect offset for the ftrace location during build

2016-02-23 Thread Torsten Duwe
On Wed, Feb 17, 2016 at 02:08:41PM +1100, Michael Ellerman wrote: > > That stub uses r2 to find the location of itself, but it only works if r2 > holds > the TOC for scsi_mod.ko. In this case r2 still contains ibmvscsi.ko's TOC. Here's my solution, a bit rough still. This replaces the

Re: [PATCH v8 1/8] ppc64 (le): prepare for -mprofile-kernel

2016-02-17 Thread Torsten Duwe
On Wed, Feb 17, 2016 at 09:55:40PM +1100, Michael Ellerman wrote: > On Wed, 2016-02-10 at 17:21 +0100, Torsten Duwe wrote: > > > --- a/arch/powerpc/kernel/module_64.c > > +++ b/arch/powerpc/kernel/module_64.c > > @@ -476,17 +474,44 @@ static unsigned long stub_for_addr(

Re: [PATCH v8 8/8] livepatch: Detect offset for the ftrace location during build

2016-02-16 Thread Torsten Duwe
On Tue, Feb 16, 2016 at 04:00:30PM +0530, Kamalesh Babulal wrote: > * Torsten Duwe <d...@lst.de> [2016-02-16 09:23:02]: > > > > N.b.: if you try to livepatch/trace such a leaf function without > > global dependencies, it will crash if that function got called with >

Re: [PATCH v8 4/8] ppc64 ftrace_with_regs configuration variables

2016-02-16 Thread Torsten Duwe
On Tue, Feb 16, 2016 at 09:09:16PM +1100, Michael Ellerman wrote: > On Mon, 2016-02-15 at 15:04 +0100, Torsten Duwe wrote: > > If you use "-pg -mprofile-kernel", gcc seems to forget that, and omits the > > TOC > > load, for a similar assembler calling sequence.

Re: [PATCH v8 8/8] livepatch: Detect offset for the ftrace location during build

2016-02-16 Thread Torsten Duwe
On Tue, Feb 16, 2016 at 11:17:02AM +0530, Kamalesh Babulal wrote: > * Petr Mladek [2016-02-12 17:45:17]: > > int test(int a) > > { > > + printk("%d\n", a); > > return ++a; > > } > > Thanks. This workaround, helped to load sample livepatch module. N.b.: if you try to

Re: [PATCH v8 4/8] ppc64 ftrace_with_regs configuration variables

2016-02-15 Thread Torsten Duwe
On Mon, Feb 15, 2016 at 03:04:08PM +0100, Torsten Duwe wrote: > If you use "-pg -mprofile-kernel", gcc seems to forget that, and omits the TOC > load, for a similar assembler calling sequence. > > Looking at the code I can _understand_ why this is so, but my GCC knowle

Re: [PATCH v8 4/8] ppc64 ftrace_with_regs configuration variables

2016-02-15 Thread Torsten Duwe
On Mon, Feb 15, 2016 at 09:27:15PM +1100, Michael Ellerman wrote: > > There is explicit code in gcc to check whether the TOC setup is needed and > only That's undestood. The claim here is: that check is incomplete, at least. > emit it when it's required. One case where it's *not* required is

Re: [PATCH v8 4/8] ppc64 ftrace_with_regs configuration variables

2016-02-11 Thread Torsten Duwe
On Thu, Feb 11, 2016 at 06:48:17PM +1100, Balbir Singh wrote: > On Wed, 2016-02-10 at 17:25 +0100, Torsten Duwe wrote: > > + > > +echo "int func() { return 0; }" | \ > > +$* -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \ > > +sed -n

Re: [PATCH v8 0/8] ftrace with regs + live patching for ppc64 LE (ABI v2)

2016-02-11 Thread Torsten Duwe
On Thu, Feb 11, 2016 at 05:18:23PM +1100, Balbir Singh wrote: > > Quick question - I presume these apply on top of 4.5.0-rc2? Yes. Torsten ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org

[PATCH v8 1/8] ppc64 (le): prepare for -mprofile-kernel

2016-02-10 Thread Torsten Duwe
mon macros to make things readable. - pull the R2 stack location definition from arch/powerpc/kernel/module_64.c * arch/powerpc/kernel/module_64.c: - enhance binary code examination to handle the new patterns. Signed-off-by: Torsten Duwe <d...@suse.de> --- arch/powerpc/include

[PATCH v8 2/8] ppc64le FTRACE_WITH_REGS implementation

2016-02-10 Thread Torsten Duwe
. This trampoline jump happens from a function prologue before a new stack frame is set up, so bad things may happen otherwise... - relax is_module_trampoline() to recognise the modified trampoline. Signed-off-by: Torsten Duwe <d...@suse.de> --- arch/powerpc/include/asm/ft

[PATCH v8 3/8] ppc use ftrace_modify_all_code default

2016-02-10 Thread Torsten Duwe
-by: Torsten Duwe <d...@suse.de> --- arch/powerpc/kernel/ftrace.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c index 1fad1b3..ef8b916 100644 --- a/arch/powerpc/kernel/ftrace.c +++ b/arch/powerpc/

[PATCH v8 0/8] ftrace with regs + live patching for ppc64 LE (ABI v2)

2016-02-10 Thread Torsten Duwe
k frame it tried to manipulate does not exist at that point. * changes only needed in order to support -mprofile-kernel are now in a separate patch, prepended. * Kconfig cleanup so this is only selectable on ppc64le. Petr Mladek (1): livepatch: Detect offset for the ftrace location

[PATCH v8 4/8] ppc64 ftrace_with_regs configuration variables

2016-02-10 Thread Torsten Duwe
on compile with HAVE_DYNAMIC_FTRACE_WITH_REGS and a buggy compiler. * arch/powerpc/Kconfig / kernel/trace/Kconfig: - declare that ppc64le HAVE_MPROFILE_KERNEL and HAVE_DYNAMIC_FTRACE_WITH_REGS, and use it. Signed-off-by: Torsten Duwe <d...@suse.de> --- arch/powerpc/K

[PATCH v8 5/8] ppc64 ftrace_with_regs: disable profiling for some files

2016-02-10 Thread Torsten Duwe
: - remove -mprofile-kernel from low level, boot code and code-patching objects' CFLAGS. Signed-off-by: Torsten Duwe <d...@suse.de> --- arch/powerpc/kernel/Makefile | 12 ++-- arch/powerpc/lib/Makefile| 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff

Re: [PATCH v7 07/10] ppc64 ftrace: disable profiling for some files

2016-02-10 Thread Torsten Duwe
On Wed, Feb 10, 2016 at 11:33:33AM +1100, Michael Ellerman wrote: > On Mon, 2016-01-25 at 16:31 +0100, Torsten Duwe wrote: > > > This patch complements the "notrace" attribute for selected functions. > > It adds -mprofile-kernel to the cc flags to be stripped from t

[PATCH v8 7/8] Enable LIVEPATCH to be configured on ppc64le and add livepatch.o if it is selected

2016-02-10 Thread Torsten Duwe
Signed-off-by: Torsten Duwe <d...@suse.de> --- arch/powerpc/Kconfig | 3 +++ arch/powerpc/kernel/Makefile | 1 + 2 files changed, 4 insertions(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index e5f288c..8c7a327 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/K

Re: [PATCH v7 06/10] ppc64 ftrace: disable profiling for some functions

2016-02-10 Thread Torsten Duwe
On Wed, Feb 10, 2016 at 12:50:38PM +1100, Michael Ellerman wrote: > On Mon, 2016-01-25 at 16:31 +0100, Torsten Duwe wrote: > > > At least POWER7/8 have MMUs that don't completely autoload; > > a normal, recoverable memory fault might pass through these functions. > > If a

[PATCH v8 6/8] Implement kernel live patching for ppc64le (ABIv2)

2016-02-10 Thread Torsten Duwe
a fixup in arch/powerpc/kernel/entry_64.S for local calls that are becoming global due to live patching. And of course do the main KLP thing: return to a maybe different address, possibly altered by the live patching ftrace op. Signed-off-by: Torsten Duwe <d...@suse.de> --- arch/p

[PATCH v8 8/8] livepatch: Detect offset for the ftrace location during build

2016-02-10 Thread Torsten Duwe
tation uses rather complex regular expressions to parse objdump output and is therefore much more tricky. Signed-off-by: Petr Mladek <pmla...@suse.com> Signed-off-by: Torsten Duwe <d...@suse.de> --- arch/powerpc/Kconfig | 1 + arch/s390/Kconfig | 1 + kernel/

Re: [PATCH v6 8/9] Implement kernel live patching for ppc64le (ABIv2)

2016-02-10 Thread Torsten Duwe
On Tue, Feb 02, 2016 at 04:46:27PM +0300, Denis Kirjanov wrote: > > + > > +#ifdef CONFIG_LIVEPATCH > > +static inline int klp_check_compiler_support(void) > > +{ > > +#if !defined(_CALL_ELF) || _CALL_ELF != 2 || > > !defined(CC_USING_MPROFILE_KERNEL) > > + return 1; > > +#endif > > + return 0;

Re: [PATCH v7 04/10] ppc64 ftrace_with_regs configuration variables

2016-02-09 Thread Torsten Duwe
On Mon, Feb 08, 2016 at 10:49:28AM -0500, Steven Rostedt wrote: > On Mon, 8 Feb 2016 16:23:06 +0100 > Petr Mladek wrote: > > > >From 2b0fcb678d7720d03f9c9f233b61ed9ed4d420b3 Mon Sep 17 00:00:00 2001 > > From: Petr Mladek > > Date: Mon, 8 Feb 2016 16:03:03

Re: [PATCH v7 04/10] ppc64 ftrace_with_regs configuration variables

2016-02-08 Thread Torsten Duwe
On Mon, Feb 08, 2016 at 11:34:06AM +0100, Petr Mladek wrote: > On Sat 2016-02-06 11:32:43, Torsten Duwe wrote: > > On Fri, Feb 05, 2016 at 05:18:34PM +0100, Petr Mladek wrote: > > [...] > > > more complicated. Whem I think about it, the change below does similar

Re: [PATCH v7 04/10] ppc64 ftrace_with_regs configuration variables

2016-02-06 Thread Torsten Duwe
On Fri, Feb 05, 2016 at 05:18:34PM +0100, Petr Mladek wrote: [...] > more complicated. Whem I think about it, the change below does similar > job and looks more strightforwad: Had I only looked closer. That's exactly how I thought it would work in the first place. I'd call that a fix. Full ACK

[PATCH v7 09/10] Enable LIVEPATCH to be configured on ppc64le and add livepatch.o if it is selected.

2016-02-04 Thread Torsten Duwe
Signed-off-by: Torsten Duwe <d...@suse.de> --- arch/powerpc/Kconfig | 3 +++ arch/powerpc/kernel/Makefile | 1 + 2 files changed, 4 insertions(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index e5f288c..8c7a327 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/K

[PATCH v7 00/10] ftrace with regs + live patching for ppc64 LE (ABI v2)

2016-02-04 Thread Torsten Duwe
* Kconfig cleanup so this is only selectable on ppc64le. Petr Mladek (1): livepatch: Detect offset for the ftrace location during build Torsten Duwe (9): ppc64 (le): prepare for -mprofile-kernel ppc64le FTRACE_WITH_REGS implementation ppc use ftrace_modify_all_code default ppc64 ftrace

[PATCH v7 02/10] ppc64le FTRACE_WITH_REGS implementation

2016-02-04 Thread Torsten Duwe
. This trampoline jump happens from a function prologue before a new stack frame is set up, so bad things may happen otherwise... - relax is_module_trampoline() to recognise the modified trampoline. Signed-off-by: Torsten Duwe <d...@suse.de> --- arch/powerpc/include/asm/ft

[PATCH v7 05/10] ppc64 ftrace_with_regs: spare early boot and low level

2016-02-04 Thread Torsten Duwe
level and boot code objects' CFLAGS for FUNCTION_TRACER configurations. Signed-off-by: Torsten Duwe <d...@suse.de> --- arch/powerpc/kernel/Makefile | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile

[PATCH v7 08/10] Implement kernel live patching for ppc64le (ABIv2)

2016-02-04 Thread Torsten Duwe
a fixup in arch/powerpc/kernel/entry_64.S for local calls that are becoming global due to live patching. And of course do the main KLP thing: return to a maybe different address, possibly altered by the live patching ftrace op. Signed-off-by: Torsten Duwe <d...@suse.de> --- arch/p

[PATCH v7 01/10] ppc64 (le): prepare for -mprofile-kernel

2016-02-04 Thread Torsten Duwe
mon macros to make things readable. - pull the R2 stack location definition from arch/powerpc/kernel/module_64.c * arch/powerpc/kernel/module_64.c: - enhance binary code examination to handle the new patterns. Signed-off-by: Torsten Duwe <d...@suse.de> --- arch/powerpc/include

[PATCH v7 04/10] ppc64 ftrace_with_regs configuration variables

2016-02-04 Thread Torsten Duwe
with HAVE_DYNAMIC_FTRACE_WITH_REGS and a buggy compiler. * arch/powerpc/Kconfig / kernel/trace/Kconfig: - declare that ppc64le HAVE_MPROFILE_KERNEL and HAVE_DYNAMIC_FTRACE_WITH_REGS, and use it. Signed-off-by: Torsten Duwe <d...@suse.de> --- arch/powerpc/K

[PATCH v7 06/10] ppc64 ftrace: disable profiling for some functions

2016-02-04 Thread Torsten Duwe
At least POWER7/8 have MMUs that don't completely autoload; a normal, recoverable memory fault might pass through these functions. If a dynamic tracer function causes such a fault, any of these functions being traced with -mprofile-kernel may cause an endless recursion. Signed-off-by: Torsten

[PATCH v7 03/10] ppc use ftrace_modify_all_code default

2016-02-04 Thread Torsten Duwe
-by: Torsten Duwe <d...@suse.de> --- arch/powerpc/kernel/ftrace.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c index 1fad1b3..ef8b916 100644 --- a/arch/powerpc/kernel/ftrace.c +++ b/arch/powerpc/

[PATCH v7 07/10] ppc64 ftrace: disable profiling for some files

2016-02-04 Thread Torsten Duwe
This patch complements the "notrace" attribute for selected functions. It adds -mprofile-kernel to the cc flags to be stripped from the command line for code-patching.o and feature-fixups.o, in addition to "-pg" Signed-off-by: Torsten Duwe <d...@suse.de> --- arch/powerp

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-03 Thread Torsten Duwe
On Wed, Feb 03, 2016 at 09:55:11AM +0100, Jiri Kosina wrote: > On Wed, 3 Feb 2016, AKASHI Takahiro wrote: > > those efforts, we are proposing[1] a new *generic* gcc option, > > -fprolog-add=N. > > This option will insert N nop instructions at the beginning of each > > function. > The

Re: [PATCH v6 8/9] Implement kernel live patching for ppc64le (ABIv2)

2016-02-02 Thread Torsten Duwe
On Tue, Feb 02, 2016 at 01:12:24PM +0100, Petr Mladek wrote: > > Hmm, the size of the offset is not a constant. In particular, leaf > functions do not set TOC before the mcount location. To be slightly more precise, a leaf function that additionally uses no global data. No global function calls,

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-28 Thread Torsten Duwe
On Thu, Jan 28, 2016 at 03:26:59PM +1100, Michael Ellerman wrote: > > That raises an interesting question, how does it work *without* > DYNAMIC_FTRACE? > > It looks like you haven't updated that version of _mcount at all? Or maybe I'm > missing an #ifdef somewhere? You didn't, I did. I haven't

Re: [PATCH v6 0/9] ftrace with regs + live patching for ppc64 LE (ABI v2)

2016-01-28 Thread Torsten Duwe
On Thu, Jan 28, 2016 at 02:31:58PM +1100, Michael Ellerman wrote: > > Looking at GCC history it looks like the fix is in 4.9.0 and anything later. Good. But 4.8.5 has a buggy -mprofile-kernel, and there will be no 4.8.6, Bad. > But a version check doesn't work with patched distro/vendor

Re: [PATCH v6 0/9] ftrace with regs + live patching for ppc64 LE (ABI v2)

2016-01-27 Thread Torsten Duwe
On Wed, Jan 27, 2016 at 09:51:12PM +1100, Balbir Singh wrote: > On Mon, 25 Jan 2016 16:38:48 +0100 > Torsten Duwe <d...@lst.de> wrote: > > > Changes since v5: > > * extra "std r0,LRSAVE(r1)" for gcc-6 > > This makes the code compiler-agnost

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-27 Thread Torsten Duwe
On Wed, Jan 27, 2016 at 09:19:27PM +1100, Michael Ellerman wrote: > Hi Torsten, > > > +++ b/arch/powerpc/kernel/entry_64.S > > @@ -1206,7 +1206,12 @@ _GLOBAL(enter_prom) > > #ifdef CONFIG_DYNAMIC_FTRACE > > _GLOBAL(mcount) > > _GLOBAL(_mcount) > > - blr > > + std r0,LRSAVE(r1) /* gcc6

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-27 Thread Torsten Duwe
On Wed, Jan 27, 2016 at 11:28:09PM +1030, Alan Modra wrote: > On Wed, Jan 27, 2016 at 09:19:27PM +1100, Michael Ellerman wrote: > > > > Can we use r11 instead? eg: > > > > _GLOBAL(_mcount) > > mflrr11 > > mtctr r11 > > mtlrr0 > > bctr > > Depends on what you need to

Re: [PATCH v6 8/9] Implement kernel live patching for ppc64le (ABIv2)

2016-01-26 Thread Torsten Duwe
On Tue, Jan 26, 2016 at 01:48:53PM +0100, Petr Mladek wrote: > On Tue 2016-01-26 11:50:25, Miroslav Benes wrote: > > > > We still need Petr's patch from [1] to make livepatch work, right? Could > > you, please, add it to this patch set to make it self-sufficient? It's Petr's patch, I don't want

Re: [PATCH v6 8/9] Implement kernel live patching for ppc64le (ABIv2)

2016-01-26 Thread Torsten Duwe
On Tue, Jan 26, 2016 at 11:50:25AM +0100, Miroslav Benes wrote: > > + */ > > +int klp_write_module_reloc(struct module *mod, unsigned long type, > > + unsigned long loc, unsigned long value) > > +{ > > + /* This requires infrastructure changes; we need the loadinfos. */ > >

[PATCH v6 4/9] ppc64 ftrace_with_regs configuration variables

2016-01-25 Thread Torsten Duwe
* Makefile: - globally use -mprofile-kernel in case it's configured and available. * arch/powerpc/Kconfig / kernel/trace/Kconfig: - declare that ppc64le HAVE_MPROFILE_KERNEL and HAVE_DYNAMIC_FTRACE_WITH_REGS, and use it. Signed-off-by: Torsten Duwe <d...@suse.de> ---

[PATCH v6 8/9] Implement kernel live patching for ppc64le (ABIv2)

2016-01-25 Thread Torsten Duwe
a fixup in arch/powerpc/kernel/entry_64.S for local calls that are becoming global due to live patching. And of course do the main KLP thing: return to a maybe different address, possibly altered by the live patching ftrace op. Signed-off-by: Torsten Duwe <d...@suse.de> --- arch/p

[PATCH v6 2/9] ppc64le FTRACE_WITH_REGS implementation

2016-01-25 Thread Torsten Duwe
. This trampoline jump happens from a function prologue before a new stack frame is set up, so bad things may happen otherwise... - relax is_module_trampoline() to recognise the modified trampoline. Signed-off-by: Torsten Duwe <d...@suse.de> --- arch/powerpc/include/asm/ft

[PATCH v6 6/9] ppc64 ftrace: disable profiling for some functions

2016-01-25 Thread Torsten Duwe
At least POWER7/8 have MMUs that don't completely autoload; a normal, recoverable memory fault might pass through these functions. If a dynamic tracer function causes such a fault, any of these functions being traced with -mprofile-kernel may cause an endless recursion. Signed-off-by: Torsten

  1   2   3   >