[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 07/10] xen/arm: Release maintenance interrupt when CPU is hot-unplugged

Hi Mirela,

On 27/04/18 18:12, Mirela Simonovic wrote:
When a CPU is hot-unplugged the maintenance interrupt has to be
released in order to free the memory that was allocated when the CPU
was hotplugged and interrupt requested. The interrupt was requested
using request_irq() which is called from start_secondary->
init_maintenance_interrupt. With this patch the interrupt will be
released when the CPU_DYING event is received by the callback which
is added in gic.c.

Signed-off-by: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx>

CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Julien Grall <julien.grall@xxxxxxx>
Changes in v3:
-Add notifier in order to trigger releasing of the  maintenance
  interrupt when the CPU is dying.
  xen/arch/arm/gic.c | 29 +++++++++++++++++++++++++++++
  1 file changed, 29 insertions(+)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 653a815127..89abc49950 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -27,6 +27,8 @@
  #include <xen/list.h>
  #include <xen/device_tree.h>
  #include <xen/acpi.h>
+#include <xen/notifier.h>
+#include <xen/cpu.h>
  #include <asm/p2m.h>
  #include <asm/domain.h>
  #include <asm/platform.h>
@@ -462,6 +464,33 @@ int gic_iomem_deny_access(const struct domain *d)
      return gic_hw_ops->iomem_deny_access(d);
+static int cpu_gic_callback(
+    struct notifier_block *nfb, unsigned long action, void *hcpu)

Please fix the indentation.

With that:

Acked-by: Julien Grall <julien.grall@xxxxxxx>

+    switch ( action )
+    {
+    case CPU_DYING:
+        /* This is reverting the work done in init_maintenance_interrupt */

In the future we probably want to move init_maintenance_interrupt in the notifier. But that's a clean-up after this has been merged :).

+        release_irq(gic_hw_ops->info->maintenance_irq, NULL);
+        break;
+    default:
+        break;
+    }
+    return NOTIFY_DONE;
+static struct notifier_block cpu_gic_nfb = {
+    .notifier_call = cpu_gic_callback,
+static int __init cpu_gic_notifier_init(void)
+    register_cpu_notifier(&cpu_gic_nfb);
+    return 0;
   * Local variables:
   * mode: C


Julien Grall

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.