Re: [PATCH v8 5/8] drm/nouveau: Use hmm_range_fault_unlocked_timeout() for SVM faults

From: Stanislav Kinsburskii

Date: Fri Jul 10 2026 - 23:16:54 EST


On Fri, Jul 10, 2026 at 03:12:22PM -0700, Andrew Morton wrote:
> On Fri, 10 Jul 2026 14:26:58 -0700 Stanislav Kinsburskii <skinsburskii@xxxxxxxxx> wrote:
>
> > @@ -683,15 +683,11 @@ static int nouveau_range_fault(struct nouveau_svmm *svmm,
> > goto out;
> > }
> >
> > - range.notifier_seq = mmu_interval_read_begin(range.notifier);
> > - mmap_read_lock(mm);
> > - ret = hmm_range_fault(&range);
> > - mmap_read_unlock(mm);
> > - if (ret) {
> > - if (ret == -EBUSY)
> > - continue;
> > + ret = hmm_range_fault_unlocked_timeout(&range,
> > + max(timeout - jiffies,
> > + 1L));
>
> "1UL" here? I'd have expected min() to warn, as it likes to do.

I'm not sure... The "timeout - jiffies" can become negative.
Won't 1UL convert both of them to "UL" and thus make the comparison
overflow?

Thanks,
Stanislav