All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Mirela Simonovic <mirela.simonovic@aggios.com>, xen-devel@lists.xen.org
Cc: edgar.iglesias@xilinx.com, sstabellini@kernel.org, dm@aggios.com
Subject: Re: [PATCH v3 09/10] xen/arm: Free memory allocated for sibling/core maps on CPU hot-unplug
Date: Mon, 30 Apr 2018 16:55:46 +0100	[thread overview]
Message-ID: <1e0f0a39-d1a9-f543-5806-a598962ba98f@arm.com> (raw)
In-Reply-To: <20180427171258.28852-10-mirela.simonovic@aggios.com>

Hi Mirela,

On 27/04/18 18:12, Mirela Simonovic wrote:
> The memory allocated in setup_cpu_sibling_map() when a CPU is hotplugged
> has to be freed when the CPU is hot-unplugged. This is done in
> remove_cpu_sibling_map() and called when the CPU dies. The call to
> remove_cpu_sibling_map() is made from a notifier callback when
> CPU_DEAD event is received.
> 
> Signed-off-by: Mirela Simonovic <mirela.simonovic@aggios.com>
> 
> ---
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien.grall@arm.com>
> ---
> Changes in v3:
> -Use notifier to trigger remove_cpu_sibling_map() when the CPU dies.
> ---
>   xen/arch/arm/smpboot.c | 34 ++++++++++++++++++++++++++++++++++
>   1 file changed, 34 insertions(+)
> 
> diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
> index ad1f6b751b..b833e3a754 100644
> --- a/xen/arch/arm/smpboot.c
> +++ b/xen/arch/arm/smpboot.c
> @@ -89,6 +89,12 @@ static void setup_cpu_sibling_map(int cpu)
>       cpumask_set_cpu(cpu, per_cpu(cpu_core_mask, cpu));
>   }
>   
> +static void remove_cpu_sibling_map(int cpu)
> +{
> +    free_cpumask_var(per_cpu(cpu_sibling_mask, cpu));
> +    free_cpumask_var(per_cpu(cpu_core_mask, cpu));
> +}
> +
>   void __init
>   smp_clear_cpu_maps (void)
>   {
> @@ -499,6 +505,34 @@ void __cpu_die(unsigned int cpu)
>       smp_mb();
>   }
>   
> +static int cpu_smpboot_callback(
> +    struct notifier_block *nfb, unsigned long action, void *hcpu)
> +{
> +    unsigned int cpu = (unsigned long)hcpu;
> +
> +    switch ( action )
> +    {
> +    case CPU_DEAD:
> +        remove_cpu_sibling_map(cpu);
> +        break;
> +    default:
> +        break;
> +    }
> +
> +    return NOTIFY_DONE;
> +}
> +
> +static struct notifier_block cpu_smpboot_nfb = {
> +    .notifier_call = cpu_smpboot_callback,
> +};
> +
> +static int __init cpu_smpboot_notifier_init(void)
> +{
> +    register_cpu_notifier(&cpu_smpboot_nfb);
> +    return 0;
> +}
> +__initcall(cpu_smpboot_notifier_init);

I think this notifiers should go in preinit smp to cover the case where 
a secondary CPU dies beforehand the initcall.

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-04-30 15:55 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-27 17:12 [PATCH v3 00/10] xen/arm64: Suspend preconditions and CPU hotplug fixes Mirela Simonovic
2018-04-27 17:12 ` [PATCH v3 01/10] xen/arm64: Added handling of the trapped access to OSLSR register Mirela Simonovic
2018-04-27 17:12 ` [PATCH v3 02/10] xen/arm: Ignore write to GICD_ISACTIVERn registers (vgic-v2) Mirela Simonovic
2018-04-30 14:32   ` Julien Grall
2018-04-27 17:12 ` [PATCH v3 03/10] xen/arm: Implement CPU_OFF PSCI call (physical interface) Mirela Simonovic
2018-04-30 14:36   ` Julien Grall
2018-04-27 17:12 ` [PATCH v3 04/10] xen/arm: Remove __initdata and __init to enable CPU hotplug Mirela Simonovic
2018-04-27 17:12 ` [PATCH v3 05/10] xen/arm: Setup virtual paging for non-boot CPUs on hotplug/resume Mirela Simonovic
2018-04-30 14:47   ` Julien Grall
2018-05-07 14:55     ` Mirela Simonovic
2018-05-08 14:14       ` Julien Grall
2018-05-08 14:28         ` Mirela Simonovic
2018-05-09 10:32           ` Julien Grall
2018-04-27 17:12 ` [PATCH v3 06/10] xen/common: Restore IRQ affinity when hotplugging a pCPU Mirela Simonovic
2018-05-10  7:33   ` Dario Faggioli
2018-04-27 17:12 ` [PATCH v3 07/10] xen/arm: Release maintenance interrupt when CPU is hot-unplugged Mirela Simonovic
2018-04-30 14:51   ` Julien Grall
2018-04-27 17:12 ` [PATCH v3 08/10] xen/arm: Release timer interrupts " Mirela Simonovic
2018-04-30 15:58   ` Julien Grall
2018-05-07 15:33     ` Mirela Simonovic
2018-04-27 17:12 ` [PATCH v3 09/10] xen/arm: Free memory allocated for sibling/core maps on CPU hot-unplug Mirela Simonovic
2018-04-30 15:55   ` Julien Grall [this message]
2018-04-27 17:12 ` [PATCH v3 10/10] xen/arm: Enable errata for secondary CPU on hotplug after the boot Mirela Simonovic
2018-04-30 16:09   ` Julien Grall
2018-05-09 15:48     ` Mirela Simonovic
2018-05-09 16:32       ` Julien Grall
2018-05-10 11:57         ` Mirela Simonovic
2018-05-10 13:24           ` Mirela Simonovic
2018-05-10 13:29             ` Julien Grall
2018-05-10 14:12               ` Mirela Simonovic
2018-05-10 14:35                 ` Julien Grall
2018-05-10 14:25             ` Dario Faggioli
2018-05-10 15:00               ` Mirela Simonovic
2018-05-10 15:13                 ` Julien Grall
2018-05-10 15:49                   ` Mirela Simonovic
2018-05-10 16:02                     ` Julien Grall
2018-05-10 16:21                       ` Dario Faggioli
2018-05-10 16:24                     ` Dario Faggioli
2018-05-11 10:41                       ` Mirela Simonovic
2018-05-11 10:54                         ` Julien Grall
2018-05-11 12:07                           ` Mirela Simonovic
2018-05-11 12:20                             ` Mirela Simonovic
2018-05-11 13:08                               ` Julien Grall
2018-05-11 13:31                                 ` Dario Faggioli
     [not found]                                   ` <CAKPH-Nj2znmdcjZEfFf83WmrcBS_u4R33yPOxAPWw37RHVZ38g@mail.gmail.com>
2018-05-11 14:14                                     ` Dario Faggioli
2018-05-11 21:47                                   ` Stefano Stabellini
2018-05-14  9:44                                     ` Julien Grall
2018-05-14 16:59                                       ` Stefano Stabellini
2018-05-15 11:45                                         ` Mirela Simonovic
2018-05-11 13:12                           ` Dario Faggioli
2018-05-11 13:01                         ` Dario Faggioli
2018-05-10 16:12                   ` Dario Faggioli
2018-05-10 13:33           ` Dario Faggioli

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=1e0f0a39-d1a9-f543-5806-a598962ba98f@arm.com \
    --to=julien.grall@arm.com \
    --cc=dm@aggios.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=mirela.simonovic@aggios.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xen.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.