linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vojtech Pavlik <vojtech@suse.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Kosina <jkosina@suse.cz>,
	Peter Zijlstra <peterz@infradead.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Ingo Molnar <mingo@redhat.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	live-patching@vger.kernel.org, linux-kernel@vger.kernel.org,
	Seth Jennings <sjenning@redhat.com>
Subject: Re: [RFC PATCH 6/9] livepatch: create per-task consistency model
Date: Wed, 18 Feb 2015 21:44:44 +0100	[thread overview]
Message-ID: <20150218204444.GA7416@suse.com> (raw)
In-Reply-To: <20150218201755.GA20097@gmail.com>

On Wed, Feb 18, 2015 at 09:17:55PM +0100, Ingo Molnar wrote:
> 
> * Jiri Kosina <jkosina@suse.cz> wrote:
> 
> > On Thu, 12 Feb 2015, Peter Zijlstra wrote:
> > 
> > > And what's wrong with using known good spots like the freezer?
> > 
> > Quoting Tejun from the thread Jiri Slaby likely had on 
> > mind:
> > 
> > "The fact that they may coincide often can be useful as a 
> > guideline or whatever but I'm completely against just 
> > mushing it together when it isn't correct.  This kind of 
> > things quickly lead to ambiguous situations where people 
> > are not sure about the specific semantics or guarantees 
> > of the construct and implement weird voodoo code followed 
> > by voodoo fixes.  We already had a full round of that 
> > with the kernel freezer itself, where people thought that 
> > the freezer magically makes PM work properly for a 
> > subsystem.  Let's please not do that again."
> 
> I don't follow this vague argument.
> 
> The concept of 'freezing' all userspace execution is pretty 
> unambiguous: tasks that are running are trapped out at 
> known safe points such as context switch points or syscall 
> entry. Once all tasks have stopped, the system is frozen in 
> the sense that only the code we want is running, so you can 
> run special code without worrying about races.
> 
> What's the problem with that? Why would it be fundamentally 
> unsuitable for live patching?

For live patching it doesn't matter whether code is running, sleeping or
frozen.

What matters is whether there is state before patching that may not be
valid after patching.

For userspace tasks, the exit from a syscall is a perfect moment for
switching to the "after" state, as all stacks, and thus all local
variables are gone and no local state exists in the kernel for the
thread.

The freezer is a logical choice for kernel threads, however, given that
kernel threads have no defined entry/exit point and execute within a
single main function, local variables stay and thus local state persists
from before to after freezing.

Defining that no local state within a kernel thread may be relied upon
after exiting from the freezer is certainly possible, and is already
true for many kernel threads.

It isn't a given property of the freezer itself, though. And isn't
obvious for author of new kernel threads either.

The ideal solution would be to convert the majority of kernel threads to
workqueues, because then there is a defined entry/exit point over which
state isn't transferred. That is a lot of work, though, and has other
drawbacks, particularly in the realtime space.

-- 
Vojtech Pavlik
Director SUSE Labs

  reply	other threads:[~2015-02-18 21:02 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09 17:31 [RFC PATCH 0/9] livepatch: consistency model Josh Poimboeuf
2015-02-09 17:31 ` [RFC PATCH 1/9] livepatch: simplify disable error path Josh Poimboeuf
2015-02-13 12:25   ` Miroslav Benes
2015-02-18 17:03     ` Petr Mladek
2015-02-18 20:07   ` Jiri Kosina
2015-02-09 17:31 ` [RFC PATCH 2/9] livepatch: separate enabled and patched states Josh Poimboeuf
2015-02-10 16:44   ` Jiri Slaby
2015-02-10 17:21     ` Josh Poimboeuf
2015-02-13 12:57   ` Miroslav Benes
2015-02-13 14:39     ` Josh Poimboeuf
2015-02-13 14:46       ` Miroslav Benes
2015-02-09 17:31 ` [RFC PATCH 3/9] livepatch: move patching functions into patch.c Josh Poimboeuf
2015-02-10 18:27   ` Jiri Slaby
2015-02-10 18:50     ` Josh Poimboeuf
2015-02-13 14:28   ` Miroslav Benes
2015-02-13 15:09     ` Josh Poimboeuf
2015-02-09 17:31 ` [RFC PATCH 4/9] livepatch: get function sizes Josh Poimboeuf
2015-02-10 18:30   ` Jiri Slaby
2015-02-10 18:53     ` Josh Poimboeuf
2015-02-09 17:31 ` [RFC PATCH 5/9] sched: move task rq locking functions to sched.h Josh Poimboeuf
2015-02-10 10:48   ` Masami Hiramatsu
2015-02-10 14:54     ` Josh Poimboeuf
2015-02-09 17:31 ` [RFC PATCH 6/9] livepatch: create per-task consistency model Josh Poimboeuf
2015-02-10 10:58   ` Masami Hiramatsu
2015-02-10 14:59     ` Josh Poimboeuf
2015-02-10 15:59   ` Miroslav Benes
2015-02-10 16:56     ` Josh Poimboeuf
2015-02-11 16:28       ` Miroslav Benes
2015-02-11 20:23         ` Josh Poimboeuf
2015-02-10 19:27   ` Seth Jennings
2015-02-10 19:32     ` Josh Poimboeuf
2015-02-11 10:21   ` Miroslav Benes
2015-02-11 20:19     ` Josh Poimboeuf
2015-02-12 10:45       ` Miroslav Benes
2015-02-12  3:21   ` Josh Poimboeuf
2015-02-12 11:56     ` Peter Zijlstra
2015-02-12 12:25       ` Jiri Kosina
2015-02-12 12:36         ` Peter Zijlstra
2015-02-12 12:39           ` Jiri Kosina
2015-02-12 12:39         ` Peter Zijlstra
2015-02-12 12:42           ` Jiri Kosina
2015-02-12 13:01             ` Josh Poimboeuf
2015-02-12 12:51       ` Josh Poimboeuf
2015-02-12 13:08         ` Peter Zijlstra
2015-02-12 13:16           ` Jiri Kosina
2015-02-12 14:20             ` Josh Poimboeuf
2015-02-12 14:27               ` Jiri Kosina
2015-02-12 13:16           ` Jiri Slaby
2015-02-12 13:35             ` Peter Zijlstra
2015-02-12 14:08               ` Jiri Kosina
2015-02-12 15:24                 ` Josh Poimboeuf
2015-02-12 14:20               ` Jiri Slaby
2015-02-12 14:32           ` Jiri Kosina
2015-02-18 20:17             ` Ingo Molnar
2015-02-18 20:44               ` Vojtech Pavlik [this message]
2015-02-19  9:52                 ` Peter Zijlstra
2015-02-19 10:11                   ` Vojtech Pavlik
2015-02-19 10:51                     ` Peter Zijlstra
2015-02-12 13:26     ` Jiri Slaby
2015-02-12 15:48       ` Josh Poimboeuf
2015-02-14 11:40   ` Jiri Slaby
2015-02-17 14:59     ` Josh Poimboeuf
2015-02-16 14:19   ` Miroslav Benes
2015-02-17 15:10     ` Josh Poimboeuf
2015-02-17 15:48       ` Miroslav Benes
2015-02-17 16:01         ` Josh Poimboeuf
2015-02-18 12:42           ` Miroslav Benes
2015-02-18 13:15             ` Josh Poimboeuf
2015-02-18 13:42               ` Miroslav Benes
2015-02-09 17:31 ` [RFC PATCH 7/9] proc: add /proc/<pid>/universe to show livepatch status Josh Poimboeuf
2015-02-10 18:47   ` Jiri Slaby
2015-02-10 18:57     ` Josh Poimboeuf
2015-02-09 17:31 ` [RFC PATCH 8/9] livepatch: allow patch modules to be removed Josh Poimboeuf
2015-02-10 19:02   ` Jiri Slaby
2015-02-10 19:57     ` Josh Poimboeuf
2015-02-11 10:55       ` Jiri Slaby
2015-02-11 18:39         ` Josh Poimboeuf
2015-02-12 15:22     ` Miroslav Benes
2015-02-13 12:44       ` Josh Poimboeuf
2015-02-13 16:04       ` Josh Poimboeuf
2015-02-13 16:17         ` Miroslav Benes
2015-02-13 20:49           ` Josh Poimboeuf
2015-02-16 16:06             ` Miroslav Benes
2015-02-17 15:55               ` Josh Poimboeuf
2015-02-17 16:38                 ` Miroslav Benes
2015-02-09 17:31 ` [RFC PATCH 9/9] livepatch: update task universe when exiting kernel Josh Poimboeuf
2015-02-16 10:16   ` Jiri Slaby
2015-02-17 14:58     ` Josh Poimboeuf
2015-02-09 23:15 ` [RFC PATCH 0/9] livepatch: consistency model Jiri Kosina
2015-02-10  3:05   ` Josh Poimboeuf
2015-02-10  7:21     ` Jiri Kosina
2015-02-10  8:57 ` Jiri Kosina
2015-02-10 14:43   ` Josh Poimboeuf
2015-02-10 11:16 ` Masami Hiramatsu
2015-02-10 15:59   ` Josh Poimboeuf
2015-02-10 17:29     ` Josh Poimboeuf
2015-02-13 10:14 ` Jiri Kosina
2015-02-13 14:19   ` Josh Poimboeuf
2015-02-13 14:22     ` Jiri Kosina
2015-02-13 14:40       ` Miroslav Benes
2015-02-13 14:55         ` Josh Poimboeuf
2015-02-13 14:41       ` Josh Poimboeuf
2015-02-24 11:27         ` Masami Hiramatsu
2015-03-10 16:23 ` Josh Poimboeuf
2015-03-10 21:02   ` Jiri Kosina
2015-03-10 21:30     ` 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=20150218204444.GA7416@suse.com \
    --to=vojtech@suse.com \
    --cc=jkosina@suse.cz \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sjenning@redhat.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 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 NNTP newsgroup(s).