Re: [PATCH] kill empty chardev open/release methods

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alan Cox
Date: Friday, May 16, 2008 - 1:55 pm

> > If they literaly are 'return 0' you can just remove them, as a

Actually it turns out you can introduce bugs doing this when the BKL is
pushed down.

The problem is the methods are not NULL, they (with the lock pushed down
are)

{
	lock_kernel();
	unlock_kernel();
}

And we have drivers with setup code that does things in the wrong order
but under the BKL. eg one I just fixed did

	misc_register()
	init locks
	allocate memory
	do stuff
	return 0;

The lock/unlock in the open happens to save your butt against the wrong
order of intialisation because the open cannot occur before the lock is
taken, and thanks to the BKL it cannot make any progress until the setup
is completed. Fun too - udev loves opening things as they appear so in
some cases we might actually trigger them too.

So when you remove the _open() empty methods *please* make sure you have
verified the correctness and ordering of the entire registration path.
I've found three examples of this so far just cleaning up
drivers/watchdog.

Alan
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [announce] "kill the Big Kernel Lock (BKL)" tree, Frederik Deweerdt, (Wed May 14, 1:05 pm)
[PATCH, RFC] char dev BKL pushdown , Jonathan Corbet, (Fri May 16, 8:44 am)
Re: [PATCH, RFC] char dev BKL pushdown, Christoph Hellwig, (Fri May 16, 8:49 am)
[PATCH] kill empty chardev open/release methods, Christoph Hellwig, (Fri May 16, 9:03 am)
Re: [PATCH, RFC] char dev BKL pushdown, Alan Cox, (Fri May 16, 9:22 am)
Re: [PATCH, RFC] char dev BKL pushdown , Linus Torvalds, (Fri May 16, 9:30 am)
Re: [PATCH, RFC] char dev BKL pushdown , Jonathan Corbet, (Fri May 16, 9:43 am)
Re: [PATCH] kill empty chardev open/release methods, Alan Cox, (Fri May 16, 1:55 pm)
Re: [PATCH, RFC] char dev BKL pushdown, Arnd Bergmann, (Sat May 17, 2:15 pm)
Re: [PATCH, RFC] char dev BKL pushdown , Linus Torvalds, (Sat May 17, 2:58 pm)
Re: [PATCH] kill empty chardev open/release methods , Jonathan Corbet, (Sun May 18, 12:46 pm)
Re: [PATCH] kill empty chardev open/release methods, Alan Cox, (Sun May 18, 12:58 pm)
Re: [PATCH, RFC] char dev BKL pushdown , Jonathan Corbet, (Sun May 18, 1:07 pm)
Re: [PATCH, RFC] char dev BKL pushdown , Jonathan Corbet, (Sun May 18, 1:26 pm)
Re: [PATCH, RFC] char dev BKL pushdown, Arnd Bergmann, (Mon May 19, 4:07 pm)
[PATCH 1/3, RFC] misc char dev BKL pushdown, Arnd Bergmann, (Mon May 19, 4:26 pm)
[PATCH 3/3, RFC] remove BKL from misc_open(), Arnd Bergmann, (Mon May 19, 4:34 pm)
Re: [PATCH 1/3, RFC] misc char dev BKL pushdown, Mike Frysinger, (Mon May 19, 5:07 pm)
Re: [PATCH 1/3, RFC] misc char dev BKL pushdown , Jonathan Corbet, (Mon May 19, 5:21 pm)
Re: [PATCH 1/3, RFC] misc char dev BKL pushdown, Mike Frysinger, (Mon May 19, 5:46 pm)
Re: [PATCH 1/3, RFC] misc char dev BKL pushdown, Alan Cox, (Tue May 20, 1:46 am)
Re: [PATCH, RFC] char dev BKL pushdown , Jonathan Corbet, (Tue May 20, 8:13 am)
Re: [PATCH, RFC] char dev BKL pushdown, Arnd Bergmann, (Tue May 20, 10:21 am)
Re: [PATCH, RFC] char dev BKL pushdown, Alan Cox, (Tue May 20, 11:51 am)
Re: [PATCH 1/3, RFC] misc char dev BKL pushdown, Mike Frysinger, (Tue May 20, 4:01 pm)
Re: [PATCH 1/3, RFC] misc char dev BKL pushdown , Jonathan Corbet, (Tue May 20, 4:25 pm)
Re: [PATCH 1/3, RFC] misc char dev BKL pushdown, Mike Frysinger, (Wed May 21, 9:22 am)