Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1460582

Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq descriptors during CPU up/down (again)

From Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Newsgroups linux.kernel
Subject Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq descriptors during CPU up/down (again)
Date 2016-08-11 16:50 +0200
Message-ID <s4ZsZ-54X-5@gated-at.bofh.it> (permalink)
References (2 earlier) <s4XKx-3Wr-15@gated-at.bofh.it> <s4YdA-4ms-29@gated-at.bofh.it> <s4YZX-4Uf-11@gated-at.bofh.it> <s4YZX-4Uf-9@gated-at.bofh.it> <s4Zjj-51o-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2016-08-11 10:30:57 [-0400], Boris Ostrovsky wrote:
> So you must have converted Xen code already then? Can you post those
> patches (not all 1285, just Xen-related, assuming there are no
> dependencies) and I'll see if I can add them to this series?

This is patch 77. I *hope* the only clash (if any) will be in
cpuhotplug.h. I did not yet retest things in terms of apply & compile.
I plan to do so within this + next week. If you want to test it right
away, please do so :)

From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Wed, 4 Nov 2015 21:06:00 +0100
Subject: [PATCH] xen: events: fifo: Convert to hotplug state machine

Install the callbacks via the state machine. In theory we could remove the
upper call evtchn_fifo_alloc_control_block() and have callback invoked for
all online CPUs but this does not reflect the currect code.

Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: xen-devel@lists.xenproject.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/xen/events/events_fifo.c |   33 +++++++++++----------------------
 include/linux/cpuhotplug.h       |    1 +
 2 files changed, 12 insertions(+), 22 deletions(-)

--- a/drivers/xen/events/events_fifo.c
+++ b/drivers/xen/events/events_fifo.c
@@ -418,30 +418,18 @@ static int evtchn_fifo_alloc_control_blo
 	return ret;
 }
 
-static int evtchn_fifo_cpu_notification(struct notifier_block *self,
-						  unsigned long action,
-						  void *hcpu)
+static int xen_evtchn_cpu_prepare(unsigned int cpu)
 {
-	int cpu = (long)hcpu;
-	int ret = 0;
-
-	switch (action) {
-	case CPU_UP_PREPARE:
-		if (!per_cpu(cpu_control_block, cpu))
-			ret = evtchn_fifo_alloc_control_block(cpu);
-		break;
-	case CPU_DEAD:
-		__evtchn_fifo_handle_events(cpu, true);
-		break;
-	default:
-		break;
-	}
-	return ret < 0 ? NOTIFY_BAD : NOTIFY_OK;
+	if (!per_cpu(cpu_control_block, cpu))
+		return evtchn_fifo_alloc_control_block(cpu);
+	return 0;
 }
 
-static struct notifier_block evtchn_fifo_cpu_notifier = {
-	.notifier_call	= evtchn_fifo_cpu_notification,
-};
+static int xen_evtchn_cpu_dead(unsigned int cpu)
+{
+	__evtchn_fifo_handle_events(cpu, true);
+	return 0;
+}
 
 int __init xen_evtchn_fifo_init(void)
 {
@@ -456,7 +444,8 @@ int __init xen_evtchn_fifo_init(void)
 
 	evtchn_ops = &evtchn_ops_fifo;
 
-	register_cpu_notifier(&evtchn_fifo_cpu_notifier);
+	cpuhp_setup_state_nocalls(CPUHP_XEN_EV_PREPEARE, "XEN_EV_PREPEARE",
+				  xen_evtchn_cpu_prepare, xen_evtchn_cpu_dead);
 out:
 	put_cpu();
 	return ret;
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -22,6 +22,7 @@ enum cpuhp_state {
 	CPUHP_SMPCFD_PREPARE,
 	CPUHP_RELAY_PREPARE,
 	CPUHP_SLAB_PREPARE,
+	CPUHP_XEN_EV_PREPEARE,
 	CPUHP_TIMERS_DEAD,
 	CPUHP_SLUB_DEAD,
 	CPUHP_MM_WRITEBACK_DEAD,


Sebastian

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq  descriptors during CPU up/down (again) Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-08-11 15:00 +0200
  Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq  descriptors during CPU up/down (again) Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-11 15:30 +0200
    Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq  descriptors during CPU up/down (again) Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-11 16:20 +0200
      Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq  descriptors during CPU up/down (again) Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-08-11 16:40 +0200
        Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq  descriptors during CPU up/down (again) Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-11 16:50 +0200
          Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq  descriptors during CPU up/down (again) Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-08-11 17:10 +0200
            Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq  descriptors during CPU up/down (again) Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-11 17:20 +0200
    Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq  descriptors during CPU up/down (again) Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-08-11 16:20 +0200

csiph-web