Re: [PATCH] iommu/amd: Fix domain flush size when syncing iotlb

From: Nadav Amit
Date: Wed Apr 26 2023 - 17:23:05 EST




> On Apr 26, 2023, at 2:04 PM, Nadav Amit <namit@xxxxxxxxxx> wrote:
>
>
>
>> On Apr 26, 2023, at 1:32 PM, Jon Pan-Doh <pandoh@xxxxxxxxxx> wrote:
>>
>> When running on an AMD vIOMMU, we observed multiple invalidations (of
>> decreasing power of 2 aligned sizes) when unmapping a single page.
>>
>> Domain flush takes gather bounds (end-start) as size param. However,
>> gather->end is defined as the last inclusive address (start + size - 1).
>> This leads to an off by 1 error.
>>
>> With this patch, verified that 1 invalidation occurs when unmapping a
>> single page.
>>
>> Fixes: a270be1b3fdf ("iommu/amd: Use only natural aligned flushes in a VM")
>> Signed-off-by: Jon Pan-Doh <pandoh@xxxxxxxxxx>
>> Tested-by: Sudheer Dantuluri <dantuluris@xxxxxxxxxx>
>> Suggested-by: Gary Zibrat <gzibrat@xxxxxxxxxx>
>>
>
> Sorry for that.
>
> Acked-by: Nadav Amit <namit@xxxxxxxxxx>

P.S. I think it is stable-worthy.