Re: [PATCH] MIPS: Remove noreturn attribute for die()

From: Tiezhu Yang
Date: Wed Aug 09 2023 - 05:30:19 EST




On 08/08/2023 10:54 PM, Maciej W. Rozycki wrote:
On Tue, 1 Aug 2023, Tiezhu Yang wrote:

If notify_die() returns NOTIFY_STOP, there is no need to call
make_task_dead(), we can remove noreturn attribute for die(),
this is similar with arm64, riscv and csky.

So you want to keep a task alive that has caused a kernel oops in the
process context in this case, right? What purpose would it be for and
what condition causes `notify_die' to return NOTIFY_STOP? IOW why is
there no need to call `make_task_dead' in this case?

Maciej


I did some research, hope it is useful.

There is a related description in Documentation/input/notifier.rst:

For each kind of event but the last, the callback may return
NOTIFY_STOP in order to "eat" the event: the notify loop is
stopped and the keyboard event is dropped.

In commit 748f2edb5271 ("x86 NMI: better support for debuggers"), it said:

If the notify is handled with a NOTIFY_STOP return, the
system is given a new lease on life.

In commit 004429956b48 ("handle recursive calls to bust_spinlocks()"),
it said:

However, at least on i386 die() has been capable of returning
(and on other architectures this should really be that way, too)
when notify_die() returns NOTIFY_STOP.

In commit 22f5991c85de ("x86-64: honor notify_die() returning NOTIFY_STOP"),
it said:

This requires making die() return a value, making its callers honor
this (and be prepared that it may return)

In commit 620de2f5dc69 ("[IA64] honor notify_die() returning NOTIFY_STOP"),
it said:

This requires making die() and die_if_kernel() return a value,
and their callers to honor this (and be prepared that it returns).

Thanks,
Tiezhu