Subject: Re: [PATCHv9 RFC 1/3] Break up monolithic iommu table/lock into finer graularity pools and lock

From: Benjamin Herrenschmidt <[email-masked]>
Date: Sun, 05 Apr 2015 22:26:01 +1000

On Sun, 2015-04-05 at 07:49 -0400, Sowmini Varadhan wrote:
> +               if (likely(pass == 0)) {
> +                       /* First failure, rescan from the beginning.
> */
> +                       pool->hint = pool->start;
> +                       set_flush(iommu);
> +                       pass++;
> +                       goto again;
> +               } else if (!largealloc && pass <= iommu->nr_pools) {
> +                       spin_unlock(&(pool->lock));
> +                       pool_nr = (pool_nr + 1) & (iommu->nr_pools -
> 1);
> +                       pool = &(iommu->pools[pool_nr]);
> +                       spin_lock(&(pool->lock));
> +                       pool->hint = pool->start;
> +                       set_flush(iommu);
> +                       pass++;
> +                       goto again;

So you decided to keep the logic here that updates the hint instead of
just getting rid of need_flush alltogether ?

Out of curiosity, what's the rationale ? Did you find a reason why
resetting the hint in those two cases (rather than just setting "start"
appropriately) is actually useful ?

Cheers,
Ben.