[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] common/domain: helpers to pause a domain while in context
commit aace3f16d23a8aab93b768b4655c138ff4ba0aa9 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Fri Jul 24 13:23:59 2015 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Fri Jul 24 13:23:59 2015 +0200 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@xxxxxxxxxx> Reviewed-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx> Release-acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/common/domain.c | 28 ++++++++++++++++++++++++++++ xen/include/xen/sched.h | 5 +++++ 2 files changed, 33 insertions(+), 0 deletions(-) diff --git a/xen/common/domain.c b/xen/common/domain.c index 791166b..1b9fcfc 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -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; diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index b29d9e7..73d3bc8 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -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; -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |