Skip to contentSkip to conversation

cpuidle: coupled: fix ready counter decrement

PATCH In review Sivaram Nair 4 participants 4 messages Dec 14, 2012 – Dec 15, 2012 CPU idle time management framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpuidle: coupled: fix ready counter decrement

The ready_waiting_counts atomic variable is compared against the wrong online cpu count. The latter is computed incorrectly using logical-OR instead of bit-OR. This patch fixes that.

---
 drivers/cpuidle/coupled.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpuidle/coupled.c +1 -1
index 3265844..2a297f8 100644
@@ -209,7 +209,7 @@ inline int cpuidle_coupled_set_not_ready(struct cpuidle_coupled *coupled)
 	int all;
 	int ret;
 
-	all = coupled->online_count || (coupled->online_count << WAITING_BITS);
+	all = coupled->online_count | (coupled->online_count << WAITING_BITS);
 	ret = atomic_add_unless(&coupled->ready_waiting_counts,
 		-MAX_WAITING_CPUS, all);
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 3 lines · Sivaram Nair

The ready_waiting_counts atomic variable is compared against the wrong online cpu count. The latter is computed incorrectly using logical-OR instead of bit-OR. This patch fixes that.

I'm queuing this up for submission as v3.8 material.

I suppose it should be marked for -stable too?

Rafael

Quoted 19 lines
---
 drivers/cpuidle/coupled.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpuidle/coupled.c +1 -1
index 3265844..2a297f8 100644
@@ -209,7 +209,7 @@ inline int cpuidle_coupled_set_not_ready(struct cpuidle_coupled *coupled)
 	int all;
 	int ret;
 
-	all = coupled->online_count || (coupled->online_count << WAITING_BITS);
+	all = coupled->online_count | (coupled->online_count << WAITING_BITS);
 	ret = atomic_add_unless(&coupled->ready_waiting_counts,
 		-MAX_WAITING_CPUS, all);
 
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
Acked-by
#2 lore raw
Quoted 10 lines · Rafael J. Wysocki
Quoted 3 lines · Sivaram Nair

The ready_waiting_counts atomic variable is compared against the wrong online cpu count. The latter is computed incorrectly using logical-OR instead of bit-OR. This patch fixes that.

I'm queuing this up for submission as v3.8 material.

I suppose it should be marked for -stable too?

Rafael

Looks suitable for stable.

Quoted 22 lines
Quoted 11 lines
---
 drivers/cpuidle/coupled.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpuidle/coupled.c +0 -0
index 3265844..2a297f8 100644

drivers/cpuidle/coupled.c inline int cpuidle_coupled_set_not_ready(struct cpuidle_coupled *coupled) · line 215

Quoted 8 lines
drivers/cpuidle/coupled.c +1 -1
@@ -209,7 +209,7 @@ inline int cpuidle_coupled_set_not_ready(struct cpuidle_coupled *coupled)
      int all;
      int ret;
 
-     all = coupled->online_count || (coupled->online_count << WAITING_BITS);
+     all = coupled->online_count | (coupled->online_count << WAITING_BITS);
      ret = atomic_add_unless(&coupled->ready_waiting_counts,
              -MAX_WAITING_CPUS, all);
 

--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.