[ofa-general] Re: [PATCH] mlx4_core: enable changing default max HCA resource limits at run time -- reposting

Jack Morgenstein jackm at dev.mellanox.co.il
Tue Apr 29 06:31:56 PDT 2008


On Tuesday 29 April 2008 09:40, Jack Morgenstein wrote:
> P.S.
> BTW, I think there is a bug in the mthca driver, which messes things
> up if the profile numbers are NOT powers of 2:
> (from mthca_make_profile, in file mthca_profile.c):
> 	for (i = 0; i < MTHCA_RES_NUM; ++i) {
> 		profile[i].type     = i;
> 		profile[i].log_num  = max(ffs(profile[i].num) - 1, 0);
> 		profile[i].size    *= profile[i].num;
> 
>   should be
> 	for (i = 0; i < MTHCA_RES_NUM; ++i) {
> 		profile[i].type     = i;
> 		profile[i].num      = roundup_pow_of_two(profile[i].num);
> 		profile[i].log_num  = ilog2(profile[i].num);
> 		profile[i].size    *= profile[i].num;
> 
> since later the procedure assumes that all sizes are powers of 2.

I was wrong -- sorry about that, Roland.
I missed the procedure __mthca_check_profile_val() in file mthca_main.c, which
does raise the profile values to the next (or same) power-of-2 value, so there
is no bug.

Still, I feel that it is much cleaner to require the user to specify a power-of-2
directly, rather than correct cases in which the user did not do so.

I'm working on a patch for ib_mthca now, on top of your 2.6.26 tree, which
will do the job.

- Jack



More information about the general mailing list