|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 2/5] xen/sched: rtds: enforce admission control in xl sched-rtds
On 14.09.2026 11:16, Juergen Gross wrote:
> On 26.08.26 06:57, Furkan Caliskan wrote:
>> --- a/xen/common/sched/rt.c
>> +++ b/xen/common/sched/rt.c
>> @@ -1527,11 +1527,43 @@ rt_dom_cntl(
>> op->u.rtds.budget = RTDS_DEFAULT_BUDGET / MICROSECS(1);
>> break;
>> case XEN_DOMCTL_SCHEDOP_putinfo:
>> + {
>> + uint64_t dom_old_util = 0, new_util, new_total;
>> + unsigned int nr_units = 0;
>> +
>> rc = rt_validate_params(&op->u.rtds, &period, &budget);
>> if ( rc )
>> break;
>>
>> + new_util = rt_unit_utilization(period, budget);
>> +
>> spin_lock_irqsave(&prv->lock, flags);
>> +
>> + /*
>> + * Same (period, budget) for every unit of d: test and commit
>> + * the domain's whole utilization delta atomically, rather
>> + * than unit-by-unit, which could spuriously reject an
>> + * overall-acceptable change depending on iteration order.
>> + */
>> + for_each_sched_unit ( d, unit )
>> + {
>> + svc = rt_unit(unit);
>> + dom_old_util += rt_unit_utilization(svc->period, svc->budget);
>> + nr_units++;
>> + }
>> +
>> + new_total = prv->utilization - dom_old_util +
>> + (uint64_t)nr_units * new_util;
>> +
>> + if ( new_total > prv->utilization && new_total >
>> rt_utilization_cap(d) )
>> + {
>> + rc = -EINVAL;
>
> Is EINVAL a good choice here? I think a different error code might be wanted.
>
>> + spin_unlock_irqrestore(&prv->lock, flags);
>> + break;
>> + }
Additionally please unlock first, then set rc. The compiler may do such a
rearrangement, but it also may not.
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |