Re: [PRE-REVIEW PATCH 11/16] treewide: Globally replace tasklet_init() by tasklet_setup()

Kees Cook
2019-10-10T22:31:16Z

On Tue, Oct 01, 2019 at 07:18:28PM +0200, Romain Perier wrote:
> On Mon, Sep 30, 2019 at 03:46:29PM -0700, Kees Cook wrote:
> > On Sun, Sep 29, 2019 at 06:30:23PM +0200, Romain Perier wrote:
> > > This converts all remaining cases of the old tasklet_init() API into
> > > tasklet_setup(), where the callback argument is the structure already
> > > holding the struct tasklet_struct. These should have no behavioral changes,
> > > since they just change which pointer is passed into the callback with
> > > the same available pointers after conversion. Moreover, all callbacks
> > > that were not passing a pointer of structure holding the struct
> > > tasklet_struct has already been converted.
> >
> > Was this done mechanically with Coccinelle or manually? (If done with
> > Coccinelle, please include the script in the commit log.) To land a
> > treewide change like this usually you'll need to separate the mechanical
> > from the manual as Linus likes to run those changes himself sometimes.
>
> Hi,
>
> This was done with both technics mechanically with a "buggy" Coccinelle
> script, after what I have fixed building errors and mismatches (even if it's
> clearly super powerful, it was my first complex cocci script). 80% of trivial
> replacements were done with a Cocci script, the rest was done manually.
> That's complicated to remember which one was mechanically or manually to
> be honnest :=D
>
> What I can propose is the following:
>
> - A commit for trivial tasklet_init() -> tasklet_setup() replacements:
> it would contain basic replacements of the calls "tasklet_init() ->
> tasklet_setup()" and addition of "from_tasklet()" without any other
> changes.

Right -- the manual ones might need to be split up by subsystem or
driver.

> - A second commit for more complicated replacements:
> It would contain replacements of functions that are in different
> modules, or modules that use function pointer for tasklet handlers
> etc... Basically everything that is not covered by the first commit

Same for this if it can't be automated.

> What do you think ?
> Moreover, the cocci script I have used is... ugly... so I don't want to
> see Linus's eyes bleed :=D

Heh. Well, the timer_struct Cocci script was ugly too. The idea is that
maintainers will likely want per-driver patches, so the more you can
automate with a script to put in a single commit for Linus would be
better for your own sanity. :)

> PS: I can try to recover the cocci script in my git repo by using "git
> reflog". And put the cocci script in the first commit (for trivial
> replacements), in the worst case...

Probably it is only needed in the commit log.

--
Kees Cook