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:
Andrew Cooper authored and Jan Beulich committed 2015-07-24 13:23:59 +02:00
1 parent 78222eb476
commit aace3f16d2
2 files changed
+33

No files matched your search

+28
View File
@@ -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;
+5
View File
@@ -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;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.