2019-09-07 14:00:32

by Daniel Vetter

[permalink] [raw]
Subject: [PATCH] mm, notifier: Fix early return case for new lockdep annotations

I missed that when extending the lockdep annotations to the
nonblocking case.

I missed this while testing since in the i915 mmu notifiers is hitting
a nice lockdep splat already before the point of going into oom killer
mode :-/

Reported-by: [email protected]
Fixes: d2b219ed03d4 ("mm/mmu_notifiers: add a lockdep map for invalidate_range_start/end")
Cc: Jason Gunthorpe <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: "Jérôme Glisse" <[email protected]>
Cc: Ralph Campbell <[email protected]>
Cc: Jason Gunthorpe <[email protected]>
Cc: Ira Weiny <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: Sean Christopherson <[email protected]>
Cc: Jean-Philippe Brucker <[email protected]>
Cc: [email protected]
Signed-off-by: Daniel Vetter <[email protected]>
---
include/linux/mmu_notifier.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index 5a03417e5bf7..4edd98b06834 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -356,13 +356,14 @@ mmu_notifier_invalidate_range_start(struct mmu_notifier_range *range)
static inline int
mmu_notifier_invalidate_range_start_nonblock(struct mmu_notifier_range *range)
{
+ int ret = 0;
lock_map_acquire(&__mmu_notifier_invalidate_range_start_map);
if (mm_has_notifiers(range->mm)) {
range->flags &= ~MMU_NOTIFIER_RANGE_BLOCKABLE;
- return __mmu_notifier_invalidate_range_start(range);
+ ret = __mmu_notifier_invalidate_range_start(range);
}
lock_map_release(&__mmu_notifier_invalidate_range_start_map);
- return 0;
+ return ret;
}

static inline void
--
2.23.0


2019-09-08 07:21:50

by John Hubbard

[permalink] [raw]
Subject: Re: [PATCH] mm, notifier: Fix early return case for new lockdep annotations

On 9/6/19 10:47 AM, Daniel Vetter wrote:
> I missed that when extending the lockdep annotations to the
> nonblocking case.
>
> I missed this while testing since in the i915 mmu notifiers is hitting
> a nice lockdep splat already before the point of going into oom killer
> mode :-/
>
> Reported-by: [email protected]
> Fixes: d2b219ed03d4 ("mm/mmu_notifiers: add a lockdep map for invalidate_range_start/end")
> Cc: Jason Gunthorpe <[email protected]>
> Cc: Daniel Vetter <[email protected]>
> Cc: Andrew Morton <[email protected]>
> Cc: "Jérôme Glisse" <[email protected]>
> Cc: Ralph Campbell <[email protected]>
> Cc: Jason Gunthorpe <[email protected]>
> Cc: Ira Weiny <[email protected]>
> Cc: Michal Hocko <[email protected]>
> Cc: Daniel Vetter <[email protected]>
> Cc: Sean Christopherson <[email protected]>
> Cc: Jean-Philippe Brucker <[email protected]>
> Cc: [email protected]
> Signed-off-by: Daniel Vetter <[email protected]>
> ---
> include/linux/mmu_notifier.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
> index 5a03417e5bf7..4edd98b06834 100644
> --- a/include/linux/mmu_notifier.h
> +++ b/include/linux/mmu_notifier.h
> @@ -356,13 +356,14 @@ mmu_notifier_invalidate_range_start(struct mmu_notifier_range *range)
> static inline int
> mmu_notifier_invalidate_range_start_nonblock(struct mmu_notifier_range *range)
> {
> + int ret = 0;
> lock_map_acquire(&__mmu_notifier_invalidate_range_start_map);
> if (mm_has_notifiers(range->mm)) {
> range->flags &= ~MMU_NOTIFIER_RANGE_BLOCKABLE;
> - return __mmu_notifier_invalidate_range_start(range);
> + ret = __mmu_notifier_invalidate_range_start(range);
> }
> lock_map_release(&__mmu_notifier_invalidate_range_start_map);
> - return 0;
> + return ret;
> }
>
> static inline void
>

Reviewed-by: John Hubbard <[email protected]>


thanks,
--
John Hubbard
NVIDIA

2019-09-08 15:05:15

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: [PATCH] mm, notifier: Fix early return case for new lockdep annotations

On Fri, Sep 06, 2019 at 07:47:30PM +0200, Daniel Vetter wrote:

> diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
> index 5a03417e5bf7..4edd98b06834 100644
> +++ b/include/linux/mmu_notifier.h
> @@ -356,13 +356,14 @@ mmu_notifier_invalidate_range_start(struct mmu_notifier_range *range)
> static inline int
> mmu_notifier_invalidate_range_start_nonblock(struct mmu_notifier_range *range)
> {
> + int ret = 0;
> lock_map_acquire(&__mmu_notifier_invalidate_range_start_map);
> if (mm_has_notifiers(range->mm)) {
> range->flags &= ~MMU_NOTIFIER_RANGE_BLOCKABLE;
> - return __mmu_notifier_invalidate_range_start(range);
> + ret = __mmu_notifier_invalidate_range_start(range);
> }
> lock_map_release(&__mmu_notifier_invalidate_range_start_map);
> - return 0;
> + return ret;

Gar, yes. Since nobody has grabbed hmm.git I've squashed this into the
original patch and fixed the checkpatch warning about missing line
after the ret

Everything should be in linux-next the next time it builds

Thanks,
Jason

2019-09-09 15:04:57

by David Hildenbrand

[permalink] [raw]
Subject: Re: [PATCH] mm, notifier: Fix early return case for new lockdep annotations

On 06.09.19 19:47, Daniel Vetter wrote:
> I missed that when extending the lockdep annotations to the
> nonblocking case.
>
> I missed this while testing since in the i915 mmu notifiers is hitting
> a nice lockdep splat already before the point of going into oom killer
> mode :-/
>
> Reported-by: [email protected]
> Fixes: d2b219ed03d4 ("mm/mmu_notifiers: add a lockdep map for invalidate_range_start/end")
> Cc: Jason Gunthorpe <[email protected]>
> Cc: Daniel Vetter <[email protected]>
> Cc: Andrew Morton <[email protected]>
> Cc: "Jérôme Glisse" <[email protected]>
> Cc: Ralph Campbell <[email protected]>
> Cc: Jason Gunthorpe <[email protected]>
> Cc: Ira Weiny <[email protected]>
> Cc: Michal Hocko <[email protected]>
> Cc: Daniel Vetter <[email protected]>
> Cc: Sean Christopherson <[email protected]>
> Cc: Jean-Philippe Brucker <[email protected]>
> Cc: [email protected]
> Signed-off-by: Daniel Vetter <[email protected]>
> ---
> include/linux/mmu_notifier.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
> index 5a03417e5bf7..4edd98b06834 100644
> --- a/include/linux/mmu_notifier.h
> +++ b/include/linux/mmu_notifier.h
> @@ -356,13 +356,14 @@ mmu_notifier_invalidate_range_start(struct mmu_notifier_range *range)
> static inline int
> mmu_notifier_invalidate_range_start_nonblock(struct mmu_notifier_range *range)
> {
> + int ret = 0;
> lock_map_acquire(&__mmu_notifier_invalidate_range_start_map);
> if (mm_has_notifiers(range->mm)) {
> range->flags &= ~MMU_NOTIFIER_RANGE_BLOCKABLE;
> - return __mmu_notifier_invalidate_range_start(range);
> + ret = __mmu_notifier_invalidate_range_start(range);
> }
> lock_map_release(&__mmu_notifier_invalidate_range_start_map);
> - return 0;
> + return ret;
> }
>
> static inline void
>

Reviewed-by: David Hildenbrand <[email protected]>

--

Thanks,

David / dhildenb