Re: [PATCH v2 12/11] mm/hmm: Fix error flows in hmm_invalidate_range_start

2019-06-09 Thread Jason Gunthorpe
On Fri, Jun 07, 2019 at 04:52:58PM -0700, Ralph Campbell wrote: > > @@ -141,6 +142,23 @@ static void hmm_release(struct mmu_notifier *mn, > > struct mm_struct *mm) > > hmm_put(hmm); > > } > > +static void notifiers_decrement(struct hmm *hmm) > > +{ > > + lockdep_assert_held(>ranges_lock);

[PATCH v2 12/11] mm/hmm: Fix error flows in hmm_invalidate_range_start

2019-06-09 Thread Jason Gunthorpe
If the trylock on the hmm->mirrors_sem fails the function will return without decrementing the notifiers that were previously incremented. Since the caller will not call invalidate_range_end() on EAGAIN this will result in notifiers becoming permanently incremented and deadlock. If the

Re: [PATCH v2 12/11] mm/hmm: Fix error flows in hmm_invalidate_range_start

2019-06-09 Thread Ralph Campbell
On 6/7/19 9:05 AM, Jason Gunthorpe wrote: If the trylock on the hmm->mirrors_sem fails the function will return without decrementing the notifiers that were previously incremented. Since the caller will not call invalidate_range_end() on EAGAIN this will result in notifiers becoming permanently