linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] locking/rwsem: Fix up_read_non_owner() warning with DEBUG_RWSEMS
@ 2018-05-24 13:26 Waiman Long
  2018-06-19 23:09 ` Waiman Long
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Waiman Long @ 2018-05-24 13:26 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Thomas Gleixner
  Cc: linux-kernel, Davidlohr Bueso, Dan Williams, Arnd Bergmann,
	linux-nfs, Waiman Long

It was found that the use of up_read_non_owner() in NFS was causing
the following warning when DEBUG_RWSEMS was configured.

  DEBUG_LOCKS_WARN_ON(sem->owner != ((struct task_struct *)(1UL << 0)))

Looking into the rwsem.c file, it was discovered that the corresponding
down_read_non_owner() function was not setting the owner field properly.
This is fixed now, and the warning should be gone.

Signed-off-by: Waiman Long <longman@redhat.com>
---
 kernel/locking/rwsem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c
index bc1e507..776308d 100644
--- a/kernel/locking/rwsem.c
+++ b/kernel/locking/rwsem.c
@@ -181,6 +181,7 @@ void down_read_non_owner(struct rw_semaphore *sem)
 	might_sleep();
 
 	__down_read(sem);
+	rwsem_set_reader_owned(sem);
 }
 
 EXPORT_SYMBOL(down_read_non_owner);
-- 
1.8.3.1

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

* Re: [PATCH] locking/rwsem: Fix up_read_non_owner() warning with DEBUG_RWSEMS
  2018-05-24 13:26 [PATCH] locking/rwsem: Fix up_read_non_owner() warning with DEBUG_RWSEMS Waiman Long
@ 2018-06-19 23:09 ` Waiman Long
  2018-06-20  5:49   ` [Customers.Eckelmann] " Schenk, Gavin
  2018-06-20  9:17 ` Peter Zijlstra
  2018-06-20  9:33 ` [tip:locking/urgent] " tip-bot for Waiman Long
  2 siblings, 1 reply; 5+ messages in thread
From: Waiman Long @ 2018-06-19 23:09 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Thomas Gleixner
  Cc: linux-kernel, Davidlohr Bueso, Dan Williams, Arnd Bergmann,
	linux-nfs, Uwe Kleine-König

On 05/24/2018 09:26 PM, Waiman Long wrote:
> It was found that the use of up_read_non_owner() in NFS was causing
> the following warning when DEBUG_RWSEMS was configured.
>
>   DEBUG_LOCKS_WARN_ON(sem->owner != ((struct task_struct *)(1UL << 0)))
>
> Looking into the rwsem.c file, it was discovered that the corresponding
> down_read_non_owner() function was not setting the owner field properly.
> This is fixed now, and the warning should be gone.
>
> Signed-off-by: Waiman Long <longman@redhat.com>
> ---
>  kernel/locking/rwsem.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c
> index bc1e507..776308d 100644
> --- a/kernel/locking/rwsem.c
> +++ b/kernel/locking/rwsem.c
> @@ -181,6 +181,7 @@ void down_read_non_owner(struct rw_semaphore *sem)
>  	might_sleep();
>  tch
>  	__down_read(sem);
> +	rwsem_set_reader_owned(sem);
>  }
>  
>  EXPORT_SYMBOL(down_read_non_owner);

Since the 4.18 merge window has been closed. Can that patch be merged
upstream?

Cheers,
Longman


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

* Re: [Customers.Eckelmann] [PATCH] locking/rwsem: Fix up_read_non_owner() warning with DEBUG_RWSEMS
  2018-06-19 23:09 ` Waiman Long
@ 2018-06-20  5:49   ` Schenk, Gavin
  0 siblings, 0 replies; 5+ messages in thread
From: Schenk, Gavin @ 2018-06-20  5:49 UTC (permalink / raw)
  To: tglx, longman, peterz, mingo
  Cc: dan.j.williams, linux-kernel, u.kleine-koenig, linux-nfs, arnd, dave

Hi,

On Wed, 2018-06-20 at 07:09 +0800, Waiman Long wrote:
> On 05/24/2018 09:26 PM, Waiman Long wrote:
> > It was found that the use of up_read_non_owner() in NFS was causing
> > the following warning when DEBUG_RWSEMS was configured.
> > 
> >   DEBUG_LOCKS_WARN_ON(sem->owner != ((struct task_struct *)(1UL << 0)))
> > 
> > Looking into the rwsem.c file, it was discovered that the corresponding
> > down_read_non_owner() function was not setting the owner field properly.
> > This is fixed now, and the warning should be gone.
> > 
> > Signed-off-by: Waiman Long <longman@redhat.com>
Tested-by: Gavin Schenk <g.schenk@eckelmann.de>

This fixes my reproducible locking splat when booting with nfsroot and changing password. Thank you!

Regards
Gavin Schenk

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

* Re: [PATCH] locking/rwsem: Fix up_read_non_owner() warning with DEBUG_RWSEMS
  2018-05-24 13:26 [PATCH] locking/rwsem: Fix up_read_non_owner() warning with DEBUG_RWSEMS Waiman Long
  2018-06-19 23:09 ` Waiman Long
@ 2018-06-20  9:17 ` Peter Zijlstra
  2018-06-20  9:33 ` [tip:locking/urgent] " tip-bot for Waiman Long
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2018-06-20  9:17 UTC (permalink / raw)
  To: Waiman Long
  Cc: Ingo Molnar, Thomas Gleixner, linux-kernel, Davidlohr Bueso,
	Dan Williams, Arnd Bergmann, linux-nfs

On Thu, May 24, 2018 at 09:26:38AM -0400, Waiman Long wrote:
> It was found that the use of up_read_non_owner() in NFS was causing
> the following warning when DEBUG_RWSEMS was configured.
> 
>   DEBUG_LOCKS_WARN_ON(sem->owner != ((struct task_struct *)(1UL << 0)))
> 
> Looking into the rwsem.c file, it was discovered that the corresponding
> down_read_non_owner() function was not setting the owner field properly.
> This is fixed now, and the warning should be gone.
> 
> Signed-off-by: Waiman Long <longman@redhat.com>

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

> ---
>  kernel/locking/rwsem.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c
> index bc1e507..776308d 100644
> --- a/kernel/locking/rwsem.c
> +++ b/kernel/locking/rwsem.c
> @@ -181,6 +181,7 @@ void down_read_non_owner(struct rw_semaphore *sem)
>  	might_sleep();
>  
>  	__down_read(sem);
> +	rwsem_set_reader_owned(sem);
>  }
>  
>  EXPORT_SYMBOL(down_read_non_owner);
> -- 
> 1.8.3.1
> 

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

* [tip:locking/urgent] locking/rwsem: Fix up_read_non_owner() warning with DEBUG_RWSEMS
  2018-05-24 13:26 [PATCH] locking/rwsem: Fix up_read_non_owner() warning with DEBUG_RWSEMS Waiman Long
  2018-06-19 23:09 ` Waiman Long
  2018-06-20  9:17 ` Peter Zijlstra
@ 2018-06-20  9:33 ` tip-bot for Waiman Long
  2 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Waiman Long @ 2018-06-20  9:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: dave, arnd, linux-kernel, g.schenk, peterz, tglx, longman, mingo,
	hpa, dan.j.williams

Commit-ID:  03eeafdd9ab06a770d42c2b264d50dff7e2f4eee
Gitweb:     https://git.kernel.org/tip/03eeafdd9ab06a770d42c2b264d50dff7e2f4eee
Author:     Waiman Long <longman@redhat.com>
AuthorDate: Thu, 24 May 2018 09:26:38 -0400
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 20 Jun 2018 11:29:23 +0200

locking/rwsem: Fix up_read_non_owner() warning with DEBUG_RWSEMS

It was found that the use of up_read_non_owner() in NFS was causing
the following warning when DEBUG_RWSEMS was configured.

  DEBUG_LOCKS_WARN_ON(sem->owner != ((struct task_struct *)(1UL << 0)))

Looking into the rwsem.c file, it was discovered that the corresponding
down_read_non_owner() function was not setting the owner field properly.
This is fixed now, and the warning should be gone.

Fixes: 5149cbac4235 ("locking/rwsem: Add DEBUG_RWSEMS to look for lock/unlock mismatches")
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Gavin Schenk <g.schenk@eckelmann.de>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-nfs@vger.kernel.org
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/1527168398-4291-1-git-send-email-longman@redhat.com

---
 kernel/locking/rwsem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c
index bc1e507be9ff..776308d2fa9e 100644
--- a/kernel/locking/rwsem.c
+++ b/kernel/locking/rwsem.c
@@ -181,6 +181,7 @@ void down_read_non_owner(struct rw_semaphore *sem)
 	might_sleep();
 
 	__down_read(sem);
+	rwsem_set_reader_owned(sem);
 }
 
 EXPORT_SYMBOL(down_read_non_owner);

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

end of thread, other threads:[~2018-06-20  9:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-24 13:26 [PATCH] locking/rwsem: Fix up_read_non_owner() warning with DEBUG_RWSEMS Waiman Long
2018-06-19 23:09 ` Waiman Long
2018-06-20  5:49   ` [Customers.Eckelmann] " Schenk, Gavin
2018-06-20  9:17 ` Peter Zijlstra
2018-06-20  9:33 ` [tip:locking/urgent] " tip-bot for Waiman Long

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).