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

Re: [Xen-devel] [PATCH v6 06/18] vmx: Add some helper functions for Posted-Interrupts



>>> "Wu, Feng" <feng.wu@xxxxxxxxx> 09/08/15 4:39 AM >>>
>> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
>> Sent: Monday, September 07, 2015 6:46 PM
>> >>> On 06.09.15 at 04:05, <feng.wu@xxxxxxxxx> wrote:
>> >> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
>> >> Sent: Friday, September 04, 2015 10:40 PM
>> >> >>> On 25.08.15 at 03:57, <feng.wu@xxxxxxxxx> wrote:
>> >> > @@ -121,11 +122,31 @@ static inline int pi_test_and_clear_on(struct
>> >> pi_desc *pi_desc)
>> >> >      return test_and_clear_bit(POSTED_INTR_ON, &pi_desc->control);
>> >> >  }
>> >> >
>> >> > +static inline int pi_test_on(struct pi_desc *pi_desc)
>> >> > +{
>> >> > +    return test_bit(POSTED_INTR_ON, &pi_desc->control);
>> >> > +}
>> >>
>> >> For this and ...
>> >>
>> >> > +static inline int pi_test_sn(struct pi_desc *pi_desc)
>> >> > +{
>> >> > +    return test_bit(POSTED_INTR_SN, &pi_desc->control);
>> >> > +}
>> >>
>> >> ... this I wonder whether using the bitfield you defined in the
>> >> previous patch wouldn't allow the compiler more freedom in
>> >> how to carry this out.
>> >
>> > I am sorry, I don't quite understand it. Do you mean: the bitfield
>> > defined in previous patch is pointless, or using the bitfield here?
>> 
>> Use it here would seem preferable. (But please recall that I
>> questioned this two fold access model - partly using bitfields,
>> partly using bitops - earlier on, and ideally _all_ accesses to
>> a certain kind of data structure would follow a single, uniform
>> model.)
>
>Yes, I remember your suggestion about this. So now I only use
>bitops everywhere, in that case, do you think I still need to use
>bitfields here?

Then you understood only half of it: You now use the bitfield for
accessing multi-bit fields, and bitops for single-bit ones. While
certainly you can't use bitops for multi-bit fields, the corresponding
method would be masks and shifts.

Bottom line - if using a mixture, then use what allows the compiler to
generate most efficient code. And clarify for yourself whether the
modifying bitops really need to be locked ones.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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