I am no expert of this code, but it looks correct to me. You might wantOn Wed, 11 Apr 2018, Mirela Simonovic wrote:
> Secondary pCPUs will be offlined on system suspend and hotplugged
> on resume. When offlining secondary CPUs all interrupts targeted
> to those CPUs will be routed to the boot CPU. The boot CPU
> is responsible for finalizing suspend procedure. All wake-up
> interrupts are therefore targeted to the boot CPU. Existing code
> was missing the restoration of interrupts affinity after
> hotplugging a CPU. This patch restores the IRQ affinity after
> a CPU is hotplugged.
>
> Signed-off-by: Mirela Simonovic <mirela.simonovic@aggios.com>
> ---
> xen/common/schedule.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/xen/common/schedule.c b/xen/common/schedule.c
> index 343ab6306e..e3956019bc 100644
> --- a/xen/common/schedule.c
> +++ b/xen/common/schedule.c
> @@ -692,6 +692,7 @@ void restore_vcpu_affinity(struct domain *d)
> for_each_vcpu ( d, v )
> {
> spinlock_t *lock;
> + bool affinity_was_broken = v->affinity_broken;
>
> ASSERT(!vcpu_runnable(v));
>
> @@ -724,6 +725,9 @@ void restore_vcpu_affinity(struct domain *d)
> lock = vcpu_schedule_lock_irq(v);
> v->processor = SCHED_OP(vcpu_scheduler(v), pick_cpu, v);
> spin_unlock_irq(lock);
> +
> + if ( affinity_was_broken )
> + sched_move_irqs(v);
> }
>
> domain_update_node_affinity(d);
to move the setting of affinity_was_broken to inside the existing if (
v->affinity_broken ) check.