Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1462832 > unrolled thread
| Started by | Boris Ostrovsky <boris.ostrovsky@oracle.com> |
|---|---|
| First post | 2016-08-15 16:40 +0200 |
| Last post | 2016-08-15 18:00 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/2] xen/events: Convert to hotplug state machine Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-08-15 16:40 +0200
Re: [Xen-devel] [PATCH 2/2] xen/events: Convert to hotplug state machine David Vrabel <david.vrabel@citrix.com> - 2016-08-15 17:10 +0200
Re: [Xen-devel] [PATCH 2/2] xen/events: Convert to hotplug state machine Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-08-15 18:00 +0200
| From | Boris Ostrovsky <boris.ostrovsky@oracle.com> |
|---|---|
| Date | 2016-08-15 16:40 +0200 |
| Subject | [PATCH 2/2] xen/events: Convert to hotplug state machine |
| Message-ID | <s6rdw-6L9-17@gated-at.bofh.it> |
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Install the callbacks via the state machine.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
Changes from Sebastian's original version:
* Renamed hotplug state from CPUHP_XEN_EV_PREPEARE to CPUHP_XEN_EVTCHN_PREPARE
* Dropped suggestion in the commit messages about moving evtchn_fifo_alloc_control_block
call since I think it is in the right place right now.
drivers/xen/events/events_fifo.c | 34 ++++++++++++----------------------
include/linux/cpuhotplug.h | 1 +
2 files changed, 13 insertions(+), 22 deletions(-)
diff --git a/drivers/xen/events/events_fifo.c b/drivers/xen/events/events_fifo.c
index 266c2c7..7ef27c6 100644
--- a/drivers/xen/events/events_fifo.c
+++ b/drivers/xen/events/events_fifo.c
@@ -418,30 +418,18 @@ static int evtchn_fifo_alloc_control_block(unsigned cpu)
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,9 @@ 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_EVTCHN_PREPARE,
+ "CPUHP_XEN_EVTCHN_PREPARE",
+ xen_evtchn_cpu_prepare, xen_evtchn_cpu_dead);
out:
put_cpu();
return ret;
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index d6beeb9..c60a17c 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -22,6 +22,7 @@ enum cpuhp_state {
CPUHP_SMPCFD_PREPARE,
CPUHP_RCUTREE_PREP,
CPUHP_XEN_PREPARE,
+ CPUHP_XEN_EVTCHN_PREPARE,
CPUHP_NOTIFY_PREPARE,
CPUHP_TIMERS_DEAD,
CPUHP_BRINGUP_CPU,
--
1.7.1
[toc] | [next] | [standalone]
| From | David Vrabel <david.vrabel@citrix.com> |
|---|---|
| Date | 2016-08-15 17:10 +0200 |
| Subject | Re: [Xen-devel] [PATCH 2/2] xen/events: Convert to hotplug state machine |
| Message-ID | <s6rGz-7aD-57@gated-at.bofh.it> |
| In reply to | #1462832 |
On 15/08/16 15:46, Boris Ostrovsky wrote:
> From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>
> Install the callbacks via the state machine.
[...]
> +static int xen_evtchn_cpu_dead(unsigned int cpu)
> +{
> + __evtchn_fifo_handle_events(cpu, true);
> + return 0;
> +}
I'm not familiar with the new state machine. When this is called, what
state is the CPU in?
In particular, local interrupts must be disabled and all non-percpu irqs
must have been migrated to other CPUs.
> int __init xen_evtchn_fifo_init(void)
> {
> @@ -456,7 +444,9 @@ 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_EVTCHN_PREPARE,
> + "CPUHP_XEN_EVTCHN_PREPARE",
> + xen_evtchn_cpu_prepare, xen_evtchn_cpu_dead);
> out:
> put_cpu();
> return ret;
> diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
> index d6beeb9..c60a17c 100644
> --- a/include/linux/cpuhotplug.h
> +++ b/include/linux/cpuhotplug.h
> @@ -22,6 +22,7 @@ enum cpuhp_state {
> CPUHP_SMPCFD_PREPARE,
> CPUHP_RCUTREE_PREP,
> CPUHP_XEN_PREPARE,
> + CPUHP_XEN_EVTCHN_PREPARE,
> CPUHP_NOTIFY_PREPARE,
> CPUHP_TIMERS_DEAD,
> CPUHP_BRINGUP_CPU,
>
[toc] | [prev] | [next] | [standalone]
| From | Boris Ostrovsky <boris.ostrovsky@oracle.com> |
|---|---|
| Date | 2016-08-15 18:00 +0200 |
| Subject | Re: [Xen-devel] [PATCH 2/2] xen/events: Convert to hotplug state machine |
| Message-ID | <s6ssV-7sK-5@gated-at.bofh.it> |
| In reply to | #1462876 |
On 08/15/2016 11:06 AM, David Vrabel wrote:
> On 15/08/16 15:46, Boris Ostrovsky wrote:
>> From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>>
>> Install the callbacks via the state machine.
> [...]
>> +static int xen_evtchn_cpu_dead(unsigned int cpu)
>> +{
>> + __evtchn_fifo_handle_events(cpu, true);
>> + return 0;
>> +}
> I'm not familiar with the new state machine. When this is called, what
> state is the CPU in?
>
> In particular, local interrupts must be disabled and all non-percpu irqs
> must have been migrated to other CPUs.
This (xen_evtchn_cpu_dead()) is called immediately after notify_dead()
on the way down.
The state machine is walking cpuhp_state list and for each member of the
list it calls the callback that has been registered for that member.
So when we bring a CPU up first we call xen_evtchn_cpu_prepare() and
then in the next iteration of the state machine loop notify_prepare()
(because CPUHP_XEN_EVTCHN_PREPARE is immediately before
CPUHP_NOTIFY_PREPARE). On the way down it's done in reverse: first
notify_dead() and then xen_evtchn_cpu_dead().
In other words, the old notification scheme is part of new state machine:
CPUHP_RCUTREE_PREP,
CPUHP_XEN_PREPARE,
+ CPUHP_XEN_EVTCHN_PREPARE,
CPUHP_NOTIFY_PREPARE, <=== CPU notifiers callback
CPUHP_TIMERS_DEAD,
CPUHP_BRINGUP_CPU,
-boris
>
>
>> int __init xen_evtchn_fifo_init(void)
>> {
>> @@ -456,7 +444,9 @@ 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_EVTCHN_PREPARE,
>> + "CPUHP_XEN_EVTCHN_PREPARE",
>> + xen_evtchn_cpu_prepare, xen_evtchn_cpu_dead);
>> out:
>> put_cpu();
>> return ret;
>> diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
>> index d6beeb9..c60a17c 100644
>> --- a/include/linux/cpuhotplug.h
>> +++ b/include/linux/cpuhotplug.h
>> @@ -22,6 +22,7 @@ enum cpuhp_state {
>> CPUHP_SMPCFD_PREPARE,
>> CPUHP_RCUTREE_PREP,
>> CPUHP_XEN_PREPARE,
>> + CPUHP_XEN_EVTCHN_PREPARE,
>> CPUHP_NOTIFY_PREPARE,
>> CPUHP_TIMERS_DEAD,
>> CPUHP_BRINGUP_CPU,
>>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web