Commit 928abc19 authored by Marc Zyngier's avatar Marc Zyngier Committed by zhangyuyang
Browse files

irqchip/gic-v4: Always configure affinity on VPE activation

mainline inclusion
from mainline-v6.11-rc1
commit 7d2c2048a86477461f7bc75d064579ed349472bc
category: other
bugzilla: https://gitee.com/openeuler/kernel/issues/IAVK49

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7d2c2048a86477461f7bc75d064579ed349472bc



--------------------------------------------------------------------

There are currently two paths to set the initial affinity of a VPE:

 - at activation time on GICv4 without the stupid VMOVP list, and
   on GICv4.1

 - at map time for GICv4 with VMOVP list

The latter location may end-up modifying the affinity of VPE that is
currently running, making the results unpredictible.

Instead, unify the two paths, making sure to set the initial affinity only
at activation time.

Reported-by: default avatarNianyao Tang <tangnianyao@huawei.com>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Tested-by: default avatarNianyao Tang <tangnianyao@huawei.com>
Link: https://lore.kernel.org/r/20240705093155.871070-2-maz@kernel.org


Signed-off-by: default avatarcaijian <caijian11@h-partners.com>
parent 9d5b8fe1
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -2137,13 +2137,9 @@ static void its_map_vm(struct its_node *its, struct its_vm *vm)

		for (i = 0; i < vm->nr_vpes; i++) {
			struct its_vpe *vpe = vm->vpes[i];
			struct irq_data *d = irq_get_irq_data(vpe->irq);

			/* Map the VPE to the first possible CPU */
			vpe->col_idx = cpumask_first(cpu_online_mask);
			its_send_vmapp(its, vpe, true);
			its_send_vinvall(its, vpe);
			irq_data_update_effective_affinity(d, cpumask_of(vpe->col_idx));
		}
	}

@@ -5059,6 +5055,10 @@ static int its_vpe_irq_domain_activate(struct irq_domain *domain,
	struct its_vpe *vpe = irq_data_get_irq_chip_data(d);
	struct its_node *its;

	/* Map the VPE to the first possible CPU */
	vpe->col_idx = cpumask_first(cpu_online_mask);
	irq_data_update_effective_affinity(d, cpumask_of(vpe->col_idx));

	/*
	 * If we use the list map, we issue VMAPP on demand... Unless
	 * we're on a GICv4.1 and we eagerly map the VPE on all ITSs
@@ -5067,9 +5067,6 @@ static int its_vpe_irq_domain_activate(struct irq_domain *domain,
	if (!gic_requires_eager_mapping())
		return 0;

	/* Map the VPE to the first possible CPU */
	vpe->col_idx = cpumask_first(cpu_online_mask);

	list_for_each_entry(its, &its_nodes, entry) {
		if (!is_v4(its))
			continue;
@@ -5078,8 +5075,6 @@ static int its_vpe_irq_domain_activate(struct irq_domain *domain,
		its_send_vinvall(its, vpe);
	}

	irq_data_update_effective_affinity(d, cpumask_of(vpe->col_idx));

	return 0;
}