[PATCH 1/3] signals: Allow generation of SIGKILL to exiting task.

Andrey Grodzovsky Andrey.Grodzovsky at amd.com
Tue Apr 24 16:51:13 UTC 2018



On 04/24/2018 12:42 PM, Eric W. Biederman wrote:
> Andrey Grodzovsky <andrey.grodzovsky at amd.com> writes:
>
>> Currently calling wait_event_killable as part of exiting process
>> will stall forever since SIGKILL generation is suppresed by PF_EXITING.
>>
>> In our partilaur case AMDGPU driver wants to flush all GPU jobs in
>> flight before shutting down. But if some job hangs the pipe we still want to
>> be able to kill it and avoid a process in D state.
> I should clarify.  This absolutely can not be done.
> PF_EXITING is set just before a task starts tearing down it's signal
> handling.
>
> So delivering any signal, or otherwise depending on signal handling
> after PF_EXITING is set can not be done.  That abstraction is gone.

I see, so you suggest it's the driver responsibility to avoid creating 
such code path that ends up
calling wait_event_killable from exit call stack (PF_EXITING == 1) ?

Andrey

>
> Eric
>
>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky at amd.com>
>> ---
>>   kernel/signal.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/signal.c b/kernel/signal.c
>> index c6e4c83..c49c706 100644
>> --- a/kernel/signal.c
>> +++ b/kernel/signal.c
>> @@ -886,10 +886,10 @@ static inline int wants_signal(int sig, struct task_struct *p)
>>   {
>>   	if (sigismember(&p->blocked, sig))
>>   		return 0;
>> -	if (p->flags & PF_EXITING)
>> -		return 0;
>>   	if (sig == SIGKILL)
>>   		return 1;
>> +	if (p->flags & PF_EXITING)
>> +		return 0;
>>   	if (task_is_stopped_or_traced(p))
>>   		return 0;
>>   	return task_curr(p) || !signal_pending(p);



More information about the amd-gfx mailing list