Browse Source

BKL: introduce CONFIG_BKL.

With all the patches we have queued in the BKL removal tree, only a
few dozen modules are left that actually rely on the BKL, and even
there are lots of low-hanging fruit. We need to decide what to do
about them, this patch illustrates one of the options:

Every user of the BKL is marked as 'depends on BKL' in Kconfig,
and the CONFIG_BKL becomes a user-visible option. If it gets
disabled, no BKL using module can be built any more and the BKL
code itself is compiled out.

The one exception is file locking, which is practically always
enabled and does a 'select BKL' instead. This effectively forces
CONFIG_BKL to be enabled until we have solved the fs/lockd
mess and can apply the patch that removes the BKL from fs/locks.c.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Arnd Bergmann 15 years ago
parent
commit
6de5bd128d

+ 4 - 1
drivers/gpu/drm/Kconfig

@@ -73,7 +73,8 @@ source "drivers/gpu/drm/radeon/Kconfig"
 
 
 config DRM_I810
 config DRM_I810
 	tristate "Intel I810"
 	tristate "Intel I810"
-	depends on DRM && AGP && AGP_INTEL
+	# BKL usage in order to avoid AB-BA deadlocks, may become BROKEN_ON_SMP
+	depends on DRM && AGP && AGP_INTEL && BKL
 	help
 	help
 	  Choose this option if you have an Intel I810 graphics card.  If M is
 	  Choose this option if you have an Intel I810 graphics card.  If M is
 	  selected, the module will be called i810.  AGP support is required
 	  selected, the module will be called i810.  AGP support is required
@@ -86,6 +87,8 @@ choice
 
 
 config DRM_I830
 config DRM_I830
 	tristate "i830 driver"
 	tristate "i830 driver"
+	# BKL usage in order to avoid AB-BA deadlocks, i830 may get removed
+	depends on BKL
 	help
 	help
 	  Choose this option if you have a system that has Intel 830M, 845G,
 	  Choose this option if you have a system that has Intel 830M, 845G,
 	  852GM, 855GM or 865G integrated graphics.  If M is selected, the
 	  852GM, 855GM or 865G integrated graphics.  If M is selected, the

+ 1 - 0
drivers/media/Kconfig

@@ -19,6 +19,7 @@ comment "Multimedia core support"
 
 
 config VIDEO_DEV
 config VIDEO_DEV
 	tristate "Video For Linux"
 	tristate "Video For Linux"
+	depends on BKL # used in many drivers for ioctl handling, need to kill
 	---help---
 	---help---
 	  V4L core support for video capture and overlay devices, webcams and
 	  V4L core support for video capture and overlay devices, webcams and
 	  AM/FM radio cards.
 	  AM/FM radio cards.

+ 1 - 0
drivers/net/appletalk/Kconfig

@@ -3,6 +3,7 @@
 #
 #
 config ATALK
 config ATALK
 	tristate "Appletalk protocol support"
 	tristate "Appletalk protocol support"
+	depends on BKL # waiting to be removed from net/appletalk/ddp.c
 	select LLC
 	select LLC
 	---help---
 	---help---
 	  AppleTalk is the protocol that Apple computers can use to communicate
 	  AppleTalk is the protocol that Apple computers can use to communicate

+ 1 - 0
drivers/staging/cx25821/Kconfig

@@ -1,6 +1,7 @@
 config VIDEO_CX25821
 config VIDEO_CX25821
 	tristate "Conexant cx25821 support"
 	tristate "Conexant cx25821 support"
 	depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT
 	depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT
+	depends on BKL # please fix
 	select I2C_ALGOBIT
 	select I2C_ALGOBIT
 	select VIDEO_BTCX
 	select VIDEO_BTCX
 	select VIDEO_TVEEPROM
 	select VIDEO_TVEEPROM

+ 1 - 0
drivers/staging/easycap/Kconfig

@@ -1,6 +1,7 @@
 config EASYCAP
 config EASYCAP
 	tristate "EasyCAP USB ID 05e1:0408 support"
 	tristate "EasyCAP USB ID 05e1:0408 support"
 	depends on USB && VIDEO_DEV
 	depends on USB && VIDEO_DEV
+	depends on BKL # please fix
 
 
 	---help---
 	---help---
 	  This is an integrated audio/video driver for EasyCAP cards with
 	  This is an integrated audio/video driver for EasyCAP cards with

+ 1 - 0
drivers/staging/go7007/Kconfig

@@ -1,6 +1,7 @@
 config VIDEO_GO7007
 config VIDEO_GO7007
 	tristate "WIS GO7007 MPEG encoder support"
 	tristate "WIS GO7007 MPEG encoder support"
 	depends on VIDEO_DEV && PCI && I2C && INPUT
 	depends on VIDEO_DEV && PCI && I2C && INPUT
+	depends on BKL # please fix
 	depends on SND
 	depends on SND
 	select VIDEOBUF_DMA_SG
 	select VIDEOBUF_DMA_SG
 	select VIDEO_IR
 	select VIDEO_IR

+ 1 - 1
drivers/staging/usbip/Kconfig

@@ -1,6 +1,6 @@
 config USB_IP_COMMON
 config USB_IP_COMMON
 	tristate "USB IP support (EXPERIMENTAL)"
 	tristate "USB IP support (EXPERIMENTAL)"
-	depends on USB && NET && EXPERIMENTAL
+	depends on USB && NET && EXPERIMENTAL && BKL
 	default N
 	default N
 	---help---
 	---help---
 	  This enables pushing USB packets over IP to allow remote
 	  This enables pushing USB packets over IP to allow remote

+ 1 - 0
fs/Kconfig

@@ -50,6 +50,7 @@ endif # BLOCK
 config FILE_LOCKING
 config FILE_LOCKING
 	bool "Enable POSIX file locking API" if EMBEDDED
 	bool "Enable POSIX file locking API" if EMBEDDED
 	default y
 	default y
+	select BKL # while lockd still uses it.
 	help
 	help
 	  This option enables standard file locking support, required
 	  This option enables standard file locking support, required
           for filesystems like NFS and for the flock() system
           for filesystems like NFS and for the flock() system

+ 1 - 0
fs/adfs/Kconfig

@@ -1,6 +1,7 @@
 config ADFS_FS
 config ADFS_FS
 	tristate "ADFS file system support (EXPERIMENTAL)"
 	tristate "ADFS file system support (EXPERIMENTAL)"
 	depends on BLOCK && EXPERIMENTAL
 	depends on BLOCK && EXPERIMENTAL
+	depends on BKL # need to fix
 	help
 	help
 	  The Acorn Disc Filing System is the standard file system of the
 	  The Acorn Disc Filing System is the standard file system of the
 	  RiscOS operating system which runs on Acorn's ARM-based Risc PC
 	  RiscOS operating system which runs on Acorn's ARM-based Risc PC

+ 1 - 0
fs/autofs/Kconfig

@@ -1,5 +1,6 @@
 config AUTOFS_FS
 config AUTOFS_FS
 	tristate "Kernel automounter support"
 	tristate "Kernel automounter support"
+	depends on BKL # unfixable, just use autofs4
 	help
 	help
 	  The automounter is a tool to automatically mount remote file systems
 	  The automounter is a tool to automatically mount remote file systems
 	  on demand. This implementation is partially kernel-based to reduce
 	  on demand. This implementation is partially kernel-based to reduce

+ 1 - 0
fs/hpfs/Kconfig

@@ -1,6 +1,7 @@
 config HPFS_FS
 config HPFS_FS
 	tristate "OS/2 HPFS file system support"
 	tristate "OS/2 HPFS file system support"
 	depends on BLOCK
 	depends on BLOCK
+	depends on BKL # nontrivial to fix
 	help
 	help
 	  OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS
 	  OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS
 	  is the file system used for organizing files on OS/2 hard disk
 	  is the file system used for organizing files on OS/2 hard disk

+ 1 - 0
fs/nfs/Kconfig

@@ -1,6 +1,7 @@
 config NFS_FS
 config NFS_FS
 	tristate "NFS client support"
 	tristate "NFS client support"
 	depends on INET && FILE_LOCKING
 	depends on INET && FILE_LOCKING
+	depends on BKL # fix as soon as lockd is done
 	select LOCKD
 	select LOCKD
 	select SUNRPC
 	select SUNRPC
 	select NFS_ACL_SUPPORT if NFS_V3_ACL
 	select NFS_ACL_SUPPORT if NFS_V3_ACL

+ 1 - 0
fs/nfsd/Kconfig

@@ -2,6 +2,7 @@ config NFSD
 	tristate "NFS server support"
 	tristate "NFS server support"
 	depends on INET
 	depends on INET
 	depends on FILE_LOCKING
 	depends on FILE_LOCKING
+	depends on BKL # fix as soon as lockd is done
 	select LOCKD
 	select LOCKD
 	select SUNRPC
 	select SUNRPC
 	select EXPORTFS
 	select EXPORTFS

+ 1 - 0
fs/smbfs/Kconfig

@@ -1,5 +1,6 @@
 config SMB_FS
 config SMB_FS
 	tristate "SMB file system support (OBSOLETE, please use CIFS)"
 	tristate "SMB file system support (OBSOLETE, please use CIFS)"
+	depends on BKL # probably unfixable
 	depends on INET
 	depends on INET
 	select NLS
 	select NLS
 	help
 	help

+ 1 - 0
fs/udf/Kconfig

@@ -1,5 +1,6 @@
 config UDF_FS
 config UDF_FS
 	tristate "UDF file system support"
 	tristate "UDF file system support"
+	depends on BKL # needs serious work to remove
 	select CRC_ITU_T
 	select CRC_ITU_T
 	help
 	help
 	  This is the new file system used on some CD-ROMs and DVDs. Say Y if
 	  This is the new file system used on some CD-ROMs and DVDs. Say Y if

+ 1 - 0
fs/ufs/Kconfig

@@ -1,6 +1,7 @@
 config UFS_FS
 config UFS_FS
 	tristate "UFS file system support (read only)"
 	tristate "UFS file system support (read only)"
 	depends on BLOCK
 	depends on BLOCK
+	depends on BKL # probably fixable
 	help
 	help
 	  BSD and derivate versions of Unix (such as SunOS, FreeBSD, NetBSD,
 	  BSD and derivate versions of Unix (such as SunOS, FreeBSD, NetBSD,
 	  OpenBSD and NeXTstep) use a file system called UFS. Some System V
 	  OpenBSD and NeXTstep) use a file system called UFS. Some System V

+ 5 - 2
include/linux/smp_lock.h

@@ -54,12 +54,15 @@ static inline void cycle_kernel_lock(void)
 
 
 #else
 #else
 
 
+#ifdef CONFIG_BKL /* provoke build bug if not set */
 #define lock_kernel()
 #define lock_kernel()
 #define unlock_kernel()
 #define unlock_kernel()
-#define release_kernel_lock(task)		do { } while(0)
 #define cycle_kernel_lock()			do { } while(0)
 #define cycle_kernel_lock()			do { } while(0)
-#define reacquire_kernel_lock(task)		0
 #define kernel_locked()				1
 #define kernel_locked()				1
+#endif /* CONFIG_BKL */
+
+#define release_kernel_lock(task)		do { } while(0)
+#define reacquire_kernel_lock(task)		0
 
 
 #endif /* CONFIG_LOCK_KERNEL */
 #endif /* CONFIG_LOCK_KERNEL */
 #endif /* __LINUX_SMPLOCK_H */
 #endif /* __LINUX_SMPLOCK_H */

+ 1 - 1
init/Kconfig

@@ -64,7 +64,7 @@ config BROKEN_ON_SMP
 
 
 config LOCK_KERNEL
 config LOCK_KERNEL
 	bool
 	bool
-	depends on SMP || PREEMPT
+	depends on (SMP || PREEMPT) && BKL
 	default y
 	default y
 
 
 config INIT_ENV_ARG_LIMIT
 config INIT_ENV_ARG_LIMIT

+ 9 - 0
lib/Kconfig.debug

@@ -461,6 +461,15 @@ config DEBUG_MUTEXES
 	 This feature allows mutex semantics violations to be detected and
 	 This feature allows mutex semantics violations to be detected and
 	 reported.
 	 reported.
 
 
+config BKL
+	bool "Big Kernel Lock" if (SMP || PREEMPT)
+	default y
+	help
+	  This is the traditional lock that is used in old code instead
+	  of proper locking. All drivers that use the BKL should depend
+	  on this symbol.
+	  Say Y here unless you are working on removing the BKL.
+
 config DEBUG_LOCK_ALLOC
 config DEBUG_LOCK_ALLOC
 	bool "Lock debugging: detect incorrect freeing of live locks"
 	bool "Lock debugging: detect incorrect freeing of live locks"
 	depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
 	depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT

+ 1 - 0
net/ipx/Kconfig

@@ -3,6 +3,7 @@
 #
 #
 config IPX
 config IPX
 	tristate "The IPX protocol"
 	tristate "The IPX protocol"
+	depends on BKL # should be fixable
 	select LLC
 	select LLC
 	---help---
 	---help---
 	  This is support for the Novell networking protocol, IPX, commonly
 	  This is support for the Novell networking protocol, IPX, commonly

+ 1 - 0
net/x25/Kconfig

@@ -5,6 +5,7 @@
 config X25
 config X25
 	tristate "CCITT X.25 Packet Layer (EXPERIMENTAL)"
 	tristate "CCITT X.25 Packet Layer (EXPERIMENTAL)"
 	depends on EXPERIMENTAL
 	depends on EXPERIMENTAL
+	depends on BKL # should be fixable
 	---help---
 	---help---
 	  X.25 is a set of standardized network protocols, similar in scope to
 	  X.25 is a set of standardized network protocols, similar in scope to
 	  frame relay; the one physical line from your box to the X.25 network
 	  frame relay; the one physical line from your box to the X.25 network