[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e1033adc-46ff-5dbc-e739-1bf725b6fed0@igalia.com>
Date: Mon, 7 Mar 2022 10:11:41 -0300
From: "Guilherme G. Piccoli" <gpiccoli@...lia.com>
To: "bhe@...hat.com" <bhe@...hat.com>
Cc: Petr Mladek <pmladek@...e.com>,
"d.hatayama@...itsu.com" <d.hatayama@...itsu.com>,
"kexec@...ts.infradead.org" <kexec@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"dyoung@...hat.com" <dyoung@...hat.com>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"vgoyal@...hat.com" <vgoyal@...hat.com>,
"stern@...land.harvard.edu" <stern@...land.harvard.edu>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"andriy.shevchenko@...ux.intel.com"
<andriy.shevchenko@...ux.intel.com>,
"corbet@....net" <corbet@....net>,
"halves@...onical.com" <halves@...onical.com>,
"kernel@...ccoli.net" <kernel@...ccoli.net>
Subject: Re: [PATCH V4] notifier/panic: Introduce panic_notifier_filter
On 07/03/2022 00:42, bhe@...hat.com wrote:
> [...]
>> Let me know your thoughts Petr / Baoquan - it would add slightly more
>> code / complexity, but in my opinion the payback is very good.
>> Cheers,
>
> The ideal situation is each panic notifier has an order or index to
> indicate its priority. Wondering how to make it. What I think of is
> copying initcall. We have several priorities, at the same priority,
> execution sequence is not important. Not sure if I get your point.
>
> ~~~~~~~
> #define core_initcall(fn) __define_initcall(fn, 1)
> #define core_initcall_sync(fn) __define_initcall(fn, 1s)
> ......
> #define late_initcall(fn) __define_initcall(fn, 7)
> #define late_initcall_sync(fn) __define_initcall(fn, 7s)
>
Hi Baoquan, thanks for you consideration! In fact, the notifiers
infrastructure already have a mechanism of ordering, my idea is to make
use of that. It's not that different from the initcall system...
For instance, the code in the notifier register function checks for the
priority field in the notifier block:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/notifier.c#n31
.
For example, the Xen panic notifier is one of the few blocks that make
use of that, currently:
static struct notifier_block xen_panic_block = {
.notifier_call = xen_panic_event,
.priority = INT_MIN
};
(see
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/xen/enlighten.c#n286)
In this case, xen_panic_event() will be the latest one to run. My idea
is to make use of that in *all* panic notifiers, having a table/list on
panic_notifier.h (defines or enum, I'll think about that when writing
this part) so all notifiers are documented and the ordering is clear and
enforced.
Makes sense to you?
Cheers,
Guilherme
Powered by blists - more mailing lists