Skip to contentSkip to conversation

parisc: Drop out of get_whan() if task is running again

PATCH In review Helge Deller 2 participants 3 messages Dec 17, 2020 PA-RISC architecture

lore
Share & tools
lore

Helge Deller

author maintainer
#0 lore raw

PATCH 1/1 parisc: Drop out of get_whan() if task is running again

arch/parisc/kernel/process.c +2 -0
index a92a23d6acd9..fda1c1a6a444 100644
@@ -260,6 +260,8 @@ get_wchan(struct task_struct *p)
 	do {
 		if (unwind_once(&info) < 0)
 			return 0;
+		if (p->state == TASK_RUNNING)
+                        return 0;
 		ip = info.ip;
 		if (!in_sched_functions(ip))
 			return ip;
#1 lore raw

This seems to be a hack to work around a race in p->state.  Don't see this check in other implementations.

Quoted 7 lines · Helge Deller
arch/parisc/kernel/process.c +0 -0
index a92a23d6acd9..fda1c1a6a444 100644

arch/parisc/kernel/process.c get_wchan(struct task_struct *p) · line 267

Quoted 8 lines
arch/parisc/kernel/process.c +2 -0
@@ -260,6 +260,8 @@ get_wchan(struct task_struct *p)
 	do {
 		if (unwind_once(&info) < 0)
 			return 0;
+		if (p->state == TASK_RUNNING)
+                        return 0;
 		ip = info.ip;
 		if (!in_sched_functions(ip))
 			return ip;

Dave

Signature · 1 line
John David Anglin  [email protected]
author maintainer
#2 lore raw
Quoted 1 line · John David Anglin

This seems to be a hack to work around a race in p->state.  Don't see this check in other implementations.

In arch/x86/kernel/process.c:
} while (count++ < 16 && p->state != TASK_RUNNING);

But I think we should implement CONFIG_THREAD_INFO_IN_TASK and thus try_get_task_stack() too..

Helge

Quoted 20 lines · Helge Deller
Quoted 7 lines
arch/parisc/kernel/process.c +0 -0
index a92a23d6acd9..fda1c1a6a444 100644

arch/parisc/kernel/process.c get_wchan(struct task_struct *p) · line 267

Quoted 8 lines
arch/parisc/kernel/process.c +2 -0
@@ -260,6 +260,8 @@ get_wchan(struct task_struct *p)
 	do {
 		if (unwind_once(&info) < 0)
 			return 0;
+		if (p->state == TASK_RUNNING)
+                        return 0;
 		ip = info.ip;
 		if (!in_sched_functions(ip))
 			return ip;

Dave