Re: [PATCH v2 5/5] printk/nmi: Increase the size of the temporary buffer

2015-12-07 Thread Petr Mladek
On Mon 2015-11-30 08:42:04, yalin wang wrote: > > > On Nov 27, 2015, at 19:09, Petr Mladek <pmla...@suse.com> wrote: > > > > Testing has shown that the backtrace sometimes does not fit > > into the 4kB temporary buffer that is used in NMI context. > >

Re: [PATCH v2 3/5] printk/nmi: Try hard to print Oops message in NMI context

2015-12-08 Thread Petr Mladek
> Take the scenario where CPU1 is in the middle of a printk(), and is > holding its lock. > > CPU0 comes along and decides to trigger a NMI backtrace. This sends > a NMI to CPU1, which takes it in the middle of the serial console > output. > > With the existing solution, the NMI output will be

Re: [PATCH v2 3/5] printk/nmi: Try hard to print Oops message in NMI context

2015-12-08 Thread Petr Mladek
On Mon 2015-12-07 15:48:33, David Laight wrote: > From: Russell King - ARM Linux > > Sent: 04 December 2015 17:13 > ... > > I have a slightly different view... > > > > > > I don't see bust_spinlocks() dealing with any of these locks, so IMHO > > > > trying to make this work in NMI context strikes

Re: [PATCH v2 3/5] printk/nmi: Try hard to print Oops message in NMI context

2015-12-04 Thread Petr Mladek
On Tue 2015-12-01 23:44:37, Russell King - ARM Linux wrote: > On Fri, Nov 27, 2015 at 12:09:30PM +0100, Petr Mladek wrote: > > What we can do, though, is to zap all printk locks. We already do this > > when a printk recursion is detected. This should be safe because > > t

Re: [PATCH v2 1/5] printk/nmi: Generic solution for safe printk in NMI

2015-12-04 Thread Petr Mladek
On Wed 2015-12-02 13:45:16, Michael Ellerman wrote: > On Fri, 2015-11-27 at 12:09 +0100, Petr Mladek wrote: > > > printk() takes some locks and could not be used a safe way in NMI > > context. > > > > The chance of a deadlock is real especially when pri

Re: [PATCH v2 5/5] printk/nmi: Increase the size of the temporary buffer

2015-12-04 Thread Petr Mladek
On Wed 2015-12-02 16:20:41, David Laight wrote: > From: yalin wang > > Sent: 30 November 2015 16:42 > > > On Nov 27, 2015, at 19:09, Petr Mladek <pmla...@suse.com> wrote: > > > > > > Testing has shown that the backtrace sometimes does not fit > > >

Re: [PATCH v2 1/5] printk/nmi: Generic solution for safe printk in NMI

2015-12-04 Thread Petr Mladek
On Wed 2015-12-02 00:24:49, Jiri Kosina wrote: > On Fri, 27 Nov 2015, Petr Mladek wrote: > > > MN10300 has its own implementation for entering and exiting NMI > > handlers. It does not call nmi_enter() and nmi_exit(). Please, find > > below an updated patch th

[PATCH v3 1/4] printk/nmi: Generic solution for safe printk in NMI

2015-12-09 Thread Petr Mladek
: Steven Rostedt <rost...@goodmis.org> Signed-off-by: Petr Mladek <pmla...@suse.com> --- arch/Kconfig | 7 ++ arch/arm/Kconfig | 2 + arch/arm/kernel/smp.c | 2 + arch/avr32/Kconfig| 1 + arch/blackfin/Kconfig

[PATCH v3 0/4] Cleaning printk stuff in NMI context

2015-12-09 Thread Petr Mladek
nmi_enter() and seems to have real NMIs (or am I wrong?) + serialized backtraces when printing directly (oops_in_progress) Petr Mladek (4): printk/nmi: Generic solution for safe printk in NMI printk/nmi: Use IRQ work only when ready printk/nmi: Warn when some message has been

[PATCH v3 3/4] printk/nmi: Warn when some message has been lost in NMI context

2015-12-09 Thread Petr Mladek
-by: Petr Mladek <pmla...@suse.com> --- kernel/printk/nmi.c| 5 - kernel/printk/printk.c | 10 ++ kernel/printk/printk.h | 11 +++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/kernel/printk/nmi.c b/kernel/printk/nmi.c index 29a498586465..5465230b75ec

[PATCH v3 2/4] printk/nmi: Use IRQ work only when ready

2015-12-09 Thread Petr Mladek
NMIs could happen at any time. This patch makes sure that the safe printk() in NMI will schedule IRQ work only when the related structs are initialized. All pending messages are flushed when the IRQ work is being initialized. Signed-off-by: Petr Mladek <pmla...@suse.com> --- kernel/printk

[PATCH v3 4/4] printk/nmi: Increase the size of NMI buffer and make it configurable

2015-12-09 Thread Petr Mladek
-specific implementation that was added by the commit a9edc8809328 ("x86/nmi: Perform a safe NMI stack trace on all CPUs"). Nobody noticed it because it did not print any warnings. Signed-off-by: Petr Mladek <pmla...@suse.com> --- init/Kconfig| 22 ++ kernel/p

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

2015-12-03 Thread Petr Mladek
On Wed 2015-11-25 17:48:36, Torsten Duwe wrote: > * create the appropriate files+functions > arch/powerpc/include/asm/livepatch.h > klp_check_compiler_support, > klp_arch_set_pc > arch/powerpc/kernel/livepatch.c with a stub for > klp_write_module_reloc > This

Re: [PATCH v4 4/9] ppc64 ftrace_with_regs configuration variables

2015-12-03 Thread Petr Mladek
On Wed 2015-11-25 17:37:33, Torsten Duwe wrote: > * Makefile: > - globally use -mprofile-kernel in case it's configured. > * arch/powerpc/Kconfig / kernel/trace/Kconfig: > - declare that ppc64le HAVE_MPROFILE_KERNEL and > HAVE_DYNAMIC_FTRACE_WITH_REGS, and use it. > > ---

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

2015-12-03 Thread Petr Mladek
ch 'livepatch_sample' [ 1997.098257] livepatch: disabling patch 'livepatch_sample' [ 2079.696277] livepatch: enabling patch 'livepatch_sample' Here is the patch: From 7eb6f9453c81a996b0f5ffcb8725facadd9ec718 Mon Sep 17 00:00:00 2001 From: Petr Mladek <pmla...@suse.com> Date: Thu, 3 Dec 20

Re: [PATCH v3 4/4] printk/nmi: Increase the size of NMI buffer and make it configurable

2015-12-11 Thread Petr Mladek
On Fri 2015-12-11 12:10:02, Geert Uytterhoeven wrote: > On Wed, Dec 9, 2015 at 2:21 PM, Petr Mladek <pmla...@suse.com> wrote: > > --- a/init/Kconfig > > +++ b/init/Kconfig > > @@ -866,6 +866,28 @@ config LOG_CPU_MAX_BUF_SHIFT > >

Re: [PATCH v3 1/4] printk/nmi: Generic solution for safe printk in NMI

2015-12-10 Thread Petr Mladek
On Wed 2015-12-09 15:50:07, Andrew Morton wrote: > On Wed, 9 Dec 2015 14:21:02 +0100 Petr Mladek <pmla...@suse.com> wrote: > > > printk() takes some locks and could not be used a safe way in NMI > > context. > > > > The chance of a deadlock is real especial

Re: [PATCH v3 4/4] printk/nmi: Increase the size of NMI buffer and make it configurable

2015-12-15 Thread Petr Mladek
On Fri 2015-12-11 15:30:54, Andrew Morton wrote: > On Fri, 11 Dec 2015 23:21:13 + Russell King - ARM Linux > wrote: > > > On Fri, Dec 11, 2015 at 02:57:25PM -0800, Andrew Morton wrote: > > > This is a bit messy. NEED_PRINTK_NMI is an added-on hack for one > > >

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

2016-01-06 Thread Petr Mladek
603 to get the livepatching working. Both ftrace with regs and live patching works for me with this patch set and the extra patch. So. for the whole patchset: Tested-by: Petr Mladek <pmla...@suse.com> Best Regards, Petr ___ Linuxppc-dev mailing l

Re: [PATCH v5 9/9] Enable LIVEPATCH to be configured on ppc64le and add livepatch.o if it is selected.

2016-01-06 Thread Petr Mladek
On Fri 2015-12-04 15:13:44, Torsten Duwe wrote: > Signed-off-by: Torsten Duwe > --- > arch/powerpc/Kconfig | 5 + > arch/powerpc/kernel/Makefile | 1 + > 2 files changed, 6 insertions(+) > > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig > index

Re: [PATCH v3 4/4] printk/nmi: Increase the size of NMI buffer and make it configurable

2015-12-18 Thread Petr Mladek
On Fri 2015-12-18 10:18:08, Daniel Thompson wrote: > On 11/12/15 23:26, Jiri Kosina wrote: > >On Fri, 11 Dec 2015, Russell King - ARM Linux wrote: > > > >>I'm personally happy with the existing code, and I've been wondering why > >>there's this effort to apply further cleanups - to me, the

Re: [PATCH v3 4/4] printk/nmi: Increase the size of NMI buffer and make it configurable

2015-12-18 Thread Petr Mladek
On Thu 2015-12-17 14:38:58, Andrew Morton wrote: > On Tue, 15 Dec 2015 15:26:21 +0100 Petr Mladek <pmla...@suse.com> wrote: > > > > OK, thanks. So "not needed at present, might be needed in the future, > > > useful for out-of-tree debug code"? > >

Re: [PATCH v2 1/5] printk/nmi: Generic solution for safe printk in NMI

2015-11-27 Thread Petr Mladek
On Fri 2015-11-27 19:49:48, kbuild test robot wrote: > Hi Petr, > > [auto build test WARNING on powerpc/next] > [also build test WARNING on v4.4-rc2 next-20151127] > [cannot apply to tip/x86/core] > > url: > https://github.com/0day-ci/linux/commits/Petr-Mladek/Clea

[PATCH v2 4/5] printk/nmi: Warn when some message has been lost in NMI context

2015-11-27 Thread Petr Mladek
-by: Petr Mladek <pmla...@suse.com> --- kernel/printk/nmi.c| 5 - kernel/printk/printk.c | 10 ++ kernel/printk/printk.h | 11 +++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/kernel/printk/nmi.c b/kernel/printk/nmi.c index 34ba760ae794..8af1e4016719

[PATCH v2 5/5] printk/nmi: Increase the size of the temporary buffer

2015-11-27 Thread Petr Mladek
("x86/nmi: Perform a safe NMI stack trace on all CPUs"). Nobody noticed it because it did not print any warnings. Signed-off-by: Petr Mladek <pmla...@suse.com> --- kernel/printk/nmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/printk/nmi.c b/kernel/pr

[PATCH v2 1/5] printk/nmi: Generic solution for safe printk in NMI

2015-11-27 Thread Petr Mladek
. Another exception is Xtensa architecture that uses just a fake NMI. The patch is heavily based on the draft from Peter Zijlstra, see https://lkml.org/lkml/2015/6/10/327 Suggested-by: Peter Zijlstra <pet...@infradead.org> Suggested-by: Steven Rostedt <rost...@goodmis.org> Signed-off

[PATCH v2 3/5] printk/nmi: Try hard to print Oops message in NMI context

2015-11-27 Thread Petr Mladek
Signed-off-by: Petr Mladek <pmla...@suse.cz> --- arch/s390/mm/fault.c | 1 + kernel/printk/nmi.c| 6 +- kernel/printk/printk.c | 7 +++ lib/bust_spinlocks.c | 1 + lib/nmi_backtrace.c| 8 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/s390/mm/fault.

[PATCH v2 2/5] printk/nmi: Use IRQ work only when ready

2015-11-27 Thread Petr Mladek
NMIs could happen at any time. This patch makes sure that the safe printk() in NMI will schedule IRQ work only when the related structs are initialized. All pending messages are flushed when the IRQ work is being initialized. Signed-off-by: Petr Mladek <pmla...@suse.com> --- kernel/printk

[PATCH v2 0/5] Cleaning printk stuff in NMI context

2015-11-27 Thread Petr Mladek
() and seems to have real NMIs (or am I wrong?) + serialized backtraces when printing directly (oops_in_progress) Petr Mladek (5): printk/nmi: Generic solution for safe printk in NMI printk/nmi: Use IRQ work only when ready printk/nmi: Try hard to print Oops message in NMI context

Re: [PATCH v2 1/5] printk/nmi: Generic solution for safe printk in NMI

2015-11-30 Thread Petr Mladek
On Fri 2015-11-27 17:26:16, Max Filippov wrote: Hi Max, > > Another exception is Xtensa architecture that uses just a > > fake NMI. > > It's called fake because it's actually maskable, but sometimes > it is safe to use it as NMI (when there are no other IRQs at the > same priority level and that

Re: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model

2016-06-06 Thread Petr Mladek
On Thu 2016-04-28 15:44:48, Josh Poimboeuf wrote: > Change livepatch to use a basic per-task consistency model. This is the > foundation which will eventually enable us to patch those ~10% of > security patches which change function or data semantics. This is the > biggest remaining piece needed

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

2016-02-08 Thread Petr Mladek
On Mon 2016-02-08 10:49:28, Steven Rostedt wrote: > On Mon, 8 Feb 2016 16:23:06 +0100 > Petr Mladek <pmla...@suse.com> wrote: > > > >From 2b0fcb678d7720d03f9c9f233b61ed9ed4d420b3 Mon Sep 17 00:00:00 2001 > > From: Petr Mladek <pmla...@suse.com> >

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

2016-02-08 Thread Petr Mladek
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 > > job and looks more strightforwad: > > Had I only looked closer. That

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

2016-02-04 Thread Petr Mladek
On Thu 2016-02-04 18:31:40, AKASHI Takahiro wrote: > Jiri, Torsten > > Thank you for your explanation. > > On 02/03/2016 08:24 PM, Torsten Duwe wrote: > >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

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

2016-02-05 Thread Petr Mladek
On Fri 2016-02-05 09:48:03, Steven Rostedt wrote: > On Fri, 5 Feb 2016 15:05:17 +0100 > Petr Mladek <pmla...@suse.com> wrote: > > > On Mon 2016-01-25 16:29:54, Torsten Duwe wrote: > > > diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c >

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

2016-02-08 Thread Petr Mladek
On Mon 2016-02-08 13:12:45, Torsten Duwe wrote: > 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: > > > [...] > > > &g

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

2016-02-05 Thread Petr Mladek
On Fri 2016-02-05 15:40:27, Balbir Singh wrote: > On Thu, Feb 4, 2016 at 10:02 PM, Petr Mladek <pmla...@suse.com> wrote: > For big endian builds I saw > > Dump of assembler code for function alloc_pages_current: >0xc0256f00 <+0>:mflrr0 >0

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

2016-02-12 Thread Petr Mladek
On Sat 2016-02-13 03:13:29, Balbir Singh wrote: > On Thu, 2016-01-28 at 16:32 +0100, Torsten Duwe wrote: > > From: Petr Mladek <pmla...@suse.com> > > > > Livepatch works on x86_64 and s390 only when the ftrace call > > is at the very beginning of the function.

[PATCH v7 10/10] livepatch: Detect offset for the ftrace location during build

2016-02-04 Thread Petr Mladek
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/livepatch/Makefile | 13 + kern

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

2016-02-05 Thread Petr Mladek
On Mon 2016-01-25 16:29:54, Torsten Duwe wrote: > diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c > index ef8b916..29b7014 100644 > --- a/arch/powerpc/kernel/ftrace.c > +++ b/arch/powerpc/kernel/ftrace.c > @@ -28,6 +28,11 @@ > > > #ifdef CONFIG_DYNAMIC_FTRACE > +#if

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

2016-02-02 Thread Petr Mladek
On Tue 2016-02-02 16:45:23, Torsten Duwe wrote: > 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 mo

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

2016-02-02 Thread Petr Mladek
On Tue 2016-01-26 13:48:53, Petr Mladek wrote: > On Tue 2016-01-26 11:50:25, Miroslav Benes wrote: > > > > [ added Petr to CC list ] > > > > On Mon, 25 Jan 2016, Torsten Duwe wrote: > > > > > * create the appropriate files+functions >

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

2016-01-21 Thread Petr Mladek
On Wed 2016-01-20 10:48:30, Petr Mladek wrote: > I did the testing on PPC64LE with a kernel based on 4.4.0-rc8 > using the attached config. I used the following stuff: Ah, I forgot to attach it. Also it is rahter big. Please, find it at http://pastebin.com/tzJ3mdUd Best Regards

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

2016-01-26 Thread Petr Mladek
On Tue 2016-01-26 11:50:25, Miroslav Benes wrote: > > [ added Petr to CC list ] > > On Mon, 25 Jan 2016, Torsten Duwe wrote: > > > * create the appropriate files+functions > > arch/powerpc/include/asm/livepatch.h > > klp_check_compiler_support, > > klp_arch_set_pc > >

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

2016-01-20 Thread Petr Mladek
On Wed 2016-01-20 17:03:23, Michael Ellerman wrote: > On Wed, 2016-01-06 at 15:17 +0100, Petr Mladek wrote: > > On Fri 2015-12-04 15:45:29, Torsten Duwe wrote: > > > Changes since v4: > > > * change comment style in entry_64.S to C89 > > > (nobod

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

2016-02-16 Thread Petr Mladek
On Tue 2016-02-16 11:39:07, Torsten Duwe wrote: > On Tue, Feb 16, 2016 at 04:00:30PM +0530, Kamalesh Babulal wrote: > > * Torsten Duwe [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

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

2016-03-10 Thread Petr Mladek
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 eliminated iff the functionality of klp_return_helper, which required > > a stack frame for the

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

2016-03-10 Thread Petr Mladek
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 eliminated iff the functionality of klp_return_helper, which required > a stack frame for the extra return address previously, is carried out > by the replacement

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

2016-03-18 Thread Petr Mladek
On Thu 2016-03-17 16:59:28, Torsten Duwe wrote: > 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

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

2016-03-09 Thread Petr Mladek
On Wed 2016-03-09 12:16:47, Torsten Duwe wrote: > 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

[PATCH] livepatch: Add some basic LivePatch documentation

2016-03-09 Thread Petr Mladek
LivePatch framework deserves some documentation, definitely. This is an attempt to provide some basic info. I hope that it will be useful for both LivePatch producers and also potential developers of the framework itself. Signed-off-by: Petr Mladek <pmla...@suse.com> --- This patch was mot

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

2016-03-09 Thread Petr Mladek
On Tue 2016-03-08 16:34:35, Torsten Duwe wrote: > 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

Re: [PATCH v2 1/5] printk/nmi: Generic solution for safe printk in NMI

2016-03-19 Thread Petr Mladek
On Thu 2016-03-17 12:35:27, Andrew Morton wrote: > On Fri, 4 Dec 2015 17:57:44 +0100 Petr Mladek <pmla...@suse.com> wrote: > > > On Wed 2015-12-02 00:24:49, Jiri Kosina wrote: > > > On Fri, 27 Nov 2015, Petr Mladek wrote: > > > > > > > MN10300 has

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

2016-03-08 Thread Petr Mladek
XX ---[ end trace 17a32fcaa99f5af5 ]--- Here is the patch that I used: From 313627cab861dd53d3325efc3d4d364eee77f9db Mon Sep 17 00:00:00 2001 From: Petr Mladek <

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

2016-03-04 Thread Petr Mladek
On Fri 2016-03-04 13:42:47, Torsten Duwe wrote: > 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

Re: [PATCH][v3] Enable livepatching on powerpc

2016-03-03 Thread Petr Mladek
On Fri 2016-03-04 00:11:55, Balbir Singh wrote: > > Changelog v3: > 1. Moved -ENOSYS to -EINVAL in klp_write_module_reloc > 2. Moved klp_matchaddr to use ftrace_location_range Ah, I have been working on it in parallel. It took me longer because I was busy with some other stuff

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

2016-03-03 Thread Petr Mladek
gh <bsinghar...@gmail.com> Signed-off-by: Petr Mladek <pmla...@suse.com> --- arch/powerpc/Kconfig | 3 +++ arch/powerpc/include/asm/livepatch.h | 47 + arch/powerpc/kernel/Makefile | 1 + arch/powerpc/kern

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

2016-03-09 Thread Petr Mladek
On Wed 2016-03-09 10:19:04, Torsten Duwe wrote: > 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

Re: [PATCH v4 1/5] printk/nmi: generic solution for safe printk in NMI

2016-04-04 Thread Petr Mladek
On Mon 2016-04-04 13:49:28, Sergey Senozhatsky wrote: > Hello, > > On (03/30/16 17:53), Petr Mladek wrote: > [..] > > @@ -67,10 +67,12 @@ extern void irq_exit(void); > > preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \ >

[PATCH v4 2/5] printk/nmi: use IRQ work only when ready

2016-03-30 Thread Petr Mladek
NMIs could happen at any time. This patch makes sure that the safe printk() in NMI will schedule IRQ work only when the related structs are initialized. All pending messages are flushed when the IRQ work is being initialized. Signed-off-by: Petr Mladek <pmla...@suse.com> Cc: Jan K

[PATCH v4 5/5] printk/nmi: flush NMI messages on the system panic

2016-03-30 Thread Petr Mladek
consoles in this case. They might use internal locks and we could not prevent a deadlock easily. We only want to have the messages in the main ring buffer for crash dump and kmsg_dump(). The consoles are explicitly called later by console_flush_on_panic(). Signed-off-by: Petr Mladek <pmla...@suse.

[PATCH v4 3/5] printk/nmi: warn when some message has been lost in NMI context

2016-03-30 Thread Petr Mladek
-foundation.org: whitespace fixlet] Signed-off-by: Petr Mladek <pmla...@suse.com> Cc: Jan Kara <j...@suse.cz> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Steven Rostedt <rost...@goodmis.org> Cc: Russell King <rmk+ker...@arm.linux.org.uk> Cc: Daniel Thompson <dan

[PATCH v4 0/5] Cleaning printk stuff in NMI context

2016-03-30 Thread Petr Mladek
ces when printing directly (oops_in_progress) Petr Mladek (5): printk/nmi: generic solution for safe printk in NMI printk/nmi: use IRQ work only when ready printk/nmi: warn when some message has been lost in NMI context printk/nmi: increase the size of NMI buffer and make it conf

[PATCH v4 1/5] printk/nmi: generic solution for safe printk in NMI

2016-03-30 Thread Petr Mladek
I handling there first. Let's do it separately. The patch is heavily based on the draft from Peter Zijlstra, see https://lkml.org/lkml/2015/6/10/327 [a...@arndb.de: printk-nmi: use %zu format string for size_t] [a...@linux-foundation.org: min_t->min - all types are size_t here] Signed-off-by

[PATCH v4 4/5] printk/nmi: increase the size of NMI buffer and make it configurable

2016-03-30 Thread Petr Mladek
-specific implementation that was added by the commit a9edc8809328 ("x86/nmi: Perform a safe NMI stack trace on all CPUs"). Nobody noticed it because it did not print any warnings. Signed-off-by: Petr Mladek <pmla...@suse.com> Cc: Jan Kara <j...@suse.cz> Cc: Peter Zijlstra <

Re: [PATCH v4 5/5] printk/nmi: flush NMI messages on the system panic

2016-03-31 Thread Petr Mladek
gt; https://github.com/0day-ci/linux/commits/Petr-Mladek/Cleaning-printk-stuff-in-NMI-context/20160330-235818 > config: i386-randconfig-s1-201613 (attached as .config) > reproduce: > # save the attached .config to linux build tree > make ARCH=i386 > > All err

[PATCH v2] livepatch: Add some basic LivePatch documentation

2016-04-25 Thread Petr Mladek
LivePatch framework deserves some documentation, definitely. This is an attempt to provide some basic info. I hope that it will be useful for both LivePatch producers and also potential developers of the framework itself. Signed-off-by: Petr Mladek <pmla...@suse.com> --- This v

Re: [PATCH v5 4/4] printk/nmi: flush NMI messages on the system panic

2016-04-26 Thread Petr Mladek
On Sat 2016-04-23 12:49:24, Sergey Senozhatsky wrote: > Hello Petr, > > On (04/21/16 13:48), Petr Mladek wrote: > > extern void printk_nmi_flush(void); > > +extern void printk_nmi_flush_on_panic(void); > > #else > > static inline void printk_nmi_flush(

Re: klp_task_patch: was: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model

2016-05-18 Thread Petr Mladek
On Mon 2016-05-16 13:12:50, Josh Poimboeuf wrote: > On Mon, May 09, 2016 at 02:23:03PM +0200, Petr Mladek wrote: > > On Fri 2016-05-06 07:38:55, Josh Poimboeuf wrote: > > > On Thu, May 05, 2016 at 01:57:01PM +0200, Petr Mladek wrote: > > > > I have missed th

Re: [RFC PATCH v2 13/18] livepatch: separate enabled and patched states

2016-05-03 Thread Petr Mladek
On Thu 2016-04-28 15:44:44, Josh Poimboeuf wrote: > Once we have a consistency model, patches and their objects will be > enabled and disabled at different times. For example, when a patch is > disabled, its loaded objects' funcs can remain registered with ftrace > indefinitely until the

Re: [RFC PATCH v2 15/18] livepatch: move patching functions into patch.c

2016-05-03 Thread Petr Mladek
On Thu 2016-04-28 15:44:46, Josh Poimboeuf wrote: > Move functions related to the actual patching of functions and objects > into a new patch.c file. > > diff --git a/kernel/livepatch/patch.c b/kernel/livepatch/patch.c > new file mode 100644 > index 000..782fbb5 > --- /dev/null > +++

Re: [RFC PATCH v2 10/18] livepatch/powerpc: add TIF_PATCH_PENDING thread flag

2016-05-03 Thread Petr Mladek
On Thu 2016-04-28 15:44:41, Josh Poimboeuf wrote: > Add the TIF_PATCH_PENDING thread flag to enable the new livepatch > per-task consistency model for powerpc. The bit getting set indicates > the thread has a pending patch which needs to be applied when the thread > exits the kernel. > > The bit

barriers: was: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model

2016-05-04 Thread Petr Mladek
On Thu 2016-04-28 15:44:48, Josh Poimboeuf wrote: > Change livepatch to use a basic per-task consistency model. This is the > foundation which will eventually enable us to patch those ~10% of > security patches which change function or data semantics. This is the > biggest remaining piece needed

Re: barriers: was: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model

2016-05-04 Thread Petr Mladek
On Wed 2016-05-04 14:39:40, Petr Mladek wrote: >* >* Note that the task must never be migrated to the target >* state when being inside this ftrace handler. >*/ > > We might want to move the second paragraph on t

Re: barriers: was: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model

2016-05-05 Thread Petr Mladek
On Wed 2016-05-04 12:02:36, Josh Poimboeuf wrote: > On Wed, May 04, 2016 at 02:39:40PM +0200, Petr Mladek wrote: > > On Thu 2016-04-28 15:44:48, Josh Poimboeuf wrote: > > > Change livepatch to use a basic per-task consistency model. This is the > > > foundation whic

klp_task_patch: was: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model

2016-05-04 Thread Petr Mladek
On Thu 2016-04-28 15:44:48, Josh Poimboeuf wrote: > Change livepatch to use a basic per-task consistency model. This is the > foundation which will eventually enable us to patch those ~10% of > security patches which change function or data semantics. This is the > biggest remaining piece needed

Re: barriers: was: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model

2016-05-05 Thread Petr Mladek
On Wed 2016-05-04 12:25:17, Josh Poimboeuf wrote: > On Wed, May 04, 2016 at 04:12:05PM +0200, Petr Mladek wrote: > > On Wed 2016-05-04 14:39:40, Petr Mladek wrote: > > >* > > >* Note that the task must never be migrated to the target > >

Re: klp_task_patch: was: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model

2016-05-05 Thread Petr Mladek
On Wed 2016-05-04 12:57:00, Josh Poimboeuf wrote: > On Wed, May 04, 2016 at 04:48:54PM +0200, Petr Mladek wrote: > > On Thu 2016-04-28 15:44:48, Josh Poimboeuf wrote: > > > Change livepatch to use a basic per-task consistency model. This is the > > > foundation whic

Re: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model

2016-05-05 Thread Petr Mladek
On Wed 2016-05-04 10:51:21, Josh Poimboeuf wrote: > On Wed, May 04, 2016 at 10:42:23AM +0200, Petr Mladek wrote: > > On Thu 2016-04-28 15:44:48, Josh Poimboeuf wrote: > > > Change livepatch to use a basic per-task consistency model. This is the > > > foundation whic

Re: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model

2016-05-06 Thread Petr Mladek
On Thu 2016-04-28 15:44:48, Josh Poimboeuf wrote: > diff --git a/kernel/livepatch/patch.c b/kernel/livepatch/patch.c > index 782fbb5..b3b8639 100644 > --- a/kernel/livepatch/patch.c > +++ b/kernel/livepatch/patch.c > @@ -29,6 +29,7 @@ > #include > #include > #include "patch.h" > +#include

Re: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model

2016-05-04 Thread Petr Mladek
On Thu 2016-04-28 15:44:48, Josh Poimboeuf wrote: > Change livepatch to use a basic per-task consistency model. This is the > foundation which will eventually enable us to patch those ~10% of > security patches which change function or data semantics. This is the > biggest remaining piece needed

Re: [PATCH v4 1/5] printk/nmi: generic solution for safe printk in NMI

2016-04-20 Thread Petr Mladek
On Mon 2016-04-04 11:38:19, Petr Mladek wrote: > On Mon 2016-04-04 13:49:28, Sergey Senozhatsky wrote: > > Hello, > > > > On (03/30/16 17:53), Petr Mladek wrote: > > > +/* > > > + * Flush data from the associated per_CPU buffer. The function >

[PATCH v5 2/4] printk/nmi: warn when some message has been lost in NMI context

2016-04-21 Thread Petr Mladek
-foundation.org: whitespace fixlet] Signed-off-by: Petr Mladek <pmla...@suse.com> Cc: Jan Kara <j...@suse.cz> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Steven Rostedt <rost...@goodmis.org> Cc: Russell King <rmk+ker...@arm.linux.org.uk> Cc: Daniel Thompson <dan

[PATCH v5 4/4] printk/nmi: flush NMI messages on the system panic

2016-04-21 Thread Petr Mladek
() so that the console handling is skipped. Consoles use internal locks and we could not prevent a deadlock easily. They are explicitly called later when the crash dump is not generated, see console_flush_on_panic(). Signed-off-by: Petr Mladek <pmla...@suse.com> --- include/linux/printk.h

[PATCH v5 3/4] printk/nmi: increase the size of NMI buffer and make it configurable

2016-04-21 Thread Petr Mladek
-specific implementation that was added by the commit a9edc8809328 ("x86/nmi: Perform a safe NMI stack trace on all CPUs"). Nobody noticed it because it did not print any warnings. Signed-off-by: Petr Mladek <pmla...@suse.com> Cc: Jan Kara <j...@suse.cz> Cc: Peter Zijlstra <

[PATCH v5 0/4] Cleaning printk stuff in NMI context

2016-04-21 Thread Petr Mladek
PU_V7M + defined HAVE_NMI also on mips; it calls nmi_enter() and seems to have real NMIs (or am I wrong?) + serialized backtraces when printing directly (oops_in_progress) Petr Mladek (4): printk/nmi: generic solution for safe printk in NMI printk/nmi: warn when some message has been lost

[PATCH v5 1/4] printk/nmi: generic solution for safe printk in NMI

2016-04-21 Thread Petr Mladek
I handling there first. Let's do it separately. The patch is heavily based on the draft from Peter Zijlstra, see https://lkml.org/lkml/2015/6/10/327 [a...@arndb.de: printk-nmi: use %zu format string for size_t] [a...@linux-foundation.org: min_t->min - all types are size_t here] Signed-off-by

Re: klp_task_patch: was: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model

2016-05-09 Thread Petr Mladek
On Fri 2016-05-06 07:38:55, Josh Poimboeuf wrote: > On Thu, May 05, 2016 at 01:57:01PM +0200, Petr Mladek wrote: > > I have missed that the two commands are called with preemption > > disabled. So, I had the following crazy scenario in mind: > > > > > > CPU0

Re: [PATCH v4 13/15] livepatch: change to a per-task consistency model

2017-02-08 Thread Petr Mladek
On Mon 2017-02-06 13:51:48, Josh Poimboeuf wrote: > On Mon, Feb 06, 2017 at 05:44:31PM +0100, Petr Mladek wrote: > > > > > @@ -347,22 +354,37 @@ static int __klp_enable_patch(struct klp_patch > > > > > *patch) > > > > > > > > >

Re: [PATCH v4 13/15] livepatch: change to a per-task consistency model

2017-02-02 Thread Petr Mladek
On Thu 2017-01-19 09:46:21, Josh Poimboeuf wrote: > Change livepatch to use a basic per-task consistency model. This is the > foundation which will eventually enable us to patch those ~10% of > security patches which change function or data semantics. This is the > biggest remaining piece needed

Re: [PATCH v4 13/15] livepatch: change to a per-task consistency model

2017-02-02 Thread Petr Mladek
!!! This is the right version. I am sorry again for the confusion. !!! > Change livepatch to use a basic per-task consistency model. This is the > foundation which will eventually enable us to patch those ~10% of > security patches which change function or data semantics. This is the > biggest

Re: [PATCH v4 13/15] livepatch: change to a per-task consistency model

2017-02-02 Thread Petr Mladek
IMPORTANT: Please, forget this version. It is few days old and incomplete and probably wrong. I am sorry for confusion. Best Regards, Petr

Re: [PATCH v4 00/15] livepatch: hybrid consistency model

2017-02-02 Thread Petr Mladek
On Wed 2017-02-01 14:02:43, Josh Poimboeuf wrote: > On Thu, Jan 19, 2017 at 09:46:08AM -0600, Josh Poimboeuf wrote: > > Here's v4, based on linux-next/master. Mostly minor changes this time, > > primarily due to Petr's v3 comments. > > So far, the only review comments have been related to the

Re: [PATCH v4 13/15] livepatch: change to a per-task consistency model

2017-02-06 Thread Petr Mladek
On Fri 2017-02-03 14:39:16, Josh Poimboeuf wrote: > On Thu, Feb 02, 2017 at 12:51:16PM +0100, Petr Mladek wrote: > > !!! This is the right version. I am sorry again for the confusion. !!! > > > > > static int __klp_disable_patch(struct klp_patch *patch) > > >

Re: [PATCH v4 01/15] stacktrace/x86: add function for detecting reliable stack traces

2017-01-26 Thread Petr Mladek
On Thu 2017-01-19 09:46:09, Josh Poimboeuf wrote: > For live patching and possibly other use cases, a stack trace is only > useful if it can be assured that it's completely reliable. Add a new > save_stack_trace_tsk_reliable() function to achieve that. > diff --git a/arch/x86/kernel/stacktrace.c

Re: [PATCH v4 13/15] livepatch: change to a per-task consistency model

2017-02-09 Thread Petr Mladek
On Wed 2017-02-08 10:46:36, Josh Poimboeuf wrote: > On Wed, Feb 08, 2017 at 04:47:50PM +0100, Petr Mladek wrote: > > > Notice in this case that klp_target_state is KLP_PATCHED. Which means > > > that klp_complete_transition() would not call synchronize_rcu() at the > &

Re: [PATCH v3 01/15] stacktrace/x86: add function for detecting reliable stack traces

2016-12-16 Thread Petr Mladek
On Thu 2016-12-08 12:08:26, Josh Poimboeuf wrote: > For live patching and possibly other use cases, a stack trace is only > useful if it can be assured that it's completely reliable. Add a new > save_stack_trace_tsk_reliable() function to achieve that. > > Scenarios which indicate that a stack

Re: [PATCH v3 02/15] x86/entry: define _TIF_ALLWORK_MASK flags explicitly

2016-12-16 Thread Petr Mladek
T | _TIF_USER_RETURN_NOTIFY | _TIF_UPROBE | \ > + _TIF_SYSCALL_TRACEPOINT | _TIF_NOHZ) All flags are sorted by the number except for _TIF_SINGLESTEP and _TIF_NEED_RESCHED ;-) The patch does not change the existing behavior. The same existing flags are listed. Reviewed-by: Petr Mladek <pmla...@suse.com> Best Regards, Petr

Re: [PATCH v3 03/15] livepatch: temporary stubs for klp_patch_pending() and klp_update_patch_state()

2016-12-16 Thread Petr Mladek
tion is just a cosmetic problem. If it could be fixed, it would be great. But the patch makes sense: Reviewed-by: Petr Mladek <pmla...@suse.com> Best Regards, Petr

Re: [PATCH v3 04/15] livepatch/x86: add TIF_PATCH_PENDING thread flag

2016-12-16 Thread Petr Mladek
> > The bit is placed in the _TIF_ALLWORK_MASK macro, which results in > exit_to_usermode_loop() calling klp_update_patch_state() when it's set. > > Signed-off-by: Josh Poimboeuf <jpoim...@redhat.com> Reviewed-by: Petr Mladek <pmla...@suse.com> Best Regards, Petr

  1   2   3   >