|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v3 27/39] xen/riscv: handle the case when no vCPU migration is needed
The scheduler moves a vCPU's interrupts (arch_move_irqs(), i.e.
imsic_migrate_vcpu()) ahead of context_switch() whenever the unit is
picked up by a pCPU other than the one it was assigned to, which can
already happen for a freshly created vCPU on its very first run. No IMSIC
h/w interrupt file has been mapped for such a vCPU yet, so there is
nothing to migrate: return early while its last_cpu is still CPU_NONE,
i.e. while it hasn't run.
Keep the BUG_ON() at the end of the function until imsic_migrate_vcpu() is
fully implemented, to avoid ending up with a vCPU which isn't fully migrated
to the new IMSIC interrupt file.
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
Changes in v3:
- Reword the last paragraph of the commit message: the BUG_ON() is already
present in imsic_migrate_vcpu() before this patch, so it is kept rather
than added.
- Check last_cpu against CPU_NONE instead of NR_CPUS, as that is the
value a vCPU which never ran holds now.
- Describe in the commit message how imsic_migrate_vcpu() can be called
for a vCPU which never ran, rather than referring to where the IMSIC
interrupt file gets attached.
---
Changes in v2:
- New patch.
---
---
xen/arch/riscv/imsic.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/xen/arch/riscv/imsic.c b/xen/arch/riscv/imsic.c
index c5fcdcf13b00..2f0bb29ae639 100644
--- a/xen/arch/riscv/imsic.c
+++ b/xen/arch/riscv/imsic.c
@@ -693,5 +693,15 @@ int __init vimsic_make_domu_dt_node(struct kernel_info
*kinfo,
void imsic_migrate_vcpu(struct vcpu *v)
{
+ /*
+ * The scheduler can mark a freshly created vCPU's unit as migrated and
+ * invoke this before the vCPU has ever run (see the migrated branch in
+ * schedule()). No need to do migration for such vCPUs as they aren't fully
+ * initialized (for example, context_switch() will be called after
+ * imsic_migrate_vcpu()).
+ */
+ if ( v->arch.last_cpu == CPU_NONE )
+ return;
+
BUG_ON("unimplemented");
}
--
2.55.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |