|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 09/12] x86/altp2m: add remaining support routines.
On 26/06/15 17:30, Ed White wrote:
> On 06/24/2015 11:19 AM, Andrew Cooper wrote:
>> On 24/06/15 18:47, Ed White wrote:
>>>>> This looks like some hoop jumping around the assertions in
>>>>> domain_pause() and vcpu_pause().
>>>>>
>>>>> We should probably have some new helpers where the domain needs to be
>>>>> paused, possibly while in context. The current domain/vcpu_pause() are
>>>>> almost always used where it is definitely not safe to pause in context,
>>>>> hence the assertions.
>>>>>
>>> It is. I'd be happy to use new helpers, I don't feel qualified to
>>> write them.
>>>
>>> Ed
>> Something like this? Only compile tested. In the meantime, I have an
>> optimisation in mind for domain_pause() on domains with large numbers of
>> vcpus, but that will have to wait a while.
>>
>> From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>> Date: Wed, 24 Jun 2015 19:06:14 +0100
>> Subject: [PATCH] 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>
>> ---
>> xen/common/domain.c | 28 ++++++++++++++++++++++++++++
>> xen/include/xen/sched.h | 5 +++++
>> 2 files changed, 33 insertions(+)
>>
>> diff --git a/xen/common/domain.c b/xen/common/domain.c
>> index 3bc52e6..a1d27e3 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..8e1345a 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;
>>
>>
> Did you commit this to staging?
I am not a committer, so couldn't even if I wished to.
> IOW, can I apply it to my branch
> and assume it will already be in-tree when our patches are applied?
You will be the first user of the patch, and as noted, I have only
compile tested. Please take it and put it at the start of your series.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |