public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	<tglx@linutronix.de>, <mingo@redhat.com>, <hpa@zytor.com>,
	<konrad.wilk@oracle.com>, <david.vrabel@citrix.com>
Cc: <tianyu.lan@intel.com>, <xen-devel@lists.xenproject.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [Xen-devel] [PATCH v2] xen/smp: Use die_complete completion when taking CPU down
Date: Wed, 22 Oct 2014 16:32:59 +0100	[thread overview]
Message-ID: <5447CE2B.5090101@citrix.com> (raw)
In-Reply-To: <1413478046-4987-1-git-send-email-boris.ostrovsky@oracle.com>

On 16/10/14 17:47, Boris Ostrovsky wrote:
> Commit 2ed53c0d6cc9 ("x86/smpboot: Speed up suspend/resume by avoiding
> 100ms sleep for CPU offline during S3") introduced completions to CPU
> offlining process. These completions are not initialized on Xen kernels
> causing a panic in play_dead_common().
> 
> Move handling of die_complete into common routines to make them
> available to Xen guests.
> 
> (Also, while at it, move these routines as well as die_complete under
> ifdef CONFIG_HOTPLUG_CPU)

Reviewed-by: David Vrabel <david.vrabel@citrix.com>

I can merge this via the Xen tree if that is preferred.

David

> --- a/arch/x86/include/asm/smp.h
> +++ b/arch/x86/include/asm/smp.h
> @@ -149,7 +149,11 @@ static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
>  	smp_ops.send_call_func_ipi(mask);
>  }
>  
> +#ifdef CONFIG_HOTPLUG_CPU
>  void cpu_disable_common(void);
> +void cpu_die_common(unsigned int cpu);
> +void play_dead_common(void);
> +#endif
>  void native_smp_prepare_boot_cpu(void);
>  void native_smp_prepare_cpus(unsigned int max_cpus);
>  void native_smp_cpus_done(unsigned int max_cpus);
> @@ -157,7 +161,6 @@ int native_cpu_up(unsigned int cpunum, struct task_struct *tidle);
>  int native_cpu_disable(void);
>  void native_cpu_die(unsigned int cpu);
>  void native_play_dead(void);
> -void play_dead_common(void);
>  void wbinvd_on_cpu(int cpu);
>  int wbinvd_on_all_cpus(void);
>  
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index 2d5200e..6fe0fc1 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -102,7 +102,9 @@ DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_llc_shared_map);
>  DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
>  EXPORT_PER_CPU_SYMBOL(cpu_info);
>  
> +#ifdef CONFIG_HOTPLUG_CPU
>  static DEFINE_PER_CPU(struct completion, die_complete);
> +#endif
>  
>  atomic_t init_deasserted;
>  
> @@ -1309,6 +1311,8 @@ void cpu_disable_common(void)
>  {
>  	int cpu = smp_processor_id();
>  
> +	init_completion(&per_cpu(die_complete, smp_processor_id()));
> +
>  	remove_siblinginfo(cpu);
>  
>  	/* It's now safe to remove this processor from the online map */
> @@ -1327,16 +1331,21 @@ int native_cpu_disable(void)
>  		return ret;
>  
>  	clear_local_APIC();
> -	init_completion(&per_cpu(die_complete, smp_processor_id()));
>  	cpu_disable_common();
>  
>  	return 0;
>  }
>  
> +void cpu_die_common(unsigned int cpu)
> +{
> +	wait_for_completion_timeout(&per_cpu(die_complete, cpu), HZ);
> +}
> +
>  void native_cpu_die(unsigned int cpu)
>  {
>  	/* We don't do anything here: idle task is faking death itself. */
> -	wait_for_completion_timeout(&per_cpu(die_complete, cpu), HZ);
> +
> +	cpu_die_common(cpu);
>  
>  	/* They ack this in play_dead() by setting CPU_DEAD */
>  	if (per_cpu(cpu_state, cpu) == CPU_DEAD) {
> diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
> index 8650cdb..4c071ae 100644
> --- a/arch/x86/xen/smp.c
> +++ b/arch/x86/xen/smp.c
> @@ -510,6 +510,9 @@ static void xen_cpu_die(unsigned int cpu)
>  		current->state = TASK_UNINTERRUPTIBLE;
>  		schedule_timeout(HZ/10);
>  	}
> +
> +	cpu_die_common(cpu);
> +
>  	xen_smp_intr_free(cpu);
>  	xen_uninit_lock_cpu(cpu);
>  	xen_teardown_timer(cpu);
> 


  reply	other threads:[~2014-10-22 15:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-16 16:47 [PATCH v2] xen/smp: Use die_complete completion when taking CPU down Boris Ostrovsky
2014-10-22 15:32 ` David Vrabel [this message]
2014-10-22 15:36   ` [Xen-devel] " H. Peter Anvin
2014-10-22 15:37 ` H. Peter Anvin
2014-10-22 15:44   ` Boris Ostrovsky

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=5447CE2B.5090101@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=hpa@zytor.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tianyu.lan@intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox