|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] 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>
--- 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) \
--- 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(st
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)
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |