Re: [PATCH 3/3] tasklet: Introduce new initialization API

Matthew Wilcox
2020-07-16T15:38:42Z

On Wed, Jul 15, 2020 at 08:08:47PM -0700, Kees Cook wrote:
> +#define DECLARE_TASKLET(name, _callback) \
> +struct tasklet_struct name = { \
> + .count = ATOMIC_INIT(0), \
> + .callback = _callback, \
> + .use_callback = true, \
> +}
> +
> +#define DECLARE_TASKLET_DISABLED(name, _callback) \
> +struct tasklet_struct name = { \
> + .count = ATOMIC_INIT(1), \
> + .callback = _callback, \
> +}

You forgot to set use_callback here.

> @@ -547,7 +547,10 @@ static void tasklet_action_common(struct softirq_action *a,
> if (!test_and_clear_bit(TASKLET_STATE_SCHED,
> &t->state))
> BUG();
> - t->func(t->data);
> + if (t->use_callback)
> + t->callback(t);
> + else
> + t->func(t->data);

I think this is the wrong way to do the conversion. Start out by setting
t->data to (unsigned long)t in the new initialisers. Then convert the
drivers (all 350 of them) to the new API. Then you can get rid of 'data'
from the tasklet_struct.