2011-03-17 19:22:13

by Steven Rostedt

[permalink] [raw]
Subject: [PATCH 2/2] futex: Fix WARN_ON() test for UP

From: Steven Rostedt <[email protected]>

An update of the futex code had a

WARN_ON(!spin_is_locked(q->lock_ptr))

But on UP, spin_is_locked() is always false, and will
trigger this warning, and even worse, it will exit the function
without doing the necessary work.

Converting this to a WARN_ON_SMP() fixes the problem.

Reported-by: Richard Weinberger <[email protected]>
Tested-by: Richard Weinberger <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
---
kernel/futex.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index 9fe9131..850d00b 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -785,8 +785,8 @@ static void __unqueue_futex(struct futex_q *q)
{
struct futex_hash_bucket *hb;

- if (WARN_ON(!q->lock_ptr || !spin_is_locked(q->lock_ptr)
- || plist_node_empty(&q->list)))
+ if (WARN_ON_SMP(!q->lock_ptr || !spin_is_locked(q->lock_ptr))
+ || WARN_ON(plist_node_empty(&q->list)))
return;

hb = container_of(q->lock_ptr, struct futex_hash_bucket, lock);
--
1.7.2.3


2011-03-17 20:00:47

by Darren Hart

[permalink] [raw]
Subject: Re: [PATCH 2/2] futex: Fix WARN_ON() test for UP

On 03/17/2011 12:21 PM, Steven Rostedt wrote:
> From: Steven Rostedt<[email protected]>
>
> An update of the futex code had a
>
> WARN_ON(!spin_is_locked(q->lock_ptr))
>
> But on UP, spin_is_locked() is always false, and will
> trigger this warning, and even worse, it will exit the function
> without doing the necessary work.
>
> Converting this to a WARN_ON_SMP() fixes the problem.
>
> Reported-by: Richard Weinberger<[email protected]>
> Tested-by: Richard Weinberger<[email protected]>
> Signed-off-by: Steven Rostedt<[email protected]>

Acked-by: Darren Hart <[email protected]>


> ---
> kernel/futex.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/futex.c b/kernel/futex.c
> index 9fe9131..850d00b 100644
> --- a/kernel/futex.c
> +++ b/kernel/futex.c
> @@ -785,8 +785,8 @@ static void __unqueue_futex(struct futex_q *q)
> {
> struct futex_hash_bucket *hb;
>
> - if (WARN_ON(!q->lock_ptr || !spin_is_locked(q->lock_ptr)
> - || plist_node_empty(&q->list)))
> + if (WARN_ON_SMP(!q->lock_ptr || !spin_is_locked(q->lock_ptr))
> + || WARN_ON(plist_node_empty(&q->list)))
> return;
>
> hb = container_of(q->lock_ptr, struct futex_hash_bucket, lock);
> -- 1.7.2.3 -- To unsubscribe from this list: send the line "unsubscribe
> linux-kernel" in the body of a message to [email protected] More
> majordomo info at http://vger.kernel.org/majordomo-info.html Please read
> the FAQ at http://www.tux.org/lkml/

--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel

2011-03-25 09:33:56

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 2/2] futex: Fix WARN_ON() test for UP

On Thu, 2011-03-17 at 15:21 -0400, Steven Rostedt wrote:
> From: Steven Rostedt <[email protected]>
>
> An update of the futex code had a
>
> WARN_ON(!spin_is_locked(q->lock_ptr))
>
> But on UP, spin_is_locked() is always false, and will
> trigger this warning, and even worse, it will exit the function
> without doing the necessary work.
>
> Converting this to a WARN_ON_SMP() fixes the problem.
>
> Reported-by: Richard Weinberger <[email protected]>
> Tested-by: Richard Weinberger <[email protected]>
> Signed-off-by: Steven Rostedt <[email protected]>

Acked-by: Peter Zijlstra <[email protected]>

2011-03-25 10:49:55

by Steven Rostedt

[permalink] [raw]
Subject: [tip:core/urgent] futex: Fix WARN_ON() test for UP

Commit-ID: 29096202176ceaa5016a17ea2dd1aea19a4e90e2
Gitweb: http://git.kernel.org/tip/29096202176ceaa5016a17ea2dd1aea19a4e90e2
Author: Steven Rostedt <[email protected]>
AuthorDate: Thu, 17 Mar 2011 15:21:07 -0400
Committer: Ingo Molnar <[email protected]>
CommitDate: Fri, 25 Mar 2011 11:32:11 +0100

futex: Fix WARN_ON() test for UP

An update of the futex code had a

WARN_ON(!spin_is_locked(q->lock_ptr))

But on UP, spin_is_locked() is always false, and will
trigger this warning, and even worse, it will exit the function
without doing the necessary work.

Converting this to a WARN_ON_SMP() fixes the problem.

Reported-by: Richard Weinberger <[email protected]>
Tested-by: Richard Weinberger <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
Acked-by: Thomas Gleixner <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Acked-by: Darren Hart <[email protected]>
Cc: Lai Jiangshan <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
kernel/futex.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index bda4157..823aae3 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -782,8 +782,8 @@ static void __unqueue_futex(struct futex_q *q)
{
struct futex_hash_bucket *hb;

- if (WARN_ON(!q->lock_ptr || !spin_is_locked(q->lock_ptr)
- || plist_node_empty(&q->list)))
+ if (WARN_ON_SMP(!q->lock_ptr || !spin_is_locked(q->lock_ptr))
+ || WARN_ON(plist_node_empty(&q->list)))
return;

hb = container_of(q->lock_ptr, struct futex_hash_bucket, lock);