On 08/07/2019 20:27, Julien Grall wrote:
> Hi,
>
> On 7/8/19 7:11 PM, Andrew Cooper wrote:
>> On 07/07/2019 19:42, Julien Grall wrote:
>>> Hi Andrew,
>>>
>>> On 7/4/19 8:14 PM, Andrew Cooper wrote:
>>>> To allow for further improvements, it is useful to be able to clear
>>>> more than
>>>> a single flag at once.  Rework gnttab_clear_flag() into
>>>> gnttab_clear_flags()
>>>> which takes a bitmask rather than a bit number.
>>>>
>>>> No practical change yet.
>>>>
>>>> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
>>>> ---
>>>> CC: Jan Beulich <jbeul...@suse.com>
>>>> CC: Wei Liu <w...@xen.org>
>>>> CC: Roger Pau Monné <roger....@citrix.com>
>>>> CC: Stefano Stabellini <sstabell...@kernel.org>
>>>> CC: Julien Grall <julien.gr...@arm.com>
>>>> CC: George Dunlap <george.dun...@eu.citrix.com>
>>>>
>>>> v2:
>>>>    * Use unsigned int for the mask parameter
>>>
>>> I don't seem to find the request on the ML. Technically the mask can
>>> only be 16-bit. May I ask the reason of this change?
>>
>> It is on the mailing list, but an orphaned email due to Jan's email
>> changes.
>
> Is it the same problem as I have seen the past 6 months between
> Juergen and Jan's e-mail?

I think its different, but I'm losing track tbh.

>
>>
>> https://lore.kernel.org/xen-devel/1561109798-8744-5-git-send-email-andrew.coop...@citrix.com/T/#t
>>
>
> To be honest, I think it is wrong to try to micro-optimize a common
> prototype for the benefit of one architecture and one compiler version
> (or even none per the e-mail).

The prototype wasn't common.  Observe that before this patch, ARM used
unsigned long while x86 used uint16_t.  It should become common, however.

In practice, we're talking about bits 3 and 4, and this isn't liable to
change in a hurry.

> One could also argue that this may be not beneficial for the non-x86
> architecture depending on how the compiler decide to do the cast from
> 32-bit to 16-bit...

All architecture necessarily suffer the downcast somewhere, even x86. 
ARM's is in the prototype for guest_clear_mask16(), but in terms of the
common logic for calculating conditionally which bits to clear, keeping
everything as unsigned int for as long as possible offers the most
flexibility to the compiler, as it can see all the constants involved.

~Andrew

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

Reply via email to