Re: [PATCH v8 5/8] drm/nouveau: Use hmm_range_fault_unlocked_timeout() for SVM faults
From: Andrew Morton
Date: Sat Jul 11 2026 - 01:48:40 EST
On Fri, 10 Jul 2026 20:16:35 -0700 Stanislav Kinsburskii <skinsburskii@xxxxxxxxx> wrote:
> 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?
`timeout' and `jiffies' are both unsigned long.