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

Re: [Xen-devel] [PATCH v11 04/23] x86: refactor psr: L3 CAT: implement main data structures, CPU init and free flows.



>>> On 31.05.17 at 04:44, <yi.y.sun@xxxxxxxxxxxxxxx> wrote:
> On 17-05-30 07:05:18, Jan Beulich wrote:
>> >>> On 03.05.17 at 10:44, <yi.y.sun@xxxxxxxxxxxxxxx> wrote:
>> > +static void free_socket_resources(unsigned int socket)
>> > +{
>> > +    unsigned int i;
>> > +    struct psr_socket_info *info = socket_info + socket;
>> > +
>> > +    if ( !info )
>> > +        return;
>> > +
>> > +    /*
>> > +     * Free resources of features. The global feature object, e.g. 
>> > feat_l3_cat,
>> > +     * may not be freed here if it is not added into array. It is simply 
>> > being
>> > +     * kept until the next CPU online attempt.
>> > +     */
>> > +    for ( i = 0; i < PSR_SOCKET_FEAT_NUM; i++ )
>> > +    {
>> > +        xfree(info->features[i]);
>> > +        info->features[i] = NULL;
>> > +    }
>> 
>> If you iterate over arrays, please use ARRAY_SIZE() as the loop
>> boundary (and without knowing whether there are similar issues
>> elsewhere in the series, please consider the comment given for
>> all of it, just like any other comments usually are meant to apply
>> to similar issues elsewhere).
>> 
> Ok, will check all loops.

And btw, as in a number of cases you're accessing to identically
dimensioned arrays, picking either one for the loop boundary is
fine provided either one of the arrays also uses ARRAY_SIZE() to
set its own size or you have suitable BUILD_BUG_ON()s in such
loops.

Jan


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

 


Rackspace

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