All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: tglx@linutronix.de, laijs@cn.fujitsu.com, bobby.prani@gmail.com,
	peterz@infradead.org, fweisbec@gmail.com, dvhart@linux.intel.com,
	x86@kernel.org, oleg@redhat.com, linux-kernel@vger.kernel.org,
	rostedt@goodmis.org, josh@joshtriplett.org, dhowells@redhat.com,
	edumazet@google.com, mathieu.desnoyers@efficios.com,
	David Vrabel <david.vrabel@citrix.com>,
	dipankar@in.ibm.com, xen-devel@lists.xenproject.org,
	akpm@linux-foundation.org, mingo@kernel.org
Subject: Re: [PATCH tip/core/rcu 02/20] x86: Use common outgoing-CPU-notification code
Date: Thu, 5 Mar 2015 14:00:43 -0800	[thread overview]
Message-ID: <20150305220043.GH5448__37652.8525645428$1425592990$gmane$org@linux.vnet.ibm.com> (raw)
In-Reply-To: <54F8C807.5070103@oracle.com>

On Thu, Mar 05, 2015 at 04:17:59PM -0500, Boris Ostrovsky wrote:
> On 03/04/2015 10:25 AM, Paul E. McKenney wrote:
> >On Wed, Mar 04, 2015 at 09:55:11AM -0500, Boris Ostrovsky wrote:
> 
> >>The simple solution is to stop calling native_cpu_die() above but
> >>I'd like to use common code in native_cpu_die(). I'll see if I can
> >>carve it out without too much damage to x86.
> >
> >Very good, thank you!  I look forward to seeing your patch.
> 
> How about something like this, on top of your original 02/20 patch
> (this is copy-paste but hopefully it can be applied):

Unfortunately, no joy.  :-(

I was able to fix a couple of whitespace problems, but it still didn't
like this hunk: "@@ -766,12 +778,6 @@".

Could you please send the patch as an attachment, post it on the web
somewhere, or otherwise get me a clean copy it it?

							Thanx, Paul

>  arch/x86/include/asm/smp.h |    1 +
>  arch/x86/kernel/smpboot.c  |   12 +++++++++++-
>  arch/x86/xen/smp.c         |   34 ++++++++++++++++++++--------------
>  3 files changed, 32 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
> index 8cd27e0..a5cb4f6 100644
> --- a/arch/x86/include/asm/smp.h
> +++ b/arch/x86/include/asm/smp.h
> @@ -155,6 +155,7 @@ void native_smp_prepare_cpus(unsigned int max_cpus);
>  void native_smp_cpus_done(unsigned int max_cpus);
>  int native_cpu_up(unsigned int cpunum, struct task_struct *tidle);
>  int native_cpu_disable(void);
> +int common_cpu_die(unsigned int cpu);
>  void native_cpu_die(unsigned int cpu);
>  void native_play_dead(void);
>  void play_dead_common(void);
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index ff24fbd..c8fa349 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -1345,8 +1345,10 @@ int native_cpu_disable(void)
>  	return 0;
>  }
> 
> -void native_cpu_die(unsigned int cpu)
> +int common_cpu_die(unsigned int cpu)
>  {
> +	int ret = 0;
> +
>  	/* We don't do anything here: idle task is faking death itself. */
> 
>  	/* They ack this in play_dead() by setting CPU_DEAD */
> @@ -1355,7 +1357,15 @@ void native_cpu_die(unsigned int cpu)
>  			pr_info("CPU %u is now offline\n", cpu);
>  	} else {
>  		pr_err("CPU %u didn't die...\n", cpu);
> +		ret = -1;
>  	}
> +
> +	return ret;
> +}
> +
> +void native_cpu_die(unsigned int cpu)
> +{
> +	common_cpu_die(cpu);
>  }
> 
>  void play_dead_common(void)
> diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
> index e2c7389..1c5e760 100644
> --- a/arch/x86/xen/smp.c
> +++ b/arch/x86/xen/smp.c
> @@ -455,7 +455,10 @@ static int xen_cpu_up(unsigned int cpu, struct
> task_struct *idle)
>  	xen_setup_timer(cpu);
>  	xen_init_lock_cpu(cpu);
> 
> -	/* Xen outgoing CPUs need help cleaning up, so -EBUSY is an error. */
> +	/*
> +	 * PV VCPUs are always successfully taken down (see 'while' loop
> +	 * in xen_cpu_die()), so -EBUSY is an error.
> +	 */
>  	rc = cpu_check_up_prepare(cpu);
>  	if (rc)
>  		return rc;
> @@ -508,12 +511,11 @@ static void xen_cpu_die(unsigned int cpu)
>  		schedule_timeout(HZ/10);
>  	}
> 
> -	(void)cpu_wait_death(cpu, 5);
> -	/* FIXME: Are the below calls really safe in case of timeout? */
> -
> -	xen_smp_intr_free(cpu);
> -	xen_uninit_lock_cpu(cpu);
> -	xen_teardown_timer(cpu);
> +	if (common_cpu_die(cpu) == 0) {
> +		xen_smp_intr_free(cpu);
> +		xen_uninit_lock_cpu(cpu);
> +		xen_teardown_timer(cpu);
> +	}
>  }
> 
>  static void xen_play_dead(void) /* used only with HOTPLUG_CPU */
> @@ -745,6 +747,16 @@ static void __init
> xen_hvm_smp_prepare_cpus(unsigned int max_cpus)
>  static int xen_hvm_cpu_up(unsigned int cpu, struct task_struct *tidle)
>  {
>  	int rc;
> +
> +	/*
> +	 * This can happen if CPU was offlined earlier and
> +	 * offlining timed out in common_cpu_die().
> +	 */
> +	if (cpu_report_state(cpu) == CPU_DEAD_FROZEN) {
> +		xen_smp_intr_free(cpu);
> +		xen_uninit_lock_cpu(cpu);
> +	}
> +
>  	/*
>  	 * xen_smp_intr_init() needs to run before native_cpu_up()
>  	 * so that IPI vectors are set up on the booting CPU before
> @@ -766,12 +778,6 @@ static int xen_hvm_cpu_up(unsigned int cpu,
> struct task_struct *tidle)
>  	return rc;
>  }
> 
> -static void xen_hvm_cpu_die(unsigned int cpu)
> -{
> -	xen_cpu_die(cpu);
> -	native_cpu_die(cpu);
> -}
> -
>  void __init xen_hvm_smp_init(void)
>  {
>  	if (!xen_have_vector_callback)
> @@ -779,7 +785,7 @@ void __init xen_hvm_smp_init(void)
>  	smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus;
>  	smp_ops.smp_send_reschedule = xen_smp_send_reschedule;
>  	smp_ops.cpu_up = xen_hvm_cpu_up;
> -	smp_ops.cpu_die = xen_hvm_cpu_die;
> +	smp_ops.cpu_die = xen_cpu_die;
>  	smp_ops.send_call_func_ipi = xen_smp_send_call_function_ipi;
>  	smp_ops.send_call_func_single_ipi =
> xen_smp_send_call_function_single_ipi;
>  	smp_ops.smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu;
> -- 
> 1.7.7.6
> 
> 

  reply	other threads:[~2015-03-05 22:00 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 17:41 [PATCH tip/core/rcu 0/20] CPU hotplug updates for v4.1 Paul E. McKenney
2015-03-03 17:42 ` [PATCH tip/core/rcu 01/20] smpboot: Add common code for notification from dying CPU Paul E. McKenney
2015-03-03 17:42   ` Paul E. McKenney
2015-03-03 17:42   ` [PATCH tip/core/rcu 02/20] x86: Use common outgoing-CPU-notification code Paul E. McKenney
2015-03-03 19:17     ` Boris Ostrovsky
2015-03-03 19:42       ` Paul E. McKenney
2015-03-03 19:42       ` Paul E. McKenney
2015-03-03 20:13         ` Boris Ostrovsky
2015-03-03 20:13         ` Boris Ostrovsky
2015-03-03 21:26           ` Paul E. McKenney
2015-03-03 22:06             ` Boris Ostrovsky
2015-03-03 22:31               ` Paul E. McKenney
2015-03-03 22:31               ` Paul E. McKenney
2015-03-04 14:43                 ` Paul E. McKenney
2015-03-04 14:43                 ` Paul E. McKenney
2015-03-04 14:55                   ` Boris Ostrovsky
2015-03-04 14:55                   ` Boris Ostrovsky
2015-03-04 15:25                     ` Paul E. McKenney
2015-03-05 21:17                       ` Boris Ostrovsky
2015-03-05 21:17                       ` Boris Ostrovsky
2015-03-05 22:00                         ` Paul E. McKenney [this message]
2015-03-05 22:00                         ` Paul E. McKenney
2015-03-04 15:25                     ` Paul E. McKenney
2015-03-04 15:45                     ` David Vrabel
2015-03-04 15:45                     ` David Vrabel
2015-03-04 16:10                       ` Boris Ostrovsky
2015-03-04 16:10                       ` Boris Ostrovsky
2015-03-03 22:06             ` Boris Ostrovsky
2015-03-03 21:26           ` Paul E. McKenney
2015-03-03 19:17     ` Boris Ostrovsky
2015-03-03 17:42   ` Paul E. McKenney
2015-03-03 17:42   ` [PATCH tip/core/rcu 03/20] blackfin: " Paul E. McKenney
2015-03-03 17:42   ` [PATCH tip/core/rcu 04/20] metag: " Paul E. McKenney
2015-03-03 17:42     ` Paul E. McKenney
2015-03-10 15:30     ` James Hogan
2015-03-10 15:30       ` James Hogan
2015-03-10 16:59       ` Paul E. McKenney
2015-03-11 11:03         ` James Hogan
2015-03-11 11:03           ` James Hogan
2015-03-11 18:58           ` Paul E. McKenney
2015-03-11 18:58             ` Paul E. McKenney
2015-03-03 17:43   ` [PATCH tip/core/rcu 05/20] rcu: Consolidate offline-CPU callback initialization Paul E. McKenney
2015-03-03 17:43   ` [PATCH tip/core/rcu 06/20] rcu: Put all orphan-callback-related code under same comment Paul E. McKenney
2015-03-03 17:43   ` [PATCH tip/core/rcu 07/20] rcu: Simplify sync_rcu_preempt_exp_init() Paul E. McKenney
2015-03-03 17:43   ` [PATCH tip/core/rcu 08/20] rcu: Eliminate empty HOTPLUG_CPU ifdef Paul E. McKenney
2015-03-03 17:43   ` [PATCH tip/core/rcu 09/20] rcu: Detect stalls caused by failure to propagate up rcu_node tree Paul E. McKenney
2015-03-03 17:43   ` [PATCH tip/core/rcu 10/20] rcu: Provide diagnostic option to slow down grace-period initialization Paul E. McKenney
2015-03-04 10:54     ` Paul Bolle
2015-03-04 14:59       ` Paul E. McKenney
2015-03-03 17:43   ` [PATCH tip/core/rcu 11/20] rcutorture: Enable slow grace-period initializations Paul E. McKenney
2015-03-03 17:43   ` [PATCH tip/core/rcu 12/20] rcu: Remove event tracing from rcu_cpu_notify(), used by offline CPUs Paul E. McKenney
2015-03-03 17:43   ` [PATCH tip/core/rcu 13/20] rcu: Rework preemptible expedited bitmask handling Paul E. McKenney
2015-03-03 17:43   ` [PATCH tip/core/rcu 14/20] rcu: Move rcu_report_unblock_qs_rnp() to common code Paul E. McKenney
2015-03-03 17:43   ` [PATCH tip/core/rcu 15/20] rcu: Process offlining and onlining only at grace-period start Paul E. McKenney
2015-03-03 17:43   ` [PATCH tip/core/rcu 16/20] rcu: Eliminate ->onoff_mutex from rcu_node structure Paul E. McKenney
2015-03-03 17:43   ` [PATCH tip/core/rcu 17/20] cpu: Make CPU-offline idle-loop transition point more precise Paul E. McKenney
2015-03-03 17:43   ` [PATCH tip/core/rcu 18/20] rcu: Handle outgoing CPUs on exit from idle loop Paul E. McKenney
2015-03-03 17:43   ` [PATCH tip/core/rcu 19/20] rcutorture: Default to grace-period-initialization delays Paul E. McKenney
2015-03-03 17:43   ` [PATCH tip/core/rcu 20/20] rcu: Add diagnostics to grace-period cleanup Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20150305220043.GH5448__37652.8525645428$1425592990$gmane$org@linux.vnet.ibm.com' \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=bobby.prani@gmail.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=dvhart@linux.intel.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.