tinification: Introduce CONFIG_SRCU to make SRCU optional
Subsystems (28)
RFC PATCH v2 1/1 tinification: Introduce CONFIG_SRCU to make SRCU optional
(CC list trimmed since this is just for initial feedback)
SRCU is not necessary to be compiled by default in all cases. For tinification efforts not compiling SRCU unless necessary is desirable.
The current patch tries to make compiling SRCU optional by introducing a new Kconfig option CONFIG_SRCU which is selected when any of the components making use of SRCU are selected.
The current tinyconfig on x86 enables SRCU by default since x86 enables PERF_EVENTS which in-turn require SRCU support. If we disable PERF_EVENTS, we can disable compiling SRCU for tiny configs on x86 systems.
I tested this using randconfig and building about 15 kernels. This is definitely not complete and could use more testing. Sticking it in next might help in that regards.
Comments and suggestions are welcome. Please let me know if I should split up this patch.
---
v2:
- handle cpufreq, devfreq and notifier
- build tested tinyconfig on powerpc
arch/arm/kvm/Kconfig | 1 + arch/arm64/kvm/Kconfig | 1 + arch/ia64/kvm/Kconfig | 1 + arch/mips/kvm/Kconfig | 1 + arch/powerpc/kvm/Kconfig | 1 + arch/s390/kvm/Kconfig | 1 + arch/tile/kvm/Kconfig | 1 + arch/x86/kvm/Kconfig | 1 + drivers/clk/Kconfig | 1 + drivers/cpufreq/Kconfig | 1 + drivers/devfreq/Kconfig | 1 + drivers/md/Kconfig | 1 + drivers/net/Kconfig | 1 + fs/btrfs/Kconfig | 1 + fs/notify/Kconfig | 1 + init/Kconfig | 10 ++++++++++ kernel/notifier.c | 3 +++ kernel/rcu/Makefile | 3 ++- lib/Kconfig.debug | 1 + mm/Kconfig | 1 + security/tomoyo/Kconfig | 1 + 21 files changed, 33 insertions(+), 1 deletion(-)
arch/arm/kvm/Kconfig +1 -0
@@ -23,6 +23,7 @@ config KVM select HAVE_KVM_CPU_RELAX_INTERCEPT select KVM_MMIO select KVM_ARM_HOST + select SRCU depends on ARM_VIRT_EXT && ARM_LPAE ---help--- Support hosting virtualized guest machines. You will also
arch/arm64/kvm/Kconfig +1 -0
@@ -26,6 +26,7 @@ config KVM select KVM_ARM_HOST select KVM_ARM_VGIC select KVM_ARM_TIMER + select SRCU ---help--- Support hosting virtualized guest machines.
arch/ia64/kvm/Kconfig +1 -0
@@ -29,6 +29,7 @@ config KVM select HAVE_KVM_IRQ_ROUTING select KVM_APIC_ARCHITECTURE select KVM_MMIO + select SRCU ---help--- Support hosting fully virtualized guest machines using hardware virtualization extensions. You will need a fairly recent
arch/mips/kvm/Kconfig +1 -0
@@ -20,6 +20,7 @@ config KVM select PREEMPT_NOTIFIERS select ANON_INODES select KVM_MMIO + select SRCU ---help--- Support for hosting Guest kernels. Currently supported on MIPS32 processors.
arch/powerpc/kvm/Kconfig +1 -0
@@ -21,6 +21,7 @@ config KVM select PREEMPT_NOTIFIERS select ANON_INODES select HAVE_KVM_EVENTFD + select SRCU config KVM_BOOK3S_HANDLER bool
arch/s390/kvm/Kconfig +1 -0
@@ -28,6 +28,7 @@ config KVM select HAVE_KVM_IRQCHIP select HAVE_KVM_IRQFD select HAVE_KVM_IRQ_ROUTING + select SRCU ---help--- Support hosting paravirtualized guest machines using the SIE virtualization capability on the mainframe. This should work
arch/tile/kvm/Kconfig +1 -0
@@ -21,6 +21,7 @@ config KVM depends on HAVE_KVM && MODULES select PREEMPT_NOTIFIERS select ANON_INODES + select SRCU ---help--- Support hosting paravirtualized guest machines.
arch/x86/kvm/Kconfig +1 -0
@@ -40,6 +40,7 @@ config KVM select HAVE_KVM_MSI select HAVE_KVM_CPU_RELAX_INTERCEPT select KVM_VFIO + select SRCU ---help--- Support hosting fully virtualized guest machines using hardware virtualization extensions. You will need a fairly recent
drivers/clk/Kconfig +1 -0
@@ -13,6 +13,7 @@ config COMMON_CLK bool select HAVE_CLK_PREPARE select CLKDEV_LOOKUP + select SRCU ---help--- The common clock framework is a single definition of struct clk, useful across many platforms, as well as an
drivers/cpufreq/Kconfig +1 -0
@@ -2,6 +2,7 @@ menu "CPU Frequency scaling" config CPU_FREQ bool "CPU Frequency scaling" + select SRCU help CPU Frequency scaling allows you to change the clock speed of CPUs on the fly. This is a nice method to save power, because
drivers/devfreq/Kconfig +1 -0
@@ -1,5 +1,6 @@ menuconfig PM_DEVFREQ bool "Generic Dynamic Voltage and Frequency Scaling (DVFS) support" + select SRCU help A device may have a list of frequencies and voltages available. devfreq, a generic DVFS framework can be registered for a device
drivers/md/Kconfig +1 -0
@@ -5,6 +5,7 @@ menuconfig MD bool "Multiple devices driver support (RAID and LVM)" depends on BLOCK + select SRCU help Support multiple physical spindles through a single logical device. Required for RAID and logical volume management.
drivers/net/Kconfig +1 -0
@@ -176,6 +176,7 @@ config NETCONSOLE_DYNAMIC config NETPOLL def_bool NETCONSOLE + select SRCU config NET_POLL_CONTROLLER def_bool NETPOLL
fs/btrfs/Kconfig +1 -0
@@ -8,6 +8,7 @@ config BTRFS_FS select LZO_DECOMPRESS select RAID6_PQ select XOR_BLOCKS + select SRCU help Btrfs is a general purpose copy-on-write filesystem with extents,
fs/notify/Kconfig +1 -0
@@ -1,5 +1,6 @@ config FSNOTIFY def_bool n + select SRCU source "fs/notify/dnotify/Kconfig" source "fs/notify/inotify/Kconfig"
init/Kconfig +10 -0
@@ -501,6 +501,14 @@ config TINY_RCU endchoice +config SRCU + bool "Sleepable form of RCU" + def_bool n + help + This option selects the sleepable version of RCU. This version + permits arbitrary sleeping or blocking within RCU read-side critical + sections. + config PREEMPT_RCU def_bool TREE_PREEMPT_RCU help
@@ -510,6 +518,7 @@ config PREEMPT_RCU config TASKS_RCU bool "Task_based RCU implementation using voluntary context switch" default n + select SRCU help This option enables a task-based RCU implementation that uses only voluntary context switch (not preemption!), idle, and
@@ -1586,6 +1595,7 @@ config PERF_EVENTS depends on HAVE_PERF_EVENTS select ANON_INODES select IRQ_WORK + select SRCU help Enable kernel support for various performance events provided by software and hardware.
kernel/notifier.c +3 -0
@@ -402,6 +402,7 @@ int raw_notifier_call_chain(struct raw_notifier_head *nh, }EXPORT_SYMBOL_GPL (raw_notifier_call_chain); +#if CONFIG_SRCU /* * SRCU notifier chain routines. Registration and unregistration * use a mutex, and call_chain is synchronized by SRCU (no locks).
@@ -528,6 +529,8 @@ void srcu_init_notifier_head(struct srcu_notifier_head *nh) }EXPORT_SYMBOL_GPL (srcu_init_notifier_head); +#endif /* CONFIG_SRCU */ +static ATOMIC_NOTIFIER_HEAD (die_chain); int notrace notify_die(enum die_val val, const char *str,
kernel/rcu/Makefile +2 -1
@@ -1,4 +1,5 @@ -obj-y += update.o srcu.o +obj-y += update.o +obj-$(CONFIG_SRCU) += srcu.o obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o obj-$(CONFIG_TREE_RCU) += tree.o obj-$(CONFIG_TREE_PREEMPT_RCU) += tree.o
lib/Kconfig.debug +1 -0
@@ -1199,6 +1199,7 @@ config RCU_TORTURE_TEST tristate "torture tests for RCU" depends on DEBUG_KERNEL select TORTURE_TEST + select SRCU default n help This option provides a kernel module that runs torture tests
mm/Kconfig +1 -0
@@ -325,6 +325,7 @@ config VIRT_TO_BUS config MMU_NOTIFIER bool + select SRCU config KSM bool "Enable KSM for page merging"
security/tomoyo/Kconfig +1 -0
@@ -5,6 +5,7 @@ config SECURITY_TOMOYO select SECURITYFS select SECURITY_PATH select SECURITY_NETWORK + select SRCU default n help This selects TOMOYO Linux, pathname-based access control.
Signature · 1 line
1.9.1
Quoted 13 lines · Pranith Kumar
(CC list trimmed since this is just for initial feedback)
SRCU is not necessary to be compiled by default in all cases. For tinification efforts not compiling SRCU unless necessary is desirable.
The current patch tries to make compiling SRCU optional by introducing a new
KconfigoptionCONFIG_SRCUwhich is selected when any of the components making use of SRCU are selected.The current tinyconfig on x86 enables SRCU by default since x86 enables
PERF_EVENTSwhich in-turn require SRCU support. If we disablePERF_EVENTS, we can disable compiling SRCU for tiny configs on x86 systems.
Quoted 6 lines
I tested this using randconfig and building about 15 kernels. This is definitely not complete and could use more testing. Sticking it in next might help in that regards.
Comments and suggestions are welcome. Please let me know if I should split up this patch.
For the moment, I applied this to -rcu against v3.18-rc6 to get some 0day testing on it.
There are conflicts against the tip of my tree, but will worry about that later. I don't have a ready answer on whether or not this needs to be split up -- in the worst case, we would add the SRCU Kconfig parameter, add all the selects, then once they all hit mainline add the Makefile change.
We will need stats on how much memory was saved, and a "size kernel/rcu/srcu.o" after a UP/tiny build should do it. Could you please add this to the commit log?
Josh, and additional thoughts?
Thanx, Paul
Quoted 315 lines
Signed-off-by Pranith Kumar <[email protected]>CC Paul McKenney <[email protected]>CC Josh Triplett <[email protected]>---
v2:
- handle cpufreq, devfreq and notifier
- build tested tinyconfig on powerpcarch/arm/kvm/Kconfig | 1 + arch/arm64/kvm/Kconfig | 1 + arch/ia64/kvm/Kconfig | 1 + arch/mips/kvm/Kconfig | 1 + arch/powerpc/kvm/Kconfig | 1 + arch/s390/kvm/Kconfig | 1 + arch/tile/kvm/Kconfig | 1 + arch/x86/kvm/Kconfig | 1 + drivers/clk/Kconfig | 1 + drivers/cpufreq/Kconfig | 1 + drivers/devfreq/Kconfig | 1 + drivers/md/Kconfig | 1 + drivers/net/Kconfig | 1 + fs/btrfs/Kconfig | 1 + fs/notify/Kconfig | 1 + init/Kconfig | 10 ++++++++++ kernel/notifier.c | 3 +++ kernel/rcu/Makefile | 3 ++- lib/Kconfig.debug | 1 + mm/Kconfig | 1 + security/tomoyo/Kconfig | 1 + 21 files changed, 33 insertions(+), 1 deletion(-)arch/arm/kvm/Kconfig +1
-0@@ -23,6 +23,7 @@ config KVM select HAVE_KVM_CPU_RELAX_INTERCEPT select KVM_MMIO select KVM_ARM_HOST + select SRCU depends on ARM_VIRT_EXT && ARM_LPAE ---help--- Support hosting virtualized guest machines. You will alsoarch/arm64/kvm/Kconfig +1
-0@@ -26,6 +26,7 @@ config KVM select KVM_ARM_HOST select KVM_ARM_VGIC select KVM_ARM_TIMER + select SRCU ---help--- Support hosting virtualized guest machines.arch/ia64/kvm/Kconfig +1
-0@@ -29,6 +29,7 @@ config KVM select HAVE_KVM_IRQ_ROUTING select KVM_APIC_ARCHITECTURE select KVM_MMIO + select SRCU ---help--- Support hosting fully virtualized guest machines using hardware virtualization extensions. You will need a fairly recentarch/mips/kvm/Kconfig +1
-0@@ -20,6 +20,7 @@ config KVM select PREEMPT_NOTIFIERS select ANON_INODES select KVM_MMIO + select SRCU ---help--- Support for hosting Guest kernels. Currently supported on MIPS32 processors.arch/powerpc/kvm/Kconfig +1
-0@@ -21,6 +21,7 @@ config KVM select PREEMPT_NOTIFIERS select ANON_INODES select HAVE_KVM_EVENTFD + select SRCU config KVM_BOOK3S_HANDLER boolarch/s390/kvm/Kconfig +1
-0@@ -28,6 +28,7 @@ config KVM select HAVE_KVM_IRQCHIP select HAVE_KVM_IRQFD select HAVE_KVM_IRQ_ROUTING + select SRCU ---help--- Support hosting paravirtualized guest machines using the SIE virtualization capability on the mainframe. This should workarch/tile/kvm/Kconfig +1
-0@@ -21,6 +21,7 @@ config KVM depends on HAVE_KVM && MODULES select PREEMPT_NOTIFIERS select ANON_INODES + select SRCU ---help--- Support hosting paravirtualized guest machines.arch/x86/kvm/Kconfig +1
-0@@ -40,6 +40,7 @@ config KVM select HAVE_KVM_MSI select HAVE_KVM_CPU_RELAX_INTERCEPT select KVM_VFIO + select SRCU ---help--- Support hosting fully virtualized guest machines using hardware virtualization extensions. You will need a fairly recentdrivers/clk/Kconfig +1
-0@@ -13,6 +13,7 @@ config COMMON_CLK bool select HAVE_CLK_PREPARE select CLKDEV_LOOKUP + select SRCU ---help--- The common clock framework is a single definition of struct clk, useful across many platforms, as well as andrivers/cpufreq/Kconfig +1
-0@@ -2,6 +2,7 @@ menu "CPU Frequency scaling" config CPU_FREQ bool "CPU Frequency scaling" + select SRCU help CPU Frequency scaling allows you to change the clock speed of CPUs on the fly. This is a nice method to save power, becausedrivers/devfreq/Kconfig +1
-0@@ -1,5 +1,6 @@ menuconfig PM_DEVFREQ bool "Generic Dynamic Voltage and Frequency Scaling (DVFS) support" + select SRCU help A device may have a list of frequencies and voltages available. devfreq, a generic DVFS framework can be registered for a devicedrivers/md/Kconfig +1
-0@@ -5,6 +5,7 @@ menuconfig MD bool "Multiple devices driver support (RAID and LVM)" depends on BLOCK + select SRCU help Support multiple physical spindles through a single logical device. Required for RAID and logical volume management.drivers/net/Kconfig +1
-0@@ -176,6 +176,7 @@ config NETCONSOLE_DYNAMIC config NETPOLL def_bool NETCONSOLE + select SRCU config NET_POLL_CONTROLLER def_bool NETPOLLfs/btrfs/Kconfig +1
-0@@ -8,6 +8,7 @@ config BTRFS_FS select LZO_DECOMPRESS select RAID6_PQ select XOR_BLOCKS + select SRCU help Btrfs is a general purpose copy-on-write filesystem with extents,fs/notify/Kconfig +1
-0@@ -1,5 +1,6 @@ config FSNOTIFY def_bool n + select SRCU source "fs/notify/dnotify/Kconfig" source "fs/notify/inotify/Kconfig"init/Kconfig +10
-0@@ -501,6 +501,14 @@ config TINY_RCU endchoice +config SRCU + bool "Sleepable form of RCU" + def_bool n + help + This option selects the sleepable version of RCU. This version + permits arbitrary sleeping or blocking within RCU read-side critical + sections. + config PREEMPT_RCU def_bool TREE_PREEMPT_RCU help@@ -510,6 +518,7 @@ config PREEMPT_RCU config TASKS_RCU bool "Task_based RCU implementation using voluntary context switch" default n + select SRCU help This option enables a task-based RCU implementation that uses only voluntary context switch (not preemption!), idle, and@@ -1586,6 +1595,7 @@ config PERF_EVENTS depends on HAVE_PERF_EVENTS select ANON_INODES select IRQ_WORK + select SRCU help Enable kernel support for various performance events provided by software and hardware.kernel/notifier.c +3
-0@@ -402,6 +402,7 @@ int raw_notifier_call_chain(struct raw_notifier_head *nh, }EXPORT_SYMBOL_GPL (raw_notifier_call_chain); +#if CONFIG_SRCU /* * SRCU notifier chain routines. Registration and unregistration * use a mutex, and call_chain is synchronized by SRCU (no locks). @@ -528,6 +529,8 @@ void srcu_init_notifier_head(struct srcu_notifier_head *nh) }EXPORT_SYMBOL_GPL (srcu_init_notifier_head); +#endif /* CONFIG_SRCU */ +static ATOMIC_NOTIFIER_HEAD (die_chain); int notrace notify_die(enum die_val val, const char *str,kernel/rcu/Makefile +2
-1@@ -1,4 +1,5 @@ -obj-y += update.o srcu.o +obj-y += update.o +obj-$(CONFIG_SRCU) += srcu.o obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o obj-$(CONFIG_TREE_RCU) += tree.o obj-$(CONFIG_TREE_PREEMPT_RCU) += tree.olib/Kconfig.debug +1
-0@@ -1199,6 +1199,7 @@ config RCU_TORTURE_TEST tristate "torture tests for RCU" depends on DEBUG_KERNEL select TORTURE_TEST + select SRCU default n help This option provides a kernel module that runs torture testsmm/Kconfig +1
-0@@ -325,6 +325,7 @@ config VIRT_TO_BUS config MMU_NOTIFIER bool + select SRCU config KSM bool "Enable KSM for page merging"security/tomoyo/Kconfig +1
-0@@ -5,6 +5,7 @@ config SECURITY_TOMOYO select SECURITYFS select SECURITY_PATH select SECURITY_NETWORK + select SRCU default n help This selects TOMOYO Linux, pathname-based access control.Signature · 1 line
1.9.1
Quoted 9 lines · Paul E. McKenney
For the moment, I applied this to -rcu against v3.18-rc6 to get some 0day testing on it.
There are conflicts against the tip of my tree, but will worry about that later. I don't have a ready answer on whether or not this needs to be split up -- in the worst case, we would add the SRCU
Kconfigparameter, add all the selects, then once they all hit mainline add theMakefilechange.
Quoted 4 lines
We will need stats on how much memory was saved, and a "size
kernel/rcu/srcu.o" after a UP/tiny build should do it. Could you please add this to the commit log?
So if we do not select CONFIG_SRCU, srcu.o will not be compiled at all. So we should save about
text data bss dec hex filename
2007 0 0 2007 7d7 kernel/rcu/srcu.o
as in size of arch/powerpc/boot/zImage changes from
text data bss dec hex filename
831552 64180 23944 919676 e087c arch/powerpc/boot/zImage : before 829504 64180 23952 917636 e0084 arch/powerpc/boot/zImage : after
so about ~2000 bytes I guess.
--
Pranith
Quoted 20 lines · Pranith Kumar
Quoted 9 lines · Paul E. McKenney
For the moment, I applied this to -rcu against v3.18-rc6 to get some 0day testing on it.
There are conflicts against the tip of my tree, but will worry about that later. I don't have a ready answer on whether or not this needs to be split up -- in the worst case, we would add the SRCU
Kconfigparameter, add all the selects, then once they all hit mainline add theMakefilechange.Quoted 4 lines
We will need stats on how much memory was saved, and a "size
kernel/rcu/srcu.o" after a UP/tiny build should do it. Could you please add this to the commit log?So if we do not select
CONFIG_SRCU, srcu.o will not be compiled at all. So we should save abouttext data bss dec hex filename
2007 0 0 2007 7d7kernel/rcu/srcu.o
Quoted 7 lines
as in size of
arch/powerpc/boot/zImagechanges fromtext data bss dec hex filename
831552 64180 23944 919676 e087c arch/powerpc/boot/zImage : before 829504 64180 23952 917636 e0084 arch/powerpc/boot/zImage : afterso about ~2000 bytes I guess.
Nice!
Josh, I recall you having a tinified .config somewhere, but don't see it right off. If you do have one, could you please share it with Pranith? Not a big deal, just don't want to overstate the savings too much. ;-)
Thanx, Paul
Josh Triplett
maintainerQuoted 5 lines · Pranith Kumar
(CC list trimmed since this is just for initial feedback)
SRCU is not necessary to be compiled by default in all cases. For tinification efforts not compiling SRCU unless necessary is desirable.
Quoted 7 lines
The current patch tries to make compiling SRCU optional by introducing a new
KconfigoptionCONFIG_SRCUwhich is selected when any of the components making use of SRCU are selected.The current tinyconfig on x86 enables SRCU by default since x86 enables
PERF_EVENTSwhich in-turn require SRCU support. If we disablePERF_EVENTS, we can disable compiling SRCU for tiny configs on x86 systems.
To the best of my knowledge, "select" still doesn't recursively enable things that the selected symbol selects, so I think you need to "select SRCU" from X86, right next to the "select PERF_EVENTS".
Also, can you try your patch on top of the current patch series to compile without perf (tiny/disable-perf), and see if you can successfully compile without SRCU on x86?
Quoted 6 lines
I tested this using randconfig and building about 15 kernels. This is definitely not complete and could use more testing. Sticking it in next might help in that regards.
Comments and suggestions are welcome. Please let me know if I should split up this patch.
I don't think this needs splitting; it's a very small and obvious patch combined with a few selects.
The code looks good to me. Assuming it compiles on x86, with tinyconfig and with allyesconfig minus SRCU (and whatever requires it), this seems reasonable.
Thanks for working on this!
- Josh Triplett
Quoted 311 lines
v2:
- handle cpufreq, devfreq and notifier
- build tested tinyconfig on powerpcarch/arm/kvm/Kconfig | 1 + arch/arm64/kvm/Kconfig | 1 + arch/ia64/kvm/Kconfig | 1 + arch/mips/kvm/Kconfig | 1 + arch/powerpc/kvm/Kconfig | 1 + arch/s390/kvm/Kconfig | 1 + arch/tile/kvm/Kconfig | 1 + arch/x86/kvm/Kconfig | 1 + drivers/clk/Kconfig | 1 + drivers/cpufreq/Kconfig | 1 + drivers/devfreq/Kconfig | 1 + drivers/md/Kconfig | 1 + drivers/net/Kconfig | 1 + fs/btrfs/Kconfig | 1 + fs/notify/Kconfig | 1 + init/Kconfig | 10 ++++++++++ kernel/notifier.c | 3 +++ kernel/rcu/Makefile | 3 ++- lib/Kconfig.debug | 1 + mm/Kconfig | 1 + security/tomoyo/Kconfig | 1 + 21 files changed, 33 insertions(+), 1 deletion(-)arch/arm/kvm/Kconfig +1
-0@@ -23,6 +23,7 @@ config KVM select HAVE_KVM_CPU_RELAX_INTERCEPT select KVM_MMIO select KVM_ARM_HOST + select SRCU depends on ARM_VIRT_EXT && ARM_LPAE ---help--- Support hosting virtualized guest machines. You will alsoarch/arm64/kvm/Kconfig +1
-0@@ -26,6 +26,7 @@ config KVM select KVM_ARM_HOST select KVM_ARM_VGIC select KVM_ARM_TIMER + select SRCU ---help--- Support hosting virtualized guest machines.arch/ia64/kvm/Kconfig +1
-0@@ -29,6 +29,7 @@ config KVM select HAVE_KVM_IRQ_ROUTING select KVM_APIC_ARCHITECTURE select KVM_MMIO + select SRCU ---help--- Support hosting fully virtualized guest machines using hardware virtualization extensions. You will need a fairly recentarch/mips/kvm/Kconfig +1
-0@@ -20,6 +20,7 @@ config KVM select PREEMPT_NOTIFIERS select ANON_INODES select KVM_MMIO + select SRCU ---help--- Support for hosting Guest kernels. Currently supported on MIPS32 processors.arch/powerpc/kvm/Kconfig +1
-0@@ -21,6 +21,7 @@ config KVM select PREEMPT_NOTIFIERS select ANON_INODES select HAVE_KVM_EVENTFD + select SRCU config KVM_BOOK3S_HANDLER boolarch/s390/kvm/Kconfig +1
-0@@ -28,6 +28,7 @@ config KVM select HAVE_KVM_IRQCHIP select HAVE_KVM_IRQFD select HAVE_KVM_IRQ_ROUTING + select SRCU ---help--- Support hosting paravirtualized guest machines using the SIE virtualization capability on the mainframe. This should workarch/tile/kvm/Kconfig +1
-0@@ -21,6 +21,7 @@ config KVM depends on HAVE_KVM && MODULES select PREEMPT_NOTIFIERS select ANON_INODES + select SRCU ---help--- Support hosting paravirtualized guest machines.arch/x86/kvm/Kconfig +1
-0@@ -40,6 +40,7 @@ config KVM select HAVE_KVM_MSI select HAVE_KVM_CPU_RELAX_INTERCEPT select KVM_VFIO + select SRCU ---help--- Support hosting fully virtualized guest machines using hardware virtualization extensions. You will need a fairly recentdrivers/clk/Kconfig +1
-0@@ -13,6 +13,7 @@ config COMMON_CLK bool select HAVE_CLK_PREPARE select CLKDEV_LOOKUP + select SRCU ---help--- The common clock framework is a single definition of struct clk, useful across many platforms, as well as andrivers/cpufreq/Kconfig +1
-0@@ -2,6 +2,7 @@ menu "CPU Frequency scaling" config CPU_FREQ bool "CPU Frequency scaling" + select SRCU help CPU Frequency scaling allows you to change the clock speed of CPUs on the fly. This is a nice method to save power, becausedrivers/devfreq/Kconfig +1
-0@@ -1,5 +1,6 @@ menuconfig PM_DEVFREQ bool "Generic Dynamic Voltage and Frequency Scaling (DVFS) support" + select SRCU help A device may have a list of frequencies and voltages available. devfreq, a generic DVFS framework can be registered for a devicedrivers/md/Kconfig +1
-0@@ -5,6 +5,7 @@ menuconfig MD bool "Multiple devices driver support (RAID and LVM)" depends on BLOCK + select SRCU help Support multiple physical spindles through a single logical device. Required for RAID and logical volume management.drivers/net/Kconfig +1
-0@@ -176,6 +176,7 @@ config NETCONSOLE_DYNAMIC config NETPOLL def_bool NETCONSOLE + select SRCU config NET_POLL_CONTROLLER def_bool NETPOLLfs/btrfs/Kconfig +1
-0@@ -8,6 +8,7 @@ config BTRFS_FS select LZO_DECOMPRESS select RAID6_PQ select XOR_BLOCKS + select SRCU help Btrfs is a general purpose copy-on-write filesystem with extents,fs/notify/Kconfig +1
-0@@ -1,5 +1,6 @@ config FSNOTIFY def_bool n + select SRCU source "fs/notify/dnotify/Kconfig" source "fs/notify/inotify/Kconfig"init/Kconfig +10
-0@@ -501,6 +501,14 @@ config TINY_RCU endchoice +config SRCU + bool "Sleepable form of RCU" + def_bool n + help + This option selects the sleepable version of RCU. This version + permits arbitrary sleeping or blocking within RCU read-side critical + sections. + config PREEMPT_RCU def_bool TREE_PREEMPT_RCU help@@ -510,6 +518,7 @@ config PREEMPT_RCU config TASKS_RCU bool "Task_based RCU implementation using voluntary context switch" default n + select SRCU help This option enables a task-based RCU implementation that uses only voluntary context switch (not preemption!), idle, and@@ -1586,6 +1595,7 @@ config PERF_EVENTS depends on HAVE_PERF_EVENTS select ANON_INODES select IRQ_WORK + select SRCU help Enable kernel support for various performance events provided by software and hardware.kernel/notifier.c +3
-0@@ -402,6 +402,7 @@ int raw_notifier_call_chain(struct raw_notifier_head *nh, }EXPORT_SYMBOL_GPL (raw_notifier_call_chain); +#if CONFIG_SRCU /* * SRCU notifier chain routines. Registration and unregistration * use a mutex, and call_chain is synchronized by SRCU (no locks). @@ -528,6 +529,8 @@ void srcu_init_notifier_head(struct srcu_notifier_head *nh) }EXPORT_SYMBOL_GPL (srcu_init_notifier_head); +#endif /* CONFIG_SRCU */ +static ATOMIC_NOTIFIER_HEAD (die_chain); int notrace notify_die(enum die_val val, const char *str,kernel/rcu/Makefile +2
-1@@ -1,4 +1,5 @@ -obj-y += update.o srcu.o +obj-y += update.o +obj-$(CONFIG_SRCU) += srcu.o obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o obj-$(CONFIG_TREE_RCU) += tree.o obj-$(CONFIG_TREE_PREEMPT_RCU) += tree.olib/Kconfig.debug +1
-0@@ -1199,6 +1199,7 @@ config RCU_TORTURE_TEST tristate "torture tests for RCU" depends on DEBUG_KERNEL select TORTURE_TEST + select SRCU default n help This option provides a kernel module that runs torture testsmm/Kconfig +1
-0@@ -325,6 +325,7 @@ config VIRT_TO_BUS config MMU_NOTIFIER bool + select SRCU config KSM bool "Enable KSM for page merging"security/tomoyo/Kconfig +1
-0@@ -5,6 +5,7 @@ config SECURITY_TOMOYO select SECURITYFS select SECURITY_PATH select SECURITY_NETWORK + select SRCU default n help This selects TOMOYO Linux, pathname-based access control.Signature · 1 line
1.9.1
(resending, forgot CC's)
Quoted 8 lines · Josh Triplett
Quoted 4 lines
The current tinyconfig on x86 enables SRCU by default since x86 enables
PERF_EVENTSwhich in-turn require SRCU support. If we disablePERF_EVENTS, we can disable compiling SRCU for tiny configs on x86 systems.To the best of my knowledge, "select" still doesn't recursively enable things that the selected symbol selects, so I think you need to "select SRCU" from X86, right next to the "select
PERF_EVENTS".
Doesn't this prevent not selecting SRCU on x86 systems?
I think a warning will be generated during make if a dependent config is not enabled.
Quoted 4 lines
Also, can you try your patch on top of the current patch series to compile without perf (tiny/disable-perf), and see if you can successfully compile without SRCU on x86?
This branch had a small config error which was compiling perf related code unconditionally.
warning: (HW_BREAKPOINTS) selects HAVE_HW_BREAKPOINT which has unmet direct dependencies (PERF_EVENTS)
With the following patch applied on top of it I was able to compile my patch.
arch/x86/Kconfig +1 -0
@@ -588,6 +588,7 @@ config HW_BREAKPOINTS default y select HAVE_HW_BREAKPOINT select HAVE_MIXED_BREAKPOINTS_REGS + depends on PERF_EVENTS ---help--- Enable support for x86 hardware breakpoints for debuggers and perf. This will implicitly enable perf-events.
Quoted 5 lines
Quoted 5 lines
I tested this using randconfig and building about 15 kernels. This is definitely not complete and could use more testing. Sticking it in next might help in that regards.
Quoted 8 lines
Quoted 2 lines
Comments and suggestions are welcome. Please let me know if I should split up this patch.
I don't think this needs splitting; it's a very small and obvious patch combined with a few selects.
The code looks good to me. Assuming it compiles on x86, with tinyconfig and with allyesconfig minus SRCU (and whatever requires it), this seems
For allyesconfig minus SRCU(using tiny/disable-perf) I needed the following patch to get it to build
arch/x86/Kconfig +1 -0
@@ -588,6 +588,7 @@ config HW_BREAKPOINTS default y select HAVE_HW_BREAKPOINT select HAVE_MIXED_BREAKPOINTS_REGS + depends on PERF_EVENTS ---help--- Enable support for x86 hardware breakpoints for debuggers and perf. This will implicitly enable perf-events.
fs/Kconfig.binfmt +1 -0
@@ -182,6 +182,7 @@ config BINFMT_MISC config COREDUMP bool "Enable core dump support" if EXPERT default y + depends on PERF_EVENTS help This option enables support for performing core dumps. You almost certainly want to say Y here. Not necessary on systems that never
kernel/trace/Kconfig +1 -0
@@ -125,6 +125,7 @@ config TRACING_SUPPORT # irqflags tracing for your architecture. depends on TRACE_IRQFLAGS_SUPPORT || PPC32 depends on STACKTRACE_SUPPORT + depends on PERF_EVENTS default y if TRACING_SUPPORT
--
If the above two patches are good, then may be you should add them to the tiny/disable-perf branch?
I will submit SRCU patch on top of rcu/dev so that Paul can pick it up in his tree.
Thanks!
--
Pranith