|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC PATCH 3/7] common: Introduce needs_tlb_flush vcpu field
This field is meant to be used to schedule a TLB flush on the vCPU
before waking it up. This field can be set from another vCPU at any
time.
Schedule a TLB flush when the vCPU is migrated to another CPU.
This is needed as the vCPU-related TLB entries may be out of sync
with what happened on another core.
Currently, no architecture use this mechanism, but it is meant to
be used as a way to schedule a TLB flush on the vCPU.
Signed-off-by: Teddy Astie <teddy.astie@xxxxxxxxxx>
---
xen/common/sched/core.c | 5 +++++
xen/include/xen/sched.h | 2 ++
2 files changed, 7 insertions(+)
diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index a57d5dd929..f8e615b3af 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -1188,7 +1188,12 @@ static void sched_unit_migrate_finish(struct sched_unit
*unit)
/* Wake on new CPU. */
for_each_sched_unit_vcpu ( unit, v )
+ {
+ if ( old_cpu != new_cpu )
+ /* Migrating to another CPU needs TLB flush */
+ v->needs_tlb_flush = true;
vcpu_wake(v);
+ }
}
static bool sched_check_affinity_broken(const struct sched_unit *unit)
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 4b8ae21b51..a26c571015 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -224,6 +224,8 @@ struct vcpu
bool defer_shutdown;
/* VCPU is paused following shutdown request (d->is_shutting_down)? */
bool paused_for_shutdown;
+ /* VCPU needs its TLB flushed before waking. */
+ bool needs_tlb_flush;
/* VCPU need affinity restored */
uint8_t affinity_broken;
#define VCPU_AFFINITY_OVERRIDE 0x01
--
2.52.0
--
Teddy Astie | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |