Re: tasklet_kill will always hang for recursive tasklets on a UP

From: Nagendra Singh Tomar
Date: Thu Aug 28 2003 - 23:29:14 EST



On Thu, 28 Aug 2003 kuznet@xxxxxxxxxxxxx wrote:

> Hello!
>
> > Either the tasklet_kill hangs (which will happen on UP)
>
> Never can happen, unless you are trying to call tasklet_kill
> from softirq context, which is illegal.

If I was not explicit, I meant that tasklet_kill called from process
context, for recursive tasklets will *always* hang on a UP machine at
least till 2.4 when the kernel was not premptible. And yes, "always". The
logic says that and experimentation also shows that.

>
>
> > So I believe that at least one (to be precise, the last one called
> before
> > tasklet dies) tasklet_schedule is not honoured.
>
> You cannot call tasklet_schedule while kill is called. As I said in
> previous
> mail, preventing new schedules is responsibility of callers. tasklet
> struct
> and control functions do not maintain any information about its state,
> it is
> for client to handle this in his preferred way.

So a better name would be wait_for_tasklet_completion. I think now I
understand the
intent. If somebody is unloading a module which has scheduled a tasklet,
the module cleanup function wants to be sure that the tasklet is not
sitting on any CPU queue waiting to be executed (if that happens the
tasklet might try to access the module address space and if that happens
after the module unload we will get an OOPS). Once tasklet_kill completes
the caller of tsaklet_kill has the responsibility to make sure that it is
not scheduled again (if it is scheduled it will again start running
happily as if nothing has happened)
All is fine, but the recursive tasklet problem is still there. We need
to add another state to tasklet TASKLET_STATE_KILLED which is set once
tasklet_kill is called. Once this is set tasklet_schedule just does not
schedule the tasklet.

>
> You are right when saying the name is misnomer. tasklet_kill does not
> kill,
> it waits for the moment when tasklet becomes really dead after client
> strangled it with his own hands.
>
> Alexey
>

Thanx for making things clear.
tomar


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/