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

Re: [PATCH v2 1/2] gnttab: adjust pin count overflow checks

On 15.01.2021 16:38, Andrew Cooper wrote:
> On 15/01/2021 15:14, Jan Beulich wrote:
>> It's at least odd to check counters which aren't going to be
>> incremented, resulting in failure just because prior operations may
>> have left an entry in an unusual state.
> I wouldn't say it's an unusual state.  It can happen legally when you
> map the same gref 128 times
> Why a guest would do this in normal operation is a different question.

Hence the "unusual".

> Perhaps "prior operations may have reached the refcount limit" ?

Fine with me.

>>  And it's also not helpful to
>> use open-coded literal numbers in these checks.
>> Calculate the increment values first and derive from them the mask to
>> use in the checks.
>> Also move the pin count checks ahead of the calculation of the status
>> (and for copy also sha2) pointers: They're not needed in the failure
>> cases, and this way the compiler may also have an easier time keeping
>> the variables at least transiently in registers for the subsequent uses.
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>





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