|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH for-4.22? 6/9] domctl: handle XEN_DOMCTL_getvcpuinfo without acquiring domctl lock
On 16.06.2026 10:56, Roger Pau Monné wrote:
> On Mon, Jun 15, 2026 at 04:15:12PM +0200, Jan Beulich wrote:
>> 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>
>
> Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Thanks.
>> --- 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 )
>
> Since you are moving the code anyway, I would rather do:
>
> const struct vcpu *v = domain_vcpu(d, op->u.getvcpuinfo.vcpu);
>
> if ( !v )
> ...
Ah yes, I agree.
>> + {
>> + 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;
>> + }
>
> As you are introducing this here, we might want to also move
> XEN_DOMCTL_shadow_op handling into this new switch block: with the RCU
> taken and after the xsm_domctl() call.
Indeed, as indicated yesterday in [1]. Meanwhile I have a patch ready to
include in a possible v2 of this series.
Jan
[1] https://lists.xen.org/archives/html/xen-devel/2026-06/msg00861.html
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |