Re: [RFC PATCH 6/9] livepatch: create per-task consistency model

Josh Poimboeuf
2015-02-10T14:59:12Z

On Tue, Feb 10, 2015 at 07:58:30PM +0900, Masami Hiramatsu wrote:
> (2015/02/10 2:31), Josh Poimboeuf wrote:
> > +/*
> > + * Try to safely transition a task to the universe goal. If the task is
> > + * currently running or is sleeping on a to-be-patched or to-be-unpatched
> > + * function, return false.
> > + */
> > +static bool klp_transition_task(struct task_struct *t)
> > +{
> > + struct rq *rq;
> > + unsigned long flags;
> > + int ret;
> > + bool success = false;
> > +
> > + if (t->klp_universe == klp_universe_goal)
> > + return true;
> > +
> > + rq = task_rq_lock(t, &flags);
> > +
> > + if (task_running(rq, t) && t != current) {
> > + pr_debug("%s: pid %d (%s) is running\n", __func__, t->pid,
> > + t->comm);
> > + goto done;
> > + }
>
> Let me confirm that this always skips running tasks, and klp retries
> checking by using delayed worker, correct?

Correct. Also, patch 9 of the series adds other ways to convert tasks,
using syscalls, irqs and signals.

--
Josh