[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220512040754.hcnip7d2rhp4ldgg@treble>
Date: Wed, 11 May 2022 21:07:54 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Song Liu <songliubraving@...com>
Cc: Petr Mladek <pmladek@...e.com>, Rik van Riel <riel@...com>,
"song@...nel.org" <song@...nel.org>,
"joe.lawrence@...hat.com" <joe.lawrence@...hat.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"vincent.guittot@...aro.org" <vincent.guittot@...aro.org>,
"live-patching@...r.kernel.org" <live-patching@...r.kernel.org>,
Kernel Team <Kernel-team@...com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"jpoimboe@...hat.com" <jpoimboe@...hat.com>
Subject: Re: [RFC] sched,livepatch: call klp_try_switch_task in __cond_resched
On Wed, May 11, 2022 at 04:33:57PM +0000, Song Liu wrote:
> >> Ideally we'd have the ORC unwinder for all arches, that would make this
> >> much easier. But we're not there yet.
> >
> > The alternative solution is that the process has to migrate itself
> > on some safe location.
> >
> > One crazy idea. It still might be possible to find the called
> > functions on the stack even when it is not reliable. Then it
> > might be possible to add another ftrace handler on
> > these found functions. This other ftrace handler might migrate
> > the task when it calls this function again.
> >
> > It assumes that the task will call the same functions again
> > and again. Also it might require that the tasks checks its
> > own stack from the ftrace handler. I am not sure if this
> > is possible.
> >
> > There might be other variants of this approach.
>
> This might be the ultimate solution! As ftrace allows filtering based
> on pid (/sys/kernel/tracing/set_ftrace_pid), we can technically trigger
> klp_try_switch_task() on every function of the pending tasks. If this
> works, we should finish most of the transition in seconds. And the only
> failure there would be threads with being patched function at the very
> sottom of its stack. Am I too optimistic here?
It's a crazy idea, but I kind of like it ;-) Especially this variant of
tracing all functions for the task. We'd have to make sure unwinding
from an ftrace handler works for all arches/unwinders.
--
Josh
Powered by blists - more mailing lists