intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jerome Glisse <jglisse@redhat.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: kvm@vger.kernel.org, "Radim Krčmář" <rkrcmar@redhat.com>,
	"Tetsuo Handa" <penguin-kernel@i-love.sakura.ne.jp>,
	"Sudeep Dutt" <sudeep.dutt@intel.com>,
	dri-devel@lists.freedesktop.org, linux-mm@kvack.org,
	"Felix Kuehling" <felix.kuehling@amd.com>,
	"Andrea Arcangeli" <aarcange@redhat.com>,
	"David (ChunMing) Zhou" <David1.Zhou@amd.com>,
	"Dimitri Sivanich" <sivanich@sgi.com>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	linux-rdma@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	"David Airlie" <airlied@linux.ie>,
	"Doug Ledford" <dledford@redhat.com>,
	"David Rientjes" <rientjes@google.com>,
	xen-devel@lists.xenproject.org, intel-gfx@lists.freedesktop.org,
	"Leon Romanovsky" <leonro@mellanox.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
	"Juergen Gross" <jgross@suse.com>,
	"Mike Marciniszyn" <mike.marciniszyn@intel.com>
Subject: Re: [PATCH] mm, oom: distinguish blockable mode for mmu notifiers
Date: Fri, 24 Aug 2018 11:08:59 -0400	[thread overview]
Message-ID: <20180824150858.GB4244@redhat.com> (raw)
In-Reply-To: <20180824123341.GN29735@dhcp22.suse.cz>

On Fri, Aug 24, 2018 at 02:33:41PM +0200, Michal Hocko wrote:
> On Fri 24-08-18 14:18:44, Christian König wrote:
> > Am 24.08.2018 um 14:03 schrieb Michal Hocko:
> > > On Fri 24-08-18 13:57:52, Christian König wrote:
> > > > Am 24.08.2018 um 13:52 schrieb Michal Hocko:
> > > > > On Fri 24-08-18 13:43:16, Christian König wrote:
> > > [...]
> > > > > > That won't work like this there might be multiple
> > > > > > invalidate_range_start()/invalidate_range_end() pairs open at the same time.
> > > > > > E.g. the lock might be taken recursively and that is illegal for a
> > > > > > rw_semaphore.
> > > > > I am not sure I follow. Are you saying that one invalidate_range might
> > > > > trigger another one from the same path?
> > > > No, but what can happen is:
> > > > 
> > > > invalidate_range_start(A,B);
> > > > invalidate_range_start(C,D);
> > > > ...
> > > > invalidate_range_end(C,D);
> > > > invalidate_range_end(A,B);
> > > > 
> > > > Grabbing the read lock twice would be illegal in this case.
> > > I am sorry but I still do not follow. What is the context the two are
> > > called from?
> > 
> > I don't have the slightest idea.
> > 
> > > Can you give me an example. I simply do not see it in the
> > > code, mostly because I am not familiar with it.
> > 
> > I'm neither.
> > 
> > We stumbled over that by pure observation and after discussing the problem
> > with Jerome came up with this solution.
> > 
> > No idea where exactly that case comes from, but I can confirm that it indeed
> > happens.
> 
> Thiking about it some more, I can imagine that a notifier callback which
> performs an allocation might trigger a memory reclaim and that in turn
> might trigger a notifier to be invoked and recurse. But notifier
> shouldn't really allocate memory. They are called from deep MM code
> paths and this would be extremely deadlock prone. Maybe Jerome can come
> up some more realistic scenario. If not then I would propose to simplify
> the locking here. We have lockdep to catch self deadlocks and it is
> always better to handle a specific issue rather than having a code
> without a clear indication how it can recurse.

Multiple concurrent mmu notifier, for overlapping range or not, is
common (each concurrent threads can trigger some). So you might have
multiple invalidate_range_start() in flight for same mm and thus might
complete in different order (invalidate_range_end()). IIRC this is
what this lock was trying to protect against.

I can't think of a reason for recursive mmu notifier call right now.
I will ponder see if i remember something about it.

Cheers,
Jérôme
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-08-24 15:08 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16 11:50 [PATCH] mm, oom: distinguish blockable mode for mmu notifiers Michal Hocko
2018-07-16 12:24 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev7) Patchwork
2018-07-16 23:12 ` [PATCH] mm, oom: distinguish blockable mode for mmu notifiers Andrew Morton
2018-07-17  4:03   ` Leon Romanovsky
2018-07-17  8:12   ` Michal Hocko
2018-07-20 23:01     ` Andrew Morton
2018-07-23  8:43       ` Michal Hocko
     [not found] ` <20180716115058.5559-1-mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-07-19  9:12   ` Michal Hocko
2018-07-21  0:09 ` Andrew Morton
     [not found]   ` <20180720170902.d1137060c23802d55426aa03-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2018-07-23  7:03     ` Michal Hocko
2018-07-23  7:11       ` Michal Hocko
2018-07-23  8:11         ` Michal Hocko
2018-07-24 14:17     ` Michal Hocko
2018-07-24 19:53       ` Andrew Morton
2018-07-25  6:17         ` Michal Hocko
2018-07-24 21:07       ` David Rientjes
2018-07-25  6:13         ` Michal Hocko
2018-07-24 14:33 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev8) Patchwork
2018-07-25 15:08 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev9) Patchwork
2018-08-24 10:54 ` [PATCH] mm, oom: distinguish blockable mode for mmu notifiers Tetsuo Handa
2018-08-24 11:32   ` Michal Hocko
     [not found]     ` <20180824113248.GH29735-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2018-08-24 11:43       ` Christian König
     [not found]         ` <b088e382-e90e-df63-a079-19b2ae2b985d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-08-24 11:52           ` Michal Hocko
     [not found]             ` <20180824115226.GK29735-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2018-08-24 11:57               ` Christian König
2018-08-24 12:03                 ` Michal Hocko
     [not found]                   ` <20180824120339.GL29735-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2018-08-24 12:18                     ` Christian König
     [not found]                       ` <eb546bcb-9c5f-7d5d-43a7-bfde489f0e7f-5C7GfCeVMHo@public.gmane.org>
2018-08-24 12:33                         ` Michal Hocko
2018-08-24 12:52                           ` Christian König
     [not found]                             ` <b11df415-baf8-0a41-3c16-60dfe8d32bd3-5C7GfCeVMHo@public.gmane.org>
2018-08-24 13:01                               ` Michal Hocko
2018-08-24 13:10                                 ` Christian König
2018-08-24 13:24                                   ` Michal Hocko
2018-08-24 13:28                                     ` Christian König
2018-08-24 13:40                                       ` Michal Hocko
2018-08-24 13:44                                         ` Christian König
2018-08-24 13:52                                           ` Michal Hocko
2018-08-26  8:40                                             ` Tetsuo Handa
     [not found]                                               ` <b78f8b3a-7bc6-0dea-6752-5ea798eccb6b-1yMVhJb1mP/7nzcFbJAaVXf5DAMn2ifp@public.gmane.org>
2018-08-27  7:41                                                 ` Christian König
2018-09-06 22:46                                                   ` Tetsuo Handa
2018-08-24 15:08                           ` Jerome Glisse [this message]
     [not found]   ` <8cbfb09f-0c5a-8d43-1f5e-f3ff7612e289-JPay3/Yim36HaxMnTkn67Xf5DAMn2ifp@public.gmane.org>
2018-08-24 11:36     ` Michal Hocko
2018-08-24 13:02       ` Tetsuo Handa
     [not found]         ` <103b1b33-1a1d-27a1-dcf8-5c8ad60056a6-1yMVhJb1mP/7nzcFbJAaVXf5DAMn2ifp@public.gmane.org>
2018-08-24 13:32           ` Michal Hocko
2018-08-24 14:52             ` Tetsuo Handa
2018-08-24 15:12               ` Jerome Glisse
2018-08-24 16:40                 ` Michal Hocko
2018-08-24 17:33                   ` Jerome Glisse
2018-08-24 16:38               ` Michal Hocko
2018-08-24 14:40   ` Jerome Glisse
2018-08-24 11:47 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev10) Patchwork
2018-08-24 13:32 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev11) Patchwork
2018-08-24 13:43 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev12) Patchwork
2018-08-24 13:53 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev13) Patchwork
2018-08-24 17:04 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev14) Patchwork
2018-08-26  8:42 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev15) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180824150858.GB4244@redhat.com \
    --to=jglisse@redhat.com \
    --cc=David1.Zhou@amd.com \
    --cc=aarcange@redhat.com \
    --cc=airlied@linux.ie \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=dledford@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=felix.kuehling@amd.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jgg@ziepe.ca \
    --cc=jgross@suse.com \
    --cc=kvm@vger.kernel.org \
    --cc=leonro@mellanox.com \
    --cc=linux-mm@kvack.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mhocko@kernel.org \
    --cc=mike.marciniszyn@intel.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=rientjes@google.com \
    --cc=rkrcmar@redhat.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sivanich@sgi.com \
    --cc=sudeep.dutt@intel.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).