Re: [PATCH 3/3] EDAC: carve out AMD MCE decoding logic

Ingo Molnar
2009-10-03T07:18:22Z

* Borislav Petkov <petkovbb@googlemail.com> wrote:

> On Fri, Oct 02, 2009 at 08:47:14PM +0200, Ingo Molnar wrote:
> > No, the locking was all that i meant. Using atomic_notifier would solve
> > that. Make the default decoder low-prio, that way there's no need to do
> > the callback save/restore sequence either.
>
> Ok, how's that for starters, it has been only compile-tested and it
> looks straight-forward enough to me...

looks good at first sight. There's two further simplifications you could
do:

> +int mce_register_decoder_notifier(struct notifier_block *nb);
> +int mce_unregister_decoder_notifier(struct notifier_block *nb);

expose the notifier list itself and dont create new register/unregister
APIs. Doing:

atomic_notifier_chain_register(&x86_mce_decoder_chain, nb);

straight from the EDAC code is clean enough.

plus:

> +static struct notifier_block amd_mce_dec_nb = {
> + .notifier_call = amd_decode_mce,
> + .priority = 100,
> +};
> +

it's better to set the default notifier to negative priority, and let
the EDAC notifier(s) be at the default 0 priority. The 100 is arbitrary
and ugly - that line can then be left out altogether.

Ingo