[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/2] xen: credit2: avoid vCPUs to ever reach lower credits than idle



On 12.03.2020 17:11, Dario Faggioli wrote:
> On Thu, 2020-03-12 at 16:26 +0100, Jan Beulich wrote:
>> Looking at t2c_update() I'm also getting the impression that
>> there's UB when the subtraction underflows. After all, if
>> -1 << 30 wasn't small enough a value, I don't see why -1 << 31
>> would be.
>>
> Mmm... not sure I am getting. Are you suggesting we should apply a cap
> to val?
> 
> If yes, this looks like an issue independent from what the value of
> CSCHED2_IDLE_CREDIT is, but yeah, we can do that. Or am I missing
> something?

Well, at the very least UB needs to be avoided, i.e. we shouldn't
subtract when the result is not representable in "credit"'s type.
But even beyond that there may be a need for the subtraction to
actually act as if it was saturating at INT_MIN. (Similarly
additions may need to saturate at INT_MAX, if there's any
possibility for those values to grow large.)

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.