Re: [RFC PATCH 0/9] livepatch: consistency model

Josh Poimboeuf
2015-02-10T14:43:44Z

On Tue, Feb 10, 2015 at 09:57:44AM +0100, Jiri Kosina wrote:
> On Mon, 9 Feb 2015, Josh Poimboeuf wrote:
>
> > 2) As mentioned above, kthreads which are always sleeping on a patched function
> > will never transition to the new universe. This is really a minor issue
> > (less than 1% of patches). It's not necessarily something that needs to be
> > resolved with this patch set, but it would be good to have some discussion
> > about it regardless.
> >
> > To overcome this issue, I have 1/2 an idea: we could add some stack checking
> > code to the ftrace handler itself to transition the kthread to the new
> > universe after it re-enters the function it was originally sleeping on, if
> > the stack doesn't already have have any other to-be-patched functions.
> > Combined with the klp_transition_work_fn()'s periodic stack checking of
> > sleeping tasks, that would handle most of the cases (except when trying to
> > patch the high-level thread_fn itself).
> >
> > But then how do you make the kthread wake up? As far as I can tell,
> > wake_up_process() doesn't seem to work on a kthread (unless I messed up my
> > testing somehow). What does kGraft do in this case?
>
> wake_up_process() really should work for (p->flags & PF_KTHREAD)
> task_struct. What was your testing scenario?

Hm, I probably did something stupid. I'll try it again :-)

--
Josh