|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] sched: move vCPU exec state barriers
commit c3f76328d572e33029bbf413143e814b25a04cf1
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Feb 12 11:32:00 2026 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Feb 12 11:32:00 2026 +0100
sched: move vCPU exec state barriers
The barrier in vcpu_context_saved() is specifically about the clearing of
->is_running. It isn't needed when we don't clear the flag.
Furthermore, one side of the barrier being in common code, the other would
better be, too. This way, all architectures are covered (beyond any
specific needs they may have).
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
Reviewed-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
Acked-by: Julien Grall <julien@xxxxxxx>
---
xen/arch/arm/domain.c | 12 +-----------
xen/common/sched/core.c | 11 ++++++++---
2 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 2eca2b913d..94b9858ad2 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -333,17 +333,7 @@ void sync_local_execstate(void)
void sync_vcpu_execstate(struct vcpu *v)
{
- /*
- * We don't support lazy switching.
- *
- * However the context may have been saved from a remote pCPU so we
- * need a barrier to ensure it is observed before continuing.
- *
- * Per vcpu_context_saved(), the context can be observed when
- * v->is_running is false (the caller should check it before calling
- * this function).
- */
- smp_rmb();
+ /* Nothing to do -- no lazy switching */
}
#define NEXT_ARG(fmt, args) \
diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index ec2448cfa1..a57d5dd929 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -956,6 +956,9 @@ void vcpu_sleep_sync(struct vcpu *v)
while ( !vcpu_runnable(v) && v->is_running )
cpu_relax();
+ /* Sync state /after/ observing the running flag clear. */
+ smp_rmb();
+
sync_vcpu_execstate(v);
}
@@ -2308,11 +2311,13 @@ static struct sched_unit *do_schedule(struct sched_unit
*prev, s_time_t now,
static void vcpu_context_saved(struct vcpu *vprev, struct vcpu *vnext)
{
- /* Clear running flag /after/ writing context to memory. */
- smp_wmb();
-
if ( vprev != vnext )
+ {
+ /* Clear running flag /after/ writing context to memory. */
+ smp_wmb();
+
vprev->is_running = false;
+ }
}
static void unit_context_saved(struct sched_resource *sr)
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |