All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] panic: Add register_panic_notifier and unregister_panic_notifier
@ 2022-08-01 10:05 Xu Qiang
  2022-08-01 12:11 ` Guilherme G. Piccoli
  0 siblings, 1 reply; 4+ messages in thread
From: Xu Qiang @ 2022-08-01 10:05 UTC (permalink / raw)
  To: pmladek, akpm, gpiccoli, elver, mcgrof, tangmeng, yangtiezhu,
	john.ogness, bigeasy
  Cc: linux-kernel, guohanjun, weiyongjun1

Add two methods to manipulate panic_notifier_list and export them.
Subsequently, panic_notifier_list is changed to static variable.

Signed-off-by: Xu Qiang <xuqiang36@huawei.com>
---
 include/linux/panic_notifier.h |  3 +++
 kernel/panic.c                 | 12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/include/linux/panic_notifier.h b/include/linux/panic_notifier.h
index 41e32483d7a7..9543d498b90b 100644
--- a/include/linux/panic_notifier.h
+++ b/include/linux/panic_notifier.h
@@ -5,6 +5,9 @@
 #include <linux/notifier.h>
 #include <linux/types.h>
 
+int register_panic_notifier(struct notifier_block *nb);
+int unregister_panic_notifier(struct notifier_block *nb);
+
 extern struct atomic_notifier_head panic_notifier_list;
 
 extern bool crash_kexec_post_notifiers;
diff --git a/kernel/panic.c b/kernel/panic.c
index c6eb8f8db0c0..b848ec4ca6e2 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -199,6 +199,18 @@ static void panic_print_sys_info(bool console_flush)
 		ftrace_dump(DUMP_ALL);
 }
 
+int register_panic_notifier(struct notifier_block *nb)
+{
+	return atomic_notifier_chain_register(&panic_notifier_list, nb);
+}
+EXPORT_SYMBOL(register_panic_notifier);
+
+int unregister_panic_notifier(struct notifier_block *nb)
+{
+	return atomic_notifier_chain_unregister(&panic_notifier_list, nb);
+}
+EXPORT_SYMBOL(unregister_panic_notifier);
+
 /**
  *	panic - halt the system
  *	@fmt: The text string to print
-- 
2.17.1


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

* Re: [PATCH -next] panic: Add register_panic_notifier and unregister_panic_notifier
  2022-08-01 10:05 [PATCH -next] panic: Add register_panic_notifier and unregister_panic_notifier Xu Qiang
@ 2022-08-01 12:11 ` Guilherme G. Piccoli
  2022-08-01 13:58   ` xuqiang (M)
  0 siblings, 1 reply; 4+ messages in thread
From: Guilherme G. Piccoli @ 2022-08-01 12:11 UTC (permalink / raw)
  To: Xu Qiang, pmladek, akpm, elver, mcgrof, tangmeng, yangtiezhu,
	john.ogness, bigeasy
  Cc: linux-kernel, guohanjun, weiyongjun1

On 01/08/2022 07:05, Xu Qiang wrote:
> Add two methods to manipulate panic_notifier_list and export them.
> Subsequently, panic_notifier_list is changed to static variable.
> 
> Signed-off-by: Xu Qiang <xuqiang36@huawei.com>

Hi Xu Qiang, first of all, thanks for your patch!
I'd like to mention 2 things about it:

(a) As-is, there's no much use for it - I mean, you're adding a helper
but you didn't change the uses of such notifier list addition (and there
are plenty of them). Are you intend to change it, or just use the new
API in new calls?

(b) Even more important: we are working in a panic notifier refactor
[0], and that'll add new lists. I'm still working on that, plan to
submit (relatively) soon. Maybe worth to wait it, if this one is not urgent?

Cheers,


Guilherme


[0]
https://lore.kernel.org/lkml/20220427224924.592546-1-gpiccoli@igalia.com/

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

* Re: [PATCH -next] panic: Add register_panic_notifier and unregister_panic_notifier
  2022-08-01 12:11 ` Guilherme G. Piccoli
@ 2022-08-01 13:58   ` xuqiang (M)
  2022-08-01 14:25     ` Guilherme G. Piccoli
  0 siblings, 1 reply; 4+ messages in thread
From: xuqiang (M) @ 2022-08-01 13:58 UTC (permalink / raw)
  To: Guilherme G. Piccoli, pmladek, akpm, elver, mcgrof, tangmeng,
	yangtiezhu, john.ogness, bigeasy
  Cc: linux-kernel, Guohanjun (Hanjun Guo), weiyongjun (A)

在 2022/8/1 20:12, Guilherme G. Piccoli 写道:
> On 01/08/2022 07:05, Xu Qiang wrote:
>> Add two methods to manipulate panic_notifier_list and export them.
>> Subsequently, panic_notifier_list is changed to static variable.
>>
>> Signed-off-by: Xu Qiang <xuqiang36@huawei.com>
> Hi Xu Qiang, first of all, thanks for your patch!
> I'd like to mention 2 things about it:
>
> (a) As-is, there's no much use for it - I mean, you're adding a helper
> but you didn't change the uses of such notifier list addition (and there
> are plenty of them). Are you intend to change it, or just use the new
> API in new calls?
After this patch comes in, I will replace all the old interfaces with
the new ones.
>
> (b) Even more important: we are working in a panic notifier refactor
> [0], and that'll add new lists. I'm still working on that, plan to
> submit (relatively) soon. Maybe worth to wait it, if this one is not urgent?
I can wait for your patch to be incorporated before submitting it.
>
> Cheers,
>
>
> Guilherme
>
>
> [0]
> https://lore.kernel.org/lkml/20220427224924.592546-1-gpiccoli@igalia.com/
>
Thanks

Xu



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

* Re: [PATCH -next] panic: Add register_panic_notifier and unregister_panic_notifier
  2022-08-01 13:58   ` xuqiang (M)
@ 2022-08-01 14:25     ` Guilherme G. Piccoli
  0 siblings, 0 replies; 4+ messages in thread
From: Guilherme G. Piccoli @ 2022-08-01 14:25 UTC (permalink / raw)
  To: xuqiang (M),
	pmladek, akpm, elver, mcgrof, tangmeng, yangtiezhu, john.ogness,
	bigeasy
  Cc: linux-kernel, Guohanjun (Hanjun Guo), weiyongjun (A)

On 01/08/2022 10:58, xuqiang (M) wrote:
> 在 2022/8/1 20:12, Guilherme G. Piccoli 写道:
>> On 01/08/2022 07:05, Xu Qiang wrote:
>>> Add two methods to manipulate panic_notifier_list and export them.
>>> Subsequently, panic_notifier_list is changed to static variable.
>>>
>>> Signed-off-by: Xu Qiang <xuqiang36@huawei.com>
>> Hi Xu Qiang, first of all, thanks for your patch!
>> I'd like to mention 2 things about it:
>>
>> (a) As-is, there's no much use for it - I mean, you're adding a helper
>> but you didn't change the uses of such notifier list addition (and there
>> are plenty of them). Are you intend to change it, or just use the new
>> API in new calls?
> After this patch comes in, I will replace all the old interfaces with
> the new ones.
>>
>> (b) Even more important: we are working in a panic notifier refactor
>> [0], and that'll add new lists. I'm still working on that, plan to
>> submit (relatively) soon. Maybe worth to wait it, if this one is not urgent?
> I can wait for your patch to be incorporated before submitting it.

Great, thanks Xu! I'll include you in the CC list of the V2 =)

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

end of thread, other threads:[~2022-08-01 14:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-01 10:05 [PATCH -next] panic: Add register_panic_notifier and unregister_panic_notifier Xu Qiang
2022-08-01 12:11 ` Guilherme G. Piccoli
2022-08-01 13:58   ` xuqiang (M)
2022-08-01 14:25     ` Guilherme G. Piccoli

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.