linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] rcu: Create a function to handle rcu_nocb_mask boot time setup
@ 2014-07-23 19:40 Pranith Kumar
  2014-07-23 19:40 ` [PATCH 2/2] rcu: Check the return value of rcu_nocb_mask cpumask allocation Pranith Kumar
  2014-07-24 18:20 ` [PATCH 1/2] rcu: Create a function to handle rcu_nocb_mask boot time setup Paul E. McKenney
  0 siblings, 2 replies; 3+ messages in thread
From: Pranith Kumar @ 2014-07-23 19:40 UTC (permalink / raw)
  To: paulmck, Josh Triplett, Steven Rostedt, Mathieu Desnoyers,
	Lai Jiangshan, open list:READ-COPY UPDATE...

This commit creates a function rcu_bootup_announce_oddnes_nocb(), which handles
allocation of rcu_nocb_mask and setting it according to the kernel configuration
parameters.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 kernel/rcu/tree_plugin.h | 62 ++++++++++++++++++++++++++++--------------------
 1 file changed, 36 insertions(+), 26 deletions(-)

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index c31eb28..730208a 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -47,6 +47,40 @@ static char __initdata nocb_buf[NR_CPUS * 5];
 #endif /* #ifdef CONFIG_RCU_NOCB_CPU */
 
 /*
+ * This is a helper for rcu_bootup_announce_oddness(), which takes care of
+ * setting up rcu_nocb_mask for nocb specific kernel configuration parameters
+ */
+static void __init rcu_bootup_announce_oddness_nocb(void)
+{
+#ifndef CONFIG_RCU_NOCB_CPU_NONE
+	if (!have_rcu_nocb_mask) {
+		zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL);
+		have_rcu_nocb_mask = true;
+	}
+#ifdef CONFIG_RCU_NOCB_CPU_ZERO
+	pr_info("\tOffload RCU callbacks from CPU 0\n");
+	cpumask_set_cpu(0, rcu_nocb_mask);
+#endif /* #ifdef CONFIG_RCU_NOCB_CPU_ZERO */
+#ifdef CONFIG_RCU_NOCB_CPU_ALL
+	pr_info("\tOffload RCU callbacks from all CPUs\n");
+	cpumask_copy(rcu_nocb_mask, cpu_possible_mask);
+#endif /* #ifdef CONFIG_RCU_NOCB_CPU_ALL */
+#endif /* #ifndef CONFIG_RCU_NOCB_CPU_NONE */
+	if (have_rcu_nocb_mask) {
+		if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
+			pr_info("\tNote: kernel parameter 'rcu_nocbs=' contains"
+					"nonexistent CPUs.\n");
+			cpumask_and(rcu_nocb_mask, cpu_possible_mask,
+				    rcu_nocb_mask);
+		}
+		cpulist_scnprintf(nocb_buf, sizeof(nocb_buf), rcu_nocb_mask);
+		pr_info("\tOffload RCU callbacks from CPUs: %s.\n", nocb_buf);
+		if (rcu_nocb_poll)
+			pr_info("\tPoll for callbacks from no-CBs CPUs.\n");
+	}
+}
+
+/*
  * Check the RCU kernel configuration parameters and print informative
  * messages about anything out of the ordinary.  If you like #ifdef, you
  * will love this function.
@@ -86,32 +120,8 @@ static void __init rcu_bootup_announce_oddness(void)
 	if (nr_cpu_ids != NR_CPUS)
 		pr_info("\tRCU restricting CPUs from NR_CPUS=%d to nr_cpu_ids=%d.\n", NR_CPUS, nr_cpu_ids);
 #ifdef CONFIG_RCU_NOCB_CPU
-#ifndef CONFIG_RCU_NOCB_CPU_NONE
-	if (!have_rcu_nocb_mask) {
-		zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL);
-		have_rcu_nocb_mask = true;
-	}
-#ifdef CONFIG_RCU_NOCB_CPU_ZERO
-	pr_info("\tOffload RCU callbacks from CPU 0\n");
-	cpumask_set_cpu(0, rcu_nocb_mask);
-#endif /* #ifdef CONFIG_RCU_NOCB_CPU_ZERO */
-#ifdef CONFIG_RCU_NOCB_CPU_ALL
-	pr_info("\tOffload RCU callbacks from all CPUs\n");
-	cpumask_copy(rcu_nocb_mask, cpu_possible_mask);
-#endif /* #ifdef CONFIG_RCU_NOCB_CPU_ALL */
-#endif /* #ifndef CONFIG_RCU_NOCB_CPU_NONE */
-	if (have_rcu_nocb_mask) {
-		if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
-			pr_info("\tNote: kernel parameter 'rcu_nocbs=' contains nonexistent CPUs.\n");
-			cpumask_and(rcu_nocb_mask, cpu_possible_mask,
-				    rcu_nocb_mask);
-		}
-		cpulist_scnprintf(nocb_buf, sizeof(nocb_buf), rcu_nocb_mask);
-		pr_info("\tOffload RCU callbacks from CPUs: %s.\n", nocb_buf);
-		if (rcu_nocb_poll)
-			pr_info("\tPoll for callbacks from no-CBs CPUs.\n");
-	}
-#endif /* #ifdef CONFIG_RCU_NOCB_CPU */
+	rcu_bootup_announce_oddness_nocb();
+#endif
 }
 
 #ifdef CONFIG_TREE_PREEMPT_RCU
-- 
2.0.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] rcu: Check the return value of rcu_nocb_mask cpumask allocation
  2014-07-23 19:40 [PATCH 1/2] rcu: Create a function to handle rcu_nocb_mask boot time setup Pranith Kumar
@ 2014-07-23 19:40 ` Pranith Kumar
  2014-07-24 18:20 ` [PATCH 1/2] rcu: Create a function to handle rcu_nocb_mask boot time setup Paul E. McKenney
  1 sibling, 0 replies; 3+ messages in thread
From: Pranith Kumar @ 2014-07-23 19:40 UTC (permalink / raw)
  To: paulmck, Josh Triplett, Steven Rostedt, Mathieu Desnoyers,
	Lai Jiangshan, open list:READ-COPY UPDATE...

This commit checks the return value of the zalloc_cpumask_var() used for
allocating cpumask for rcu_nocb_mask.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 kernel/rcu/tree_plugin.h | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 730208a..78b8d0e 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -54,7 +54,10 @@ static void __init rcu_bootup_announce_oddness_nocb(void)
 {
 #ifndef CONFIG_RCU_NOCB_CPU_NONE
 	if (!have_rcu_nocb_mask) {
-		zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL);
+		if (!zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL)) {
+			pr_info("rcu_nocb_mask allocation failed\n");
+			return;
+		}
 		have_rcu_nocb_mask = true;
 	}
 #ifdef CONFIG_RCU_NOCB_CPU_ZERO
@@ -66,18 +69,16 @@ static void __init rcu_bootup_announce_oddness_nocb(void)
 	cpumask_copy(rcu_nocb_mask, cpu_possible_mask);
 #endif /* #ifdef CONFIG_RCU_NOCB_CPU_ALL */
 #endif /* #ifndef CONFIG_RCU_NOCB_CPU_NONE */
-	if (have_rcu_nocb_mask) {
-		if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
-			pr_info("\tNote: kernel parameter 'rcu_nocbs=' contains"
-					"nonexistent CPUs.\n");
-			cpumask_and(rcu_nocb_mask, cpu_possible_mask,
-				    rcu_nocb_mask);
-		}
-		cpulist_scnprintf(nocb_buf, sizeof(nocb_buf), rcu_nocb_mask);
-		pr_info("\tOffload RCU callbacks from CPUs: %s.\n", nocb_buf);
-		if (rcu_nocb_poll)
-			pr_info("\tPoll for callbacks from no-CBs CPUs.\n");
+	if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
+		pr_info("\tNote: kernel parameter 'rcu_nocbs=' contains"
+				"nonexistent CPUs.\n");
+		cpumask_and(rcu_nocb_mask, cpu_possible_mask,
+				rcu_nocb_mask);
 	}
+	cpulist_scnprintf(nocb_buf, sizeof(nocb_buf), rcu_nocb_mask);
+	pr_info("\tOffload RCU callbacks from CPUs: %s.\n", nocb_buf);
+	if (rcu_nocb_poll)
+		pr_info("\tPoll for callbacks from no-CBs CPUs.\n");
 }
 
 /*
-- 
2.0.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] rcu: Create a function to handle rcu_nocb_mask boot time setup
  2014-07-23 19:40 [PATCH 1/2] rcu: Create a function to handle rcu_nocb_mask boot time setup Pranith Kumar
  2014-07-23 19:40 ` [PATCH 2/2] rcu: Check the return value of rcu_nocb_mask cpumask allocation Pranith Kumar
@ 2014-07-24 18:20 ` Paul E. McKenney
  1 sibling, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2014-07-24 18:20 UTC (permalink / raw)
  To: Pranith Kumar
  Cc: Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
	open list:READ-COPY UPDATE...

On Wed, Jul 23, 2014 at 03:40:09PM -0400, Pranith Kumar wrote:
> This commit creates a function rcu_bootup_announce_oddnes_nocb(), which handles
> allocation of rcu_nocb_mask and setting it according to the kernel configuration
> parameters.
> 
> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>

Looks good, but needs a bit of help.  The function name needs to be spelled
correctly in the commit log (missing an "s"), and please see below.

Please fix these issues and resend the patch.

							Thanx, Paul

> ---
>  kernel/rcu/tree_plugin.h | 62 ++++++++++++++++++++++++++++--------------------
>  1 file changed, 36 insertions(+), 26 deletions(-)
> 
> diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> index c31eb28..730208a 100644
> --- a/kernel/rcu/tree_plugin.h
> +++ b/kernel/rcu/tree_plugin.h
> @@ -47,6 +47,40 @@ static char __initdata nocb_buf[NR_CPUS * 5];
>  #endif /* #ifdef CONFIG_RCU_NOCB_CPU */
> 
>  /*
> + * This is a helper for rcu_bootup_announce_oddness(), which takes care of
> + * setting up rcu_nocb_mask for nocb specific kernel configuration parameters
> + */
> +static void __init rcu_bootup_announce_oddness_nocb(void)
> +{
> +#ifndef CONFIG_RCU_NOCB_CPU_NONE
> +	if (!have_rcu_nocb_mask) {
> +		zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL);
> +		have_rcu_nocb_mask = true;
> +	}
> +#ifdef CONFIG_RCU_NOCB_CPU_ZERO
> +	pr_info("\tOffload RCU callbacks from CPU 0\n");
> +	cpumask_set_cpu(0, rcu_nocb_mask);
> +#endif /* #ifdef CONFIG_RCU_NOCB_CPU_ZERO */
> +#ifdef CONFIG_RCU_NOCB_CPU_ALL
> +	pr_info("\tOffload RCU callbacks from all CPUs\n");
> +	cpumask_copy(rcu_nocb_mask, cpu_possible_mask);
> +#endif /* #ifdef CONFIG_RCU_NOCB_CPU_ALL */
> +#endif /* #ifndef CONFIG_RCU_NOCB_CPU_NONE */
> +	if (have_rcu_nocb_mask) {
> +		if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
> +			pr_info("\tNote: kernel parameter 'rcu_nocbs=' contains"
> +					"nonexistent CPUs.\n");

Long strings are an exception to the 80-character rule.  This string
needs to be on one line.  The scripts/checkpatch.pl script should have yelled
at you about this.

> +			cpumask_and(rcu_nocb_mask, cpu_possible_mask,
> +				    rcu_nocb_mask);
> +		}
> +		cpulist_scnprintf(nocb_buf, sizeof(nocb_buf), rcu_nocb_mask);
> +		pr_info("\tOffload RCU callbacks from CPUs: %s.\n", nocb_buf);
> +		if (rcu_nocb_poll)
> +			pr_info("\tPoll for callbacks from no-CBs CPUs.\n");
> +	}
> +}
> +
> +/*
>   * Check the RCU kernel configuration parameters and print informative
>   * messages about anything out of the ordinary.  If you like #ifdef, you
>   * will love this function.
> @@ -86,32 +120,8 @@ static void __init rcu_bootup_announce_oddness(void)
>  	if (nr_cpu_ids != NR_CPUS)
>  		pr_info("\tRCU restricting CPUs from NR_CPUS=%d to nr_cpu_ids=%d.\n", NR_CPUS, nr_cpu_ids);
>  #ifdef CONFIG_RCU_NOCB_CPU
> -#ifndef CONFIG_RCU_NOCB_CPU_NONE
> -	if (!have_rcu_nocb_mask) {
> -		zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL);
> -		have_rcu_nocb_mask = true;
> -	}
> -#ifdef CONFIG_RCU_NOCB_CPU_ZERO
> -	pr_info("\tOffload RCU callbacks from CPU 0\n");
> -	cpumask_set_cpu(0, rcu_nocb_mask);
> -#endif /* #ifdef CONFIG_RCU_NOCB_CPU_ZERO */
> -#ifdef CONFIG_RCU_NOCB_CPU_ALL
> -	pr_info("\tOffload RCU callbacks from all CPUs\n");
> -	cpumask_copy(rcu_nocb_mask, cpu_possible_mask);
> -#endif /* #ifdef CONFIG_RCU_NOCB_CPU_ALL */
> -#endif /* #ifndef CONFIG_RCU_NOCB_CPU_NONE */
> -	if (have_rcu_nocb_mask) {
> -		if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
> -			pr_info("\tNote: kernel parameter 'rcu_nocbs=' contains nonexistent CPUs.\n");
> -			cpumask_and(rcu_nocb_mask, cpu_possible_mask,
> -				    rcu_nocb_mask);
> -		}
> -		cpulist_scnprintf(nocb_buf, sizeof(nocb_buf), rcu_nocb_mask);
> -		pr_info("\tOffload RCU callbacks from CPUs: %s.\n", nocb_buf);
> -		if (rcu_nocb_poll)
> -			pr_info("\tPoll for callbacks from no-CBs CPUs.\n");
> -	}
> -#endif /* #ifdef CONFIG_RCU_NOCB_CPU */
> +	rcu_bootup_announce_oddness_nocb();
> +#endif
>  }
> 
>  #ifdef CONFIG_TREE_PREEMPT_RCU
> -- 
> 2.0.1
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-24 18:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-23 19:40 [PATCH 1/2] rcu: Create a function to handle rcu_nocb_mask boot time setup Pranith Kumar
2014-07-23 19:40 ` [PATCH 2/2] rcu: Check the return value of rcu_nocb_mask cpumask allocation Pranith Kumar
2014-07-24 18:20 ` [PATCH 1/2] rcu: Create a function to handle rcu_nocb_mask boot time setup Paul E. McKenney

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).