All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] mm: Check if mmu notifier callbacks are allowed to fail
@ 2019-05-20 21:39 Daniel Vetter
  2019-05-20 21:39   ` Daniel Vetter
                   ` (7 more replies)
  0 siblings, 8 replies; 25+ messages in thread
From: Daniel Vetter @ 2019-05-20 21:39 UTC (permalink / raw)
  To: DRI Development
  Cc: Intel Graphics Development, LKML, Linux MM, Daniel Vetter,
	Andrew Morton, Michal Hocko, Christian König,
	David Rientjes, Jérôme Glisse, Paolo Bonzini,
	Daniel Vetter

Just a bit of paranoia, since if we start pushing this deep into
callchains it's hard to spot all places where an mmu notifier
implementation might fail when it's not allowed to.

Inspired by some confusion we had discussing i915 mmu notifiers and
whether we could use the newly-introduced return value to handle some
corner cases. Until we realized that these are only for when a task
has been killed by the oom reaper.

An alternative approach would be to split the callback into two
versions, one with the int return value, and the other with void
return value like in older kernels. But that's a lot more churn for
fairly little gain I think.

Summary from the m-l discussion on why we want something at warning
level: This allows automated tooling in CI to catch bugs without
humans having to look at everything. If we just upgrade the existing
pr_info to a pr_warn, then we'll have false positives. And as-is, no
one will ever spot the problem since it's lost in the massive amounts
of overall dmesg noise.

v2: Drop the full WARN_ON backtrace in favour of just a pr_warn for
the problematic case (Michal Hocko).

v3: Rebase on top of Glisse's arg rework.

v4: More rebase on top of Glisse reworking everything.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: "Jérôme Glisse" <jglisse@redhat.com>
Cc: linux-mm@kvack.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 mm/mmu_notifier.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c
index ee36068077b6..c05e406a7cd7 100644
--- a/mm/mmu_notifier.c
+++ b/mm/mmu_notifier.c
@@ -181,6 +181,9 @@ int __mmu_notifier_invalidate_range_start(struct mmu_notifier_range *range)
 				pr_info("%pS callback failed with %d in %sblockable context.\n",
 					mn->ops->invalidate_range_start, _ret,
 					!mmu_notifier_range_blockable(range) ? "non-" : "");
+				if (!mmu_notifier_range_blockable(range))
+					pr_warn("%pS callback failure not allowed\n",
+						mn->ops->invalidate_range_start);
 				ret = _ret;
 			}
 		}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread
* [PATCH 0/4] mmu notifier debug checks v2
@ 2018-12-10 10:36 Daniel Vetter
  2018-12-10 10:36 ` [PATCH 4/4] mm, notifier: Add a lockdep map for invalidate_range_start Daniel Vetter
  0 siblings, 1 reply; 25+ messages in thread
From: Daniel Vetter @ 2018-12-10 10:36 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: DRI Development, LKML, linux-mm, Daniel Vetter

Hi all,

Here's v2 of my mmu notifier debug checks.

I think the last two patches could probably be extended to all callbacks,
but I'm not really clear on the exact rules. But happy to extend them if
there's interest.

This stuff helps us catch issues in the i915 mmu notifier implementation.

Thanks, Daniel

Daniel Vetter (4):
  mm: Check if mmu notifier callbacks are allowed to fail
  kernel.h: Add non_block_start/end()
  mm, notifier: Catch sleeping/blocking for !blockable
  mm, notifier: Add a lockdep map for invalidate_range_start

 include/linux/kernel.h       | 10 +++++++++-
 include/linux/mmu_notifier.h |  6 ++++++
 include/linux/sched.h        |  4 ++++
 kernel/sched/core.c          |  6 +++---
 mm/mmu_notifier.c            | 18 +++++++++++++++++-
 5 files changed, 39 insertions(+), 5 deletions(-)

-- 
2.20.0.rc1


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2019-06-19 21:20 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20 21:39 [PATCH 1/4] mm: Check if mmu notifier callbacks are allowed to fail Daniel Vetter
2019-05-20 21:39 ` [PATCH 2/4] kernel.h: Add non_block_start/end() Daniel Vetter
2019-05-20 21:39   ` Daniel Vetter
2019-05-21 14:47   ` [PATCH] " Daniel Vetter
2019-05-21 14:47     ` Daniel Vetter
2019-05-20 21:39 ` [PATCH 3/4] mm, notifier: Catch sleeping/blocking for !blockable Daniel Vetter
2019-05-21 15:32   ` Jerome Glisse
2019-05-20 21:39 ` [PATCH 4/4] mm, notifier: Add a lockdep map for invalidate_range_start Daniel Vetter
2019-05-21 15:40   ` Jerome Glisse
2019-05-21 16:00     ` Daniel Vetter
2019-05-21 16:32       ` Jerome Glisse
2019-05-20 21:46 ` ✗ Fi.CI.BAT: failure for series starting with [1/4] mm: Check if mmu notifier callbacks are allowed to fail Patchwork
2019-05-21 15:44 ` [PATCH 1/4] " Jerome Glisse
2019-06-18 15:22   ` Daniel Vetter
2019-06-18 15:22     ` Daniel Vetter
2019-06-19 16:50     ` Jason Gunthorpe
2019-06-19 19:57       ` Daniel Vetter
2019-06-19 20:13         ` Jason Gunthorpe
2019-06-19 20:18           ` Daniel Vetter
2019-06-19 20:42             ` Jason Gunthorpe
2019-06-19 21:20               ` Daniel Vetter
2019-05-21 17:54 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] mm: Check if mmu notifier callbacks are allowed to fail (rev2) Patchwork
2019-05-21 18:14 ` ✓ Fi.CI.BAT: success " Patchwork
2019-05-22 12:21 ` ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2018-12-10 10:36 [PATCH 0/4] mmu notifier debug checks v2 Daniel Vetter
2018-12-10 10:36 ` [PATCH 4/4] mm, notifier: Add a lockdep map for invalidate_range_start Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.