mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
common/domain: helpers to pause a domain while in context
For use on codepaths which would need to use domain_pause() but might be in the target domain's context. In the case that the target domain is in context, all other vcpus are paused. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com> Release-acked-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
1 parent
78222eb476
commit
aace3f16d2
2 files changed
+33
No files matched your search
@@ -1010,6 +1010,34 @@ int domain_unpause_by_systemcontroller(struct domain *d)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void domain_pause_except_self(struct domain *d)
|
||||
{
|
||||
struct vcpu *v, *curr = current;
|
||||
|
||||
if ( curr->domain == d )
|
||||
{
|
||||
for_each_vcpu( d, v )
|
||||
if ( likely(v != curr) )
|
||||
vcpu_pause(v);
|
||||
}
|
||||
else
|
||||
domain_pause(d);
|
||||
}
|
||||
|
||||
void domain_unpause_except_self(struct domain *d)
|
||||
{
|
||||
struct vcpu *v, *curr = current;
|
||||
|
||||
if ( curr->domain == d )
|
||||
{
|
||||
for_each_vcpu( d, v )
|
||||
if ( likely(v != curr) )
|
||||
vcpu_unpause(v);
|
||||
}
|
||||
else
|
||||
domain_unpause(d);
|
||||
}
|
||||
|
||||
int vcpu_reset(struct vcpu *v)
|
||||
{
|
||||
struct domain *d = v->domain;
|
||||
|
||||
@@ -804,6 +804,11 @@ static inline int domain_pause_by_systemcontroller_nosync(struct domain *d)
|
||||
{
|
||||
return __domain_pause_by_systemcontroller(d, domain_pause_nosync);
|
||||
}
|
||||
|
||||
/* domain_pause() but safe against trying to pause current. */
|
||||
void domain_pause_except_self(struct domain *d);
|
||||
void domain_unpause_except_self(struct domain *d);
|
||||
|
||||
void cpu_init(void);
|
||||
|
||||
struct scheduler;
|
||||
|
||||