xen/events: Convert to hotplug state machine
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> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
This commit is contained in:

committed by
David Vrabel

parent
4d737042d6
commit
c8761e2016
@@ -418,30 +418,18 @@ static int evtchn_fifo_alloc_control_block(unsigned cpu)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int evtchn_fifo_cpu_notification(struct notifier_block *self,
|
static int xen_evtchn_cpu_prepare(unsigned int cpu)
|
||||||
unsigned long action,
|
|
||||||
void *hcpu)
|
|
||||||
{
|
{
|
||||||
int cpu = (long)hcpu;
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
switch (action) {
|
|
||||||
case CPU_UP_PREPARE:
|
|
||||||
if (!per_cpu(cpu_control_block, cpu))
|
if (!per_cpu(cpu_control_block, cpu))
|
||||||
ret = evtchn_fifo_alloc_control_block(cpu);
|
return evtchn_fifo_alloc_control_block(cpu);
|
||||||
break;
|
return 0;
|
||||||
case CPU_DEAD:
|
|
||||||
__evtchn_fifo_handle_events(cpu, true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return ret < 0 ? NOTIFY_BAD : NOTIFY_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct notifier_block evtchn_fifo_cpu_notifier = {
|
static int xen_evtchn_cpu_dead(unsigned int cpu)
|
||||||
.notifier_call = evtchn_fifo_cpu_notification,
|
{
|
||||||
};
|
__evtchn_fifo_handle_events(cpu, true);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int __init xen_evtchn_fifo_init(void)
|
int __init xen_evtchn_fifo_init(void)
|
||||||
{
|
{
|
||||||
@@ -456,7 +444,9 @@ int __init xen_evtchn_fifo_init(void)
|
|||||||
|
|
||||||
evtchn_ops = &evtchn_ops_fifo;
|
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:
|
out:
|
||||||
put_cpu();
|
put_cpu();
|
||||||
return ret;
|
return ret;
|
||||||
|
@@ -22,6 +22,7 @@ enum cpuhp_state {
|
|||||||
CPUHP_SMPCFD_PREPARE,
|
CPUHP_SMPCFD_PREPARE,
|
||||||
CPUHP_RCUTREE_PREP,
|
CPUHP_RCUTREE_PREP,
|
||||||
CPUHP_XEN_PREPARE,
|
CPUHP_XEN_PREPARE,
|
||||||
|
CPUHP_XEN_EVTCHN_PREPARE,
|
||||||
CPUHP_NOTIFY_PREPARE,
|
CPUHP_NOTIFY_PREPARE,
|
||||||
CPUHP_TIMERS_DEAD,
|
CPUHP_TIMERS_DEAD,
|
||||||
CPUHP_BRINGUP_CPU,
|
CPUHP_BRINGUP_CPU,
|
||||||
|
Reference in New Issue
Block a user