On 20.12.2019 15:26, George Dunlap wrote:
> On 12/20/19 2:21 PM, Jan Beulich wrote:
>> In ept_p2m_type_to_flags() passing in type and access as separate
>> parameters can be considered an optimization, as all callers set the
>> respective fields in the entry being updated before the call. Retain
>> this behavior but add assertions.
>>
>> Signed-off-by: Jan Beulich <jbeul...@suse.com>
> 
> In what way is it an optimization?

There's no pointer de-ref needed; the values will already come in
via registers. And "can be considered" because possibly some
compilers are smart enough to eliminate the pointer de-ref again
(but then it'll still be a bitfield extract, which callers may
be able to avoid).

> I don't necessarily oppose this, but given that 3 of the 4 callers
> literally do something like:
> 
>     ept_p2m_type_to_flags(p2m, &e, e.sa_p2mt, e.access);
> 
> It seems like just getting rid of the extraneous arguments might a be
> better option.

That was my original intention as well, but iirc Andrew didn't like
it when we discussed it back then (the context here being XSA-304).

Jan

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

Reply via email to