Re: [RFC PATCH 08/11] mm/hmm: Use lockdep instead of comments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jun 08, 2019 at 01:03:48AM +0530, Souptick Joarder wrote:
> On Thu, May 23, 2019 at 9:05 PM Jason Gunthorpe <jgg@xxxxxxxx> wrote:
> >
> > From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> >
> > So we can check locking at runtime.
> >
> > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> >  mm/hmm.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/mm/hmm.c b/mm/hmm.c
> > index 2695925c0c5927..46872306f922bb 100644
> > +++ b/mm/hmm.c
> > @@ -256,11 +256,11 @@ static const struct mmu_notifier_ops hmm_mmu_notifier_ops = {
> >   *
> >   * To start mirroring a process address space, the device driver must register
> >   * an HMM mirror struct.
> > - *
> > - * THE mm->mmap_sem MUST BE HELD IN WRITE MODE !
> >   */
> >  int hmm_mirror_register(struct hmm_mirror *mirror, struct mm_struct *mm)
> >  {
> > +       lockdep_assert_held_exclusive(mm->mmap_sem);
> > +
> 
> Gentle query, does the same required in hmm_mirror_unregister() ?

No.. The unregistration path does its actual work in the srcu
callback, which is in a different context than this function. So any
locking held by the caller of unregister will not apply.

The hmm_range_free SRCU callback obtains the write side of mmap_sem to
protect the same data that the write side above in register is
touching, mostly &mm->hmm.

Jason




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux