|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH for-4.22? 6/9] domctl: handle XEN_DOMCTL_getvcpuinfo without acquiring domctl lock
Like for XEN_DOMCTL_getdomaininfo there's no need to hold the domctl
lock for XEN_DOMCTL_getvcpuinfo. While moving the code also switch to
using domain_vcpu().
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Tentatively-acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -546,6 +546,33 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
if ( ret )
goto domctl_out_unlock_rcuonly;
+ switch ( op->cmd )
+ {
+ case XEN_DOMCTL_getvcpuinfo:
+ {
+ const struct vcpu *v;
+
+ if ( (v = domain_vcpu(d, op->u.getvcpuinfo.vcpu)) == NULL )
+ {
+ ret = -ENOENT;
+ goto domctl_out_unlock_rcuonly;
+ }
+
+ op->u.getvcpuinfo.online = !(v->pause_flags & VPF_down);
+ op->u.getvcpuinfo.blocked = !!(v->pause_flags & VPF_blocked);
+ op->u.getvcpuinfo.running = v->is_running;
+ op->u.getvcpuinfo.cpu_time = vcpu_runstate_get_running(v);
+ op->u.getvcpuinfo.cpu = v->processor;
+
+ copyback = true;
+ goto domctl_out_unlock_rcuonly;
+ }
+
+ default:
+ /* Everything else handled further up or further down. */
+ break;
+ }
+
if ( !domctl_lock_acquire() )
{
if ( d && d != dom_io )
@@ -792,28 +819,6 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
break;
}
- case XEN_DOMCTL_getvcpuinfo:
- {
- const struct vcpu *v;
-
- ret = -EINVAL;
- if ( op->u.getvcpuinfo.vcpu >= d->max_vcpus )
- break;
-
- ret = -ESRCH;
- if ( (v = d->vcpu[op->u.getvcpuinfo.vcpu]) == NULL )
- break;
-
- op->u.getvcpuinfo.online = !(v->pause_flags & VPF_down);
- op->u.getvcpuinfo.blocked = !!(v->pause_flags & VPF_blocked);
- op->u.getvcpuinfo.running = v->is_running;
- op->u.getvcpuinfo.cpu_time = vcpu_runstate_get_running(v);
- op->u.getvcpuinfo.cpu = v->processor;
- ret = 0;
- copyback = 1;
- break;
- }
-
case XEN_DOMCTL_max_mem:
{
uint64_t new_max = op->u.max_mem.max_memkb >> (PAGE_SHIFT - 10);
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |