LKML Archive on lore.kernel.org help / color / mirror / Atom feed
* SRCU: add a static initializer and let cpufreq use it @ 2018-05-25 10:19 Sebastian Andrzej Siewior 2018-05-25 10:19 ` [PATCH 1/2] kernel/SRCU: provide a static initializer Sebastian Andrzej Siewior 2018-05-25 10:19 ` [PATCH 2/2] cpufreq: Use static SRCU initializer Sebastian Andrzej Siewior 0 siblings, 2 replies; 10+ messages in thread From: Sebastian Andrzej Siewior @ 2018-05-25 10:19 UTC (permalink / raw) To: linux-pm Cc: linux-kernel, Rafael J. Wysocki, Viresh Kumar, Paul E. McKenney, Thomas Gleixner, bigeasy cpufreq would benefit from a static initializer which avoids an initcall and bug fixing in case the warning (notifier used before initialized) has been triggered. Sebastian ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/2] kernel/SRCU: provide a static initializer 2018-05-25 10:19 SRCU: add a static initializer and let cpufreq use it Sebastian Andrzej Siewior @ 2018-05-25 10:19 ` Sebastian Andrzej Siewior 2018-05-29 8:09 ` Rafael J. Wysocki 2018-05-25 10:19 ` [PATCH 2/2] cpufreq: Use static SRCU initializer Sebastian Andrzej Siewior 1 sibling, 1 reply; 10+ messages in thread From: Sebastian Andrzej Siewior @ 2018-05-25 10:19 UTC (permalink / raw) To: linux-pm Cc: linux-kernel, Rafael J. Wysocki, Viresh Kumar, Paul E. McKenney, Thomas Gleixner, bigeasy There are macros for static initializer for the three out of four possible notifier types, that are: ATOMIC_NOTIFIER_HEAD() BLOCKING_NOTIFIER_HEAD() RAW_NOTIFIER_HEAD() This patch provides a static initilizer for the forth type to make it complete. Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- include/linux/notifier.h | 34 +++++++++++++++++++++++++++++----- include/linux/srcutiny.h | 6 +++--- include/linux/srcutree.h | 6 +++--- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/include/linux/notifier.h b/include/linux/notifier.h index 6d731110e0db..f35c7bf76143 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h @@ -43,9 +43,7 @@ * in srcu_notifier_call_chain(): no cache bounces and no memory barriers. * As compensation, srcu_notifier_chain_unregister() is rather expensive. * SRCU notifier chains should be used when the chain will be called very - * often but notifier_blocks will seldom be removed. Also, SRCU notifier - * chains are slightly more difficult to use because they require special - * runtime initialization. + * often but notifier_blocks will seldom be removed. */ struct notifier_block; @@ -91,7 +89,7 @@ struct srcu_notifier_head { (name)->head = NULL; \ } while (0) -/* srcu_notifier_heads must be initialized and cleaned up dynamically */ +/* srcu_notifier_heads must be cleaned up dynamically */ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh); #define srcu_cleanup_notifier_head(name) \ cleanup_srcu_struct(&(name)->srcu); @@ -104,7 +102,13 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh); .head = NULL } #define RAW_NOTIFIER_INIT(name) { \ .head = NULL } -/* srcu_notifier_heads cannot be initialized statically */ + +#define SRCU_NOTIFIER_INIT(name, pcpu) \ + { \ + .mutex = __MUTEX_INITIALIZER(name.mutex), \ + .head = NULL, \ + .srcu = __SRCU_STRUCT_INIT(name.srcu, pcpu), \ + } #define ATOMIC_NOTIFIER_HEAD(name) \ struct atomic_notifier_head name = \ @@ -116,6 +120,26 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh); struct raw_notifier_head name = \ RAW_NOTIFIER_INIT(name) +#ifdef CONFIG_TREE_SRCU +#define _SRCU_NOTIFIER_HEAD(name, mod) \ + static DEFINE_PER_CPU(struct srcu_data, \ + name##_head_srcu_data); \ + mod struct srcu_notifier_head name = \ + SRCU_NOTIFIER_INIT(name, name##_head_srcu_data) + +#else +#define _SRCU_NOTIFIER_HEAD(name, mod) \ + mod struct srcu_notifier_head name = \ + SRCU_NOTIFIER_INIT(name, name) + +#endif + +#define SRCU_NOTIFIER_HEAD(name) \ + _SRCU_NOTIFIER_HEAD(name, /* not static */) + +#define SRCU_NOTIFIER_HEAD_STATIC(name) \ + _SRCU_NOTIFIER_HEAD(name, static) + #ifdef __KERNEL__ extern int atomic_notifier_chain_register(struct atomic_notifier_head *nh, diff --git a/include/linux/srcutiny.h b/include/linux/srcutiny.h index 261471f407a5..f41d2fb09f87 100644 --- a/include/linux/srcutiny.h +++ b/include/linux/srcutiny.h @@ -43,7 +43,7 @@ struct srcu_struct { void srcu_drive_gp(struct work_struct *wp); -#define __SRCU_STRUCT_INIT(name) \ +#define __SRCU_STRUCT_INIT(name, __ignored) \ { \ .srcu_wq = __SWAIT_QUEUE_HEAD_INITIALIZER(name.srcu_wq), \ .srcu_cb_tail = &name.srcu_cb_head, \ @@ -56,9 +56,9 @@ void srcu_drive_gp(struct work_struct *wp); * Tree SRCU, which needs some per-CPU data. */ #define DEFINE_SRCU(name) \ - struct srcu_struct name = __SRCU_STRUCT_INIT(name) + struct srcu_struct name = __SRCU_STRUCT_INIT(name, name) #define DEFINE_STATIC_SRCU(name) \ - static struct srcu_struct name = __SRCU_STRUCT_INIT(name) + static struct srcu_struct name = __SRCU_STRUCT_INIT(name, name) void synchronize_srcu(struct srcu_struct *sp); diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h index 4eda108abee0..745d4ca4dd50 100644 --- a/include/linux/srcutree.h +++ b/include/linux/srcutree.h @@ -104,9 +104,9 @@ struct srcu_struct { #define SRCU_STATE_SCAN1 1 #define SRCU_STATE_SCAN2 2 -#define __SRCU_STRUCT_INIT(name) \ +#define __SRCU_STRUCT_INIT(name, pcpu_name) \ { \ - .sda = &name##_srcu_data, \ + .sda = &pcpu_name, \ .lock = __SPIN_LOCK_UNLOCKED(name.lock), \ .srcu_gp_seq_needed = 0 - 1, \ __SRCU_DEP_MAP_INIT(name) \ @@ -133,7 +133,7 @@ struct srcu_struct { */ #define __DEFINE_SRCU(name, is_static) \ static DEFINE_PER_CPU(struct srcu_data, name##_srcu_data);\ - is_static struct srcu_struct name = __SRCU_STRUCT_INIT(name) + is_static struct srcu_struct name = __SRCU_STRUCT_INIT(name, name##_srcu_data) #define DEFINE_SRCU(name) __DEFINE_SRCU(name, /* not static */) #define DEFINE_STATIC_SRCU(name) __DEFINE_SRCU(name, static) -- 2.17.0 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] kernel/SRCU: provide a static initializer 2018-05-25 10:19 ` [PATCH 1/2] kernel/SRCU: provide a static initializer Sebastian Andrzej Siewior @ 2018-05-29 8:09 ` Rafael J. Wysocki 2018-05-29 12:04 ` Paul E. McKenney 0 siblings, 1 reply; 10+ messages in thread From: Rafael J. Wysocki @ 2018-05-29 8:09 UTC (permalink / raw) To: Sebastian Andrzej Siewior Cc: Linux PM, Linux Kernel Mailing List, Rafael J. Wysocki, Viresh Kumar, Paul E. McKenney, Thomas Gleixner On Fri, May 25, 2018 at 12:19 PM, Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote: > There are macros for static initializer for the three out of four > possible notifier types, that are: > ATOMIC_NOTIFIER_HEAD() > BLOCKING_NOTIFIER_HEAD() > RAW_NOTIFIER_HEAD() > > This patch provides a static initilizer for the forth type to make it > complete. > > Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> I cannot apply this without an ACK from Paul. > --- > include/linux/notifier.h | 34 +++++++++++++++++++++++++++++----- > include/linux/srcutiny.h | 6 +++--- > include/linux/srcutree.h | 6 +++--- > 3 files changed, 35 insertions(+), 11 deletions(-) > > diff --git a/include/linux/notifier.h b/include/linux/notifier.h > index 6d731110e0db..f35c7bf76143 100644 > --- a/include/linux/notifier.h > +++ b/include/linux/notifier.h > @@ -43,9 +43,7 @@ > * in srcu_notifier_call_chain(): no cache bounces and no memory barriers. > * As compensation, srcu_notifier_chain_unregister() is rather expensive. > * SRCU notifier chains should be used when the chain will be called very > - * often but notifier_blocks will seldom be removed. Also, SRCU notifier > - * chains are slightly more difficult to use because they require special > - * runtime initialization. > + * often but notifier_blocks will seldom be removed. > */ > > struct notifier_block; > @@ -91,7 +89,7 @@ struct srcu_notifier_head { > (name)->head = NULL; \ > } while (0) > > -/* srcu_notifier_heads must be initialized and cleaned up dynamically */ > +/* srcu_notifier_heads must be cleaned up dynamically */ > extern void srcu_init_notifier_head(struct srcu_notifier_head *nh); > #define srcu_cleanup_notifier_head(name) \ > cleanup_srcu_struct(&(name)->srcu); > @@ -104,7 +102,13 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh); > .head = NULL } > #define RAW_NOTIFIER_INIT(name) { \ > .head = NULL } > -/* srcu_notifier_heads cannot be initialized statically */ > + > +#define SRCU_NOTIFIER_INIT(name, pcpu) \ > + { \ > + .mutex = __MUTEX_INITIALIZER(name.mutex), \ > + .head = NULL, \ > + .srcu = __SRCU_STRUCT_INIT(name.srcu, pcpu), \ > + } > > #define ATOMIC_NOTIFIER_HEAD(name) \ > struct atomic_notifier_head name = \ > @@ -116,6 +120,26 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh); > struct raw_notifier_head name = \ > RAW_NOTIFIER_INIT(name) > > +#ifdef CONFIG_TREE_SRCU > +#define _SRCU_NOTIFIER_HEAD(name, mod) \ > + static DEFINE_PER_CPU(struct srcu_data, \ > + name##_head_srcu_data); \ > + mod struct srcu_notifier_head name = \ > + SRCU_NOTIFIER_INIT(name, name##_head_srcu_data) > + > +#else > +#define _SRCU_NOTIFIER_HEAD(name, mod) \ > + mod struct srcu_notifier_head name = \ > + SRCU_NOTIFIER_INIT(name, name) > + > +#endif > + > +#define SRCU_NOTIFIER_HEAD(name) \ > + _SRCU_NOTIFIER_HEAD(name, /* not static */) > + > +#define SRCU_NOTIFIER_HEAD_STATIC(name) \ > + _SRCU_NOTIFIER_HEAD(name, static) > + > #ifdef __KERNEL__ > > extern int atomic_notifier_chain_register(struct atomic_notifier_head *nh, > diff --git a/include/linux/srcutiny.h b/include/linux/srcutiny.h > index 261471f407a5..f41d2fb09f87 100644 > --- a/include/linux/srcutiny.h > +++ b/include/linux/srcutiny.h > @@ -43,7 +43,7 @@ struct srcu_struct { > > void srcu_drive_gp(struct work_struct *wp); > > -#define __SRCU_STRUCT_INIT(name) \ > +#define __SRCU_STRUCT_INIT(name, __ignored) \ > { \ > .srcu_wq = __SWAIT_QUEUE_HEAD_INITIALIZER(name.srcu_wq), \ > .srcu_cb_tail = &name.srcu_cb_head, \ > @@ -56,9 +56,9 @@ void srcu_drive_gp(struct work_struct *wp); > * Tree SRCU, which needs some per-CPU data. > */ > #define DEFINE_SRCU(name) \ > - struct srcu_struct name = __SRCU_STRUCT_INIT(name) > + struct srcu_struct name = __SRCU_STRUCT_INIT(name, name) > #define DEFINE_STATIC_SRCU(name) \ > - static struct srcu_struct name = __SRCU_STRUCT_INIT(name) > + static struct srcu_struct name = __SRCU_STRUCT_INIT(name, name) > > void synchronize_srcu(struct srcu_struct *sp); > > diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h > index 4eda108abee0..745d4ca4dd50 100644 > --- a/include/linux/srcutree.h > +++ b/include/linux/srcutree.h > @@ -104,9 +104,9 @@ struct srcu_struct { > #define SRCU_STATE_SCAN1 1 > #define SRCU_STATE_SCAN2 2 > > -#define __SRCU_STRUCT_INIT(name) \ > +#define __SRCU_STRUCT_INIT(name, pcpu_name) \ > { \ > - .sda = &name##_srcu_data, \ > + .sda = &pcpu_name, \ > .lock = __SPIN_LOCK_UNLOCKED(name.lock), \ > .srcu_gp_seq_needed = 0 - 1, \ > __SRCU_DEP_MAP_INIT(name) \ > @@ -133,7 +133,7 @@ struct srcu_struct { > */ > #define __DEFINE_SRCU(name, is_static) \ > static DEFINE_PER_CPU(struct srcu_data, name##_srcu_data);\ > - is_static struct srcu_struct name = __SRCU_STRUCT_INIT(name) > + is_static struct srcu_struct name = __SRCU_STRUCT_INIT(name, name##_srcu_data) > #define DEFINE_SRCU(name) __DEFINE_SRCU(name, /* not static */) > #define DEFINE_STATIC_SRCU(name) __DEFINE_SRCU(name, static) > > -- > 2.17.0 > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] kernel/SRCU: provide a static initializer 2018-05-29 8:09 ` Rafael J. Wysocki @ 2018-05-29 12:04 ` Paul E. McKenney 2018-05-29 17:14 ` Rafael J. Wysocki 0 siblings, 1 reply; 10+ messages in thread From: Paul E. McKenney @ 2018-05-29 12:04 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Sebastian Andrzej Siewior, Linux PM, Linux Kernel Mailing List, Rafael J. Wysocki, Viresh Kumar, Thomas Gleixner On Tue, May 29, 2018 at 10:09:51AM +0200, Rafael J. Wysocki wrote: > On Fri, May 25, 2018 at 12:19 PM, Sebastian Andrzej Siewior > <bigeasy@linutronix.de> wrote: > > There are macros for static initializer for the three out of four > > possible notifier types, that are: > > ATOMIC_NOTIFIER_HEAD() > > BLOCKING_NOTIFIER_HEAD() > > RAW_NOTIFIER_HEAD() > > > > This patch provides a static initilizer for the forth type to make it > > complete. > > > > Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > > I cannot apply this without an ACK from Paul. I have both queued, but if you would prefer to take them, then for the SRCU piece: Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Thanx, Paul > > --- > > include/linux/notifier.h | 34 +++++++++++++++++++++++++++++----- > > include/linux/srcutiny.h | 6 +++--- > > include/linux/srcutree.h | 6 +++--- > > 3 files changed, 35 insertions(+), 11 deletions(-) > > > > diff --git a/include/linux/notifier.h b/include/linux/notifier.h > > index 6d731110e0db..f35c7bf76143 100644 > > --- a/include/linux/notifier.h > > +++ b/include/linux/notifier.h > > @@ -43,9 +43,7 @@ > > * in srcu_notifier_call_chain(): no cache bounces and no memory barriers. > > * As compensation, srcu_notifier_chain_unregister() is rather expensive. > > * SRCU notifier chains should be used when the chain will be called very > > - * often but notifier_blocks will seldom be removed. Also, SRCU notifier > > - * chains are slightly more difficult to use because they require special > > - * runtime initialization. > > + * often but notifier_blocks will seldom be removed. > > */ > > > > struct notifier_block; > > @@ -91,7 +89,7 @@ struct srcu_notifier_head { > > (name)->head = NULL; \ > > } while (0) > > > > -/* srcu_notifier_heads must be initialized and cleaned up dynamically */ > > +/* srcu_notifier_heads must be cleaned up dynamically */ > > extern void srcu_init_notifier_head(struct srcu_notifier_head *nh); > > #define srcu_cleanup_notifier_head(name) \ > > cleanup_srcu_struct(&(name)->srcu); > > @@ -104,7 +102,13 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh); > > .head = NULL } > > #define RAW_NOTIFIER_INIT(name) { \ > > .head = NULL } > > -/* srcu_notifier_heads cannot be initialized statically */ > > + > > +#define SRCU_NOTIFIER_INIT(name, pcpu) \ > > + { \ > > + .mutex = __MUTEX_INITIALIZER(name.mutex), \ > > + .head = NULL, \ > > + .srcu = __SRCU_STRUCT_INIT(name.srcu, pcpu), \ > > + } > > > > #define ATOMIC_NOTIFIER_HEAD(name) \ > > struct atomic_notifier_head name = \ > > @@ -116,6 +120,26 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh); > > struct raw_notifier_head name = \ > > RAW_NOTIFIER_INIT(name) > > > > +#ifdef CONFIG_TREE_SRCU > > +#define _SRCU_NOTIFIER_HEAD(name, mod) \ > > + static DEFINE_PER_CPU(struct srcu_data, \ > > + name##_head_srcu_data); \ > > + mod struct srcu_notifier_head name = \ > > + SRCU_NOTIFIER_INIT(name, name##_head_srcu_data) > > + > > +#else > > +#define _SRCU_NOTIFIER_HEAD(name, mod) \ > > + mod struct srcu_notifier_head name = \ > > + SRCU_NOTIFIER_INIT(name, name) > > + > > +#endif > > + > > +#define SRCU_NOTIFIER_HEAD(name) \ > > + _SRCU_NOTIFIER_HEAD(name, /* not static */) > > + > > +#define SRCU_NOTIFIER_HEAD_STATIC(name) \ > > + _SRCU_NOTIFIER_HEAD(name, static) > > + > > #ifdef __KERNEL__ > > > > extern int atomic_notifier_chain_register(struct atomic_notifier_head *nh, > > diff --git a/include/linux/srcutiny.h b/include/linux/srcutiny.h > > index 261471f407a5..f41d2fb09f87 100644 > > --- a/include/linux/srcutiny.h > > +++ b/include/linux/srcutiny.h > > @@ -43,7 +43,7 @@ struct srcu_struct { > > > > void srcu_drive_gp(struct work_struct *wp); > > > > -#define __SRCU_STRUCT_INIT(name) \ > > +#define __SRCU_STRUCT_INIT(name, __ignored) \ > > { \ > > .srcu_wq = __SWAIT_QUEUE_HEAD_INITIALIZER(name.srcu_wq), \ > > .srcu_cb_tail = &name.srcu_cb_head, \ > > @@ -56,9 +56,9 @@ void srcu_drive_gp(struct work_struct *wp); > > * Tree SRCU, which needs some per-CPU data. > > */ > > #define DEFINE_SRCU(name) \ > > - struct srcu_struct name = __SRCU_STRUCT_INIT(name) > > + struct srcu_struct name = __SRCU_STRUCT_INIT(name, name) > > #define DEFINE_STATIC_SRCU(name) \ > > - static struct srcu_struct name = __SRCU_STRUCT_INIT(name) > > + static struct srcu_struct name = __SRCU_STRUCT_INIT(name, name) > > > > void synchronize_srcu(struct srcu_struct *sp); > > > > diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h > > index 4eda108abee0..745d4ca4dd50 100644 > > --- a/include/linux/srcutree.h > > +++ b/include/linux/srcutree.h > > @@ -104,9 +104,9 @@ struct srcu_struct { > > #define SRCU_STATE_SCAN1 1 > > #define SRCU_STATE_SCAN2 2 > > > > -#define __SRCU_STRUCT_INIT(name) \ > > +#define __SRCU_STRUCT_INIT(name, pcpu_name) \ > > { \ > > - .sda = &name##_srcu_data, \ > > + .sda = &pcpu_name, \ > > .lock = __SPIN_LOCK_UNLOCKED(name.lock), \ > > .srcu_gp_seq_needed = 0 - 1, \ > > __SRCU_DEP_MAP_INIT(name) \ > > @@ -133,7 +133,7 @@ struct srcu_struct { > > */ > > #define __DEFINE_SRCU(name, is_static) \ > > static DEFINE_PER_CPU(struct srcu_data, name##_srcu_data);\ > > - is_static struct srcu_struct name = __SRCU_STRUCT_INIT(name) > > + is_static struct srcu_struct name = __SRCU_STRUCT_INIT(name, name##_srcu_data) > > #define DEFINE_SRCU(name) __DEFINE_SRCU(name, /* not static */) > > #define DEFINE_STATIC_SRCU(name) __DEFINE_SRCU(name, static) > > > > -- > > 2.17.0 > > > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] kernel/SRCU: provide a static initializer 2018-05-29 12:04 ` Paul E. McKenney @ 2018-05-29 17:14 ` Rafael J. Wysocki 2018-05-29 17:26 ` Paul E. McKenney 0 siblings, 1 reply; 10+ messages in thread From: Rafael J. Wysocki @ 2018-05-29 17:14 UTC (permalink / raw) To: Paul McKenney Cc: Rafael J. Wysocki, Sebastian Andrzej Siewior, Linux PM, Linux Kernel Mailing List, Rafael J. Wysocki, Viresh Kumar, Thomas Gleixner On Tue, May 29, 2018 at 2:04 PM, Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote: > On Tue, May 29, 2018 at 10:09:51AM +0200, Rafael J. Wysocki wrote: >> On Fri, May 25, 2018 at 12:19 PM, Sebastian Andrzej Siewior >> <bigeasy@linutronix.de> wrote: >> > There are macros for static initializer for the three out of four >> > possible notifier types, that are: >> > ATOMIC_NOTIFIER_HEAD() >> > BLOCKING_NOTIFIER_HEAD() >> > RAW_NOTIFIER_HEAD() >> > >> > This patch provides a static initilizer for the forth type to make it >> > complete. >> > >> > Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> >> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> >> >> I cannot apply this without an ACK from Paul. > > I have both queued, but if you would prefer to take them, then for the > SRCU piece: > > Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> > Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Thanks! I'll route them along with the other cpufreq material then. Cheers, Rafael ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] kernel/SRCU: provide a static initializer 2018-05-29 17:14 ` Rafael J. Wysocki @ 2018-05-29 17:26 ` Paul E. McKenney 2018-05-30 11:09 ` Rafael J. Wysocki 0 siblings, 1 reply; 10+ messages in thread From: Paul E. McKenney @ 2018-05-29 17:26 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Sebastian Andrzej Siewior, Linux PM, Linux Kernel Mailing List, Rafael J. Wysocki, Viresh Kumar, Thomas Gleixner On Tue, May 29, 2018 at 07:14:49PM +0200, Rafael J. Wysocki wrote: > On Tue, May 29, 2018 at 2:04 PM, Paul E. McKenney > <paulmck@linux.vnet.ibm.com> wrote: > > On Tue, May 29, 2018 at 10:09:51AM +0200, Rafael J. Wysocki wrote: > >> On Fri, May 25, 2018 at 12:19 PM, Sebastian Andrzej Siewior > >> <bigeasy@linutronix.de> wrote: > >> > There are macros for static initializer for the three out of four > >> > possible notifier types, that are: > >> > ATOMIC_NOTIFIER_HEAD() > >> > BLOCKING_NOTIFIER_HEAD() > >> > RAW_NOTIFIER_HEAD() > >> > > >> > This patch provides a static initilizer for the forth type to make it > >> > complete. > >> > > >> > Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > >> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > >> > >> I cannot apply this without an ACK from Paul. > > > > I have both queued, but if you would prefer to take them, then for the > > SRCU piece: > > > > Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> > > Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> > > Thanks! > > I'll route them along with the other cpufreq material then. Please let me know when you have them queued so that I can remove them from -rcu. Thanx, Paul ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] kernel/SRCU: provide a static initializer 2018-05-29 17:26 ` Paul E. McKenney @ 2018-05-30 11:09 ` Rafael J. Wysocki 2018-06-07 7:32 ` Paul E. McKenney 0 siblings, 1 reply; 10+ messages in thread From: Rafael J. Wysocki @ 2018-05-30 11:09 UTC (permalink / raw) To: Paul McKenney Cc: Rafael J. Wysocki, Sebastian Andrzej Siewior, Linux PM, Linux Kernel Mailing List, Rafael J. Wysocki, Viresh Kumar, Thomas Gleixner On Tue, May 29, 2018 at 7:26 PM, Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote: > On Tue, May 29, 2018 at 07:14:49PM +0200, Rafael J. Wysocki wrote: >> On Tue, May 29, 2018 at 2:04 PM, Paul E. McKenney >> <paulmck@linux.vnet.ibm.com> wrote: >> > On Tue, May 29, 2018 at 10:09:51AM +0200, Rafael J. Wysocki wrote: >> >> On Fri, May 25, 2018 at 12:19 PM, Sebastian Andrzej Siewior >> >> <bigeasy@linutronix.de> wrote: >> >> > There are macros for static initializer for the three out of four >> >> > possible notifier types, that are: >> >> > ATOMIC_NOTIFIER_HEAD() >> >> > BLOCKING_NOTIFIER_HEAD() >> >> > RAW_NOTIFIER_HEAD() >> >> > >> >> > This patch provides a static initilizer for the forth type to make it >> >> > complete. >> >> > >> >> > Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> >> >> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> >> >> >> >> I cannot apply this without an ACK from Paul. >> > >> > I have both queued, but if you would prefer to take them, then for the >> > SRCU piece: >> > >> > Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> >> > Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> >> >> Thanks! >> >> I'll route them along with the other cpufreq material then. > > Please let me know when you have them queued so that I can remove > them from -rcu. I've just added them to my linux-next branch. Cheers, Rafael ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] kernel/SRCU: provide a static initializer 2018-05-30 11:09 ` Rafael J. Wysocki @ 2018-06-07 7:32 ` Paul E. McKenney 0 siblings, 0 replies; 10+ messages in thread From: Paul E. McKenney @ 2018-06-07 7:32 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Sebastian Andrzej Siewior, Linux PM, Linux Kernel Mailing List, Rafael J. Wysocki, Viresh Kumar, Thomas Gleixner On Wed, May 30, 2018 at 01:09:57PM +0200, Rafael J. Wysocki wrote: > On Tue, May 29, 2018 at 7:26 PM, Paul E. McKenney > <paulmck@linux.vnet.ibm.com> wrote: > > On Tue, May 29, 2018 at 07:14:49PM +0200, Rafael J. Wysocki wrote: > >> On Tue, May 29, 2018 at 2:04 PM, Paul E. McKenney > >> <paulmck@linux.vnet.ibm.com> wrote: > >> > On Tue, May 29, 2018 at 10:09:51AM +0200, Rafael J. Wysocki wrote: > >> >> On Fri, May 25, 2018 at 12:19 PM, Sebastian Andrzej Siewior > >> >> <bigeasy@linutronix.de> wrote: > >> >> > There are macros for static initializer for the three out of four > >> >> > possible notifier types, that are: > >> >> > ATOMIC_NOTIFIER_HEAD() > >> >> > BLOCKING_NOTIFIER_HEAD() > >> >> > RAW_NOTIFIER_HEAD() > >> >> > > >> >> > This patch provides a static initilizer for the forth type to make it > >> >> > complete. > >> >> > > >> >> > Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > >> >> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > >> >> > >> >> I cannot apply this without an ACK from Paul. > >> > > >> > I have both queued, but if you would prefer to take them, then for the > >> > SRCU piece: > >> > > >> > Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> > >> > Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> > >> > >> Thanks! > >> > >> I'll route them along with the other cpufreq material then. > > > > Please let me know when you have them queued so that I can remove > > them from -rcu. > > I've just added them to my linux-next branch. And I have removed them, thank you! Thanx, Paul ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/2] cpufreq: Use static SRCU initializer 2018-05-25 10:19 SRCU: add a static initializer and let cpufreq use it Sebastian Andrzej Siewior 2018-05-25 10:19 ` [PATCH 1/2] kernel/SRCU: provide a static initializer Sebastian Andrzej Siewior @ 2018-05-25 10:19 ` Sebastian Andrzej Siewior 2018-05-30 4:50 ` Viresh Kumar 1 sibling, 1 reply; 10+ messages in thread From: Sebastian Andrzej Siewior @ 2018-05-25 10:19 UTC (permalink / raw) To: linux-pm Cc: linux-kernel, Rafael J. Wysocki, Viresh Kumar, Paul E. McKenney, Thomas Gleixner, bigeasy Use the static SRCU initializer for `cpufreq_transition_notifier_list'. This avoids the init_cpufreq_transition_notifier_list() initcall. Its only purpose is to initialize the SRCU notifier once during boot and set another variable which is used as an indicator whether the init was perfromed before cpufreq_register_notifier() was used. Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> CC: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- drivers/cpufreq/cpufreq.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 075d18f6ba7a..3f7b502cfb1e 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -89,16 +89,7 @@ static void cpufreq_governor_limits(struct cpufreq_policy *policy); * The mutex locks both lists. */ static BLOCKING_NOTIFIER_HEAD(cpufreq_policy_notifier_list); -static struct srcu_notifier_head cpufreq_transition_notifier_list; - -static bool init_cpufreq_transition_notifier_list_called; -static int __init init_cpufreq_transition_notifier_list(void) -{ - srcu_init_notifier_head(&cpufreq_transition_notifier_list); - init_cpufreq_transition_notifier_list_called = true; - return 0; -} -pure_initcall(init_cpufreq_transition_notifier_list); +SRCU_NOTIFIER_HEAD_STATIC(cpufreq_transition_notifier_list); static int off __read_mostly; static int cpufreq_disabled(void) @@ -1764,8 +1755,6 @@ int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list) if (cpufreq_disabled()) return -EINVAL; - WARN_ON(!init_cpufreq_transition_notifier_list_called); - switch (list) { case CPUFREQ_TRANSITION_NOTIFIER: mutex_lock(&cpufreq_fast_switch_lock); -- 2.17.0 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] cpufreq: Use static SRCU initializer 2018-05-25 10:19 ` [PATCH 2/2] cpufreq: Use static SRCU initializer Sebastian Andrzej Siewior @ 2018-05-30 4:50 ` Viresh Kumar 0 siblings, 0 replies; 10+ messages in thread From: Viresh Kumar @ 2018-05-30 4:50 UTC (permalink / raw) To: Sebastian Andrzej Siewior Cc: linux-pm, linux-kernel, Rafael J. Wysocki, Paul E. McKenney, Thomas Gleixner On 25-05-18, 12:19, Sebastian Andrzej Siewior wrote: > Use the static SRCU initializer for `cpufreq_transition_notifier_list'. > This avoids the init_cpufreq_transition_notifier_list() initcall. Its > only purpose is to initialize the SRCU notifier once during boot and set > another variable which is used as an indicator whether the init was > perfromed before cpufreq_register_notifier() was used. > > Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> > CC: Viresh Kumar <viresh.kumar@linaro.org> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > --- > drivers/cpufreq/cpufreq.c | 13 +------------ > 1 file changed, 1 insertion(+), 12 deletions(-) > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 075d18f6ba7a..3f7b502cfb1e 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -89,16 +89,7 @@ static void cpufreq_governor_limits(struct cpufreq_policy *policy); > * The mutex locks both lists. > */ > static BLOCKING_NOTIFIER_HEAD(cpufreq_policy_notifier_list); > -static struct srcu_notifier_head cpufreq_transition_notifier_list; > - > -static bool init_cpufreq_transition_notifier_list_called; > -static int __init init_cpufreq_transition_notifier_list(void) > -{ > - srcu_init_notifier_head(&cpufreq_transition_notifier_list); > - init_cpufreq_transition_notifier_list_called = true; > - return 0; > -} > -pure_initcall(init_cpufreq_transition_notifier_list); > +SRCU_NOTIFIER_HEAD_STATIC(cpufreq_transition_notifier_list); > > static int off __read_mostly; > static int cpufreq_disabled(void) > @@ -1764,8 +1755,6 @@ int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list) > if (cpufreq_disabled()) > return -EINVAL; > > - WARN_ON(!init_cpufreq_transition_notifier_list_called); > - > switch (list) { > case CPUFREQ_TRANSITION_NOTIFIER: > mutex_lock(&cpufreq_fast_switch_lock); Acked-by: Viresh Kumar <viresh.kumar@linaro.org> -- viresh ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-06-07 7:31 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-05-25 10:19 SRCU: add a static initializer and let cpufreq use it Sebastian Andrzej Siewior 2018-05-25 10:19 ` [PATCH 1/2] kernel/SRCU: provide a static initializer Sebastian Andrzej Siewior 2018-05-29 8:09 ` Rafael J. Wysocki 2018-05-29 12:04 ` Paul E. McKenney 2018-05-29 17:14 ` Rafael J. Wysocki 2018-05-29 17:26 ` Paul E. McKenney 2018-05-30 11:09 ` Rafael J. Wysocki 2018-06-07 7:32 ` Paul E. McKenney 2018-05-25 10:19 ` [PATCH 2/2] cpufreq: Use static SRCU initializer Sebastian Andrzej Siewior 2018-05-30 4:50 ` Viresh Kumar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).