All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] parisc: Drop out of get_whan() if task is running again
@ 2020-12-17 16:57 Helge Deller
  2020-12-17 18:04 ` John David Anglin
  0 siblings, 1 reply; 3+ messages in thread
From: Helge Deller @ 2020-12-17 16:57 UTC (permalink / raw)
  To: linux-parisc, James Bottomley, John David Anglin

Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index a92a23d6acd9..fda1c1a6a444 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -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;

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

* Re: [PATCH] parisc: Drop out of get_whan() if task is running again
  2020-12-17 16:57 [PATCH] parisc: Drop out of get_whan() if task is running again Helge Deller
@ 2020-12-17 18:04 ` John David Anglin
  2020-12-17 18:06   ` Helge Deller
  0 siblings, 1 reply; 3+ messages in thread
From: John David Anglin @ 2020-12-17 18:04 UTC (permalink / raw)
  To: Helge Deller, linux-parisc, James Bottomley

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

On 2020-12-17 11:57 a.m., Helge Deller wrote:
> Signed-off-by: Helge Deller <deller@gmx.de>
>
> diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
> index a92a23d6acd9..fda1c1a6a444 100644
> --- a/arch/parisc/kernel/process.c
> +++ b/arch/parisc/kernel/process.c
> @@ -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

-- 
John David Anglin  dave.anglin@bell.net



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

* Re: [PATCH] parisc: Drop out of get_whan() if task is running again
  2020-12-17 18:04 ` John David Anglin
@ 2020-12-17 18:06   ` Helge Deller
  0 siblings, 0 replies; 3+ messages in thread
From: Helge Deller @ 2020-12-17 18:06 UTC (permalink / raw)
  To: John David Anglin, linux-parisc, James Bottomley

On 12/17/20 7:04 PM, John David Anglin wrote:
> 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

>
> On 2020-12-17 11:57 a.m., Helge Deller wrote:
>> Signed-off-by: Helge Deller <deller@gmx.de>
>>
>> diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
>> index a92a23d6acd9..fda1c1a6a444 100644
>> --- a/arch/parisc/kernel/process.c
>> +++ b/arch/parisc/kernel/process.c
>> @@ -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
>


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

end of thread, other threads:[~2020-12-17 18:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 16:57 [PATCH] parisc: Drop out of get_whan() if task is running again Helge Deller
2020-12-17 18:04 ` John David Anglin
2020-12-17 18:06   ` Helge Deller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.