Re: [PATCH v7 7/8] accel/amdxdna: Use hmm_range_fault_unlocked_timeout() for range population
From: Jason Gunthorpe
Date: Fri Jul 10 2026 - 12:48:53 EST
On Tue, Jul 07, 2026 at 12:47:36PM -0700, Stanislav Kinsburskii wrote:
> aie2_populate_range() takes mmap_read_lock() only around hmm_range_fault().
> It keeps a single HMM_RANGE_DEFAULT_TIMEOUT deadline for the populate pass
> and retries -EBUSY until that deadline expires.
>
> Use hmm_range_fault_unlocked_timeout() instead. The HMM helper now owns
> the mmap lock and refreshes mapp->range.notifier_seq for its internal
> retries. Pass the remaining jiffies from the existing deadline to HMM,
> while preserving the driver's existing outer loop for interval invalidation
> retries and for selecting the next invalid mapping.
>
> Keep returning -ETIME when the retry budget expires, matching the driver's
> existing timeout error convention.
>
> Signed-off-by: Stanislav Kinsburskii <skinsburskii@xxxxxxxxx>
> ---
> drivers/accel/amdxdna/aie2_ctx.c | 17 +++--------------
> 1 file changed, 3 insertions(+), 14 deletions(-)
Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
Jason