Re: [PATCH 17/63] edac_mce: Add an interface driver to report mceerrors via edac

From: Borislav Petkov
Date: Fri Sep 25 2009 - 05:49:06 EST


Mauro,

On Thu, Sep 24, 2009 at 07:27:27PM -0300, Mauro Carvalho Chehab wrote:
> edac_mce module is an interface module that gets mcelog data and
> forwards to any registered edac module that expects to receive data via
> mce.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
> ---
> arch/x86/kernel/cpu/mcheck/mce.c | 12 ++++++++
> drivers/edac/Kconfig | 8 ++++-
> drivers/edac/Makefile | 3 +-
> drivers/edac/edac_mce.c | 58 ++++++++++++++++++++++++++++++++++++++
> include/linux/edac_mce.h | 31 ++++++++++++++++++++
> 5 files changed, 110 insertions(+), 2 deletions(-)
> create mode 100644 drivers/edac/edac_mce.c
> create mode 100644 include/linux/edac_mce.h
>
> diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
> index 2f5aab2..fefbb7c 100644
> --- a/arch/x86/kernel/cpu/mcheck/mce.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce.c
> @@ -35,6 +35,7 @@
> #include <linux/fs.h>
> #include <linux/mm.h>
> #include <linux/debugfs.h>
> +#include <linux/edac_mce.h>
>
> #include <asm/processor.h>
> #include <asm/hw_irq.h>
> @@ -135,6 +136,15 @@ void mce_log(struct mce *mce)
> entry = rcu_dereference(mcelog.next);
> for (;;) {
> /*
> + * If edac_mce is enabled, it will check the error type
> + * and will process it, if it is a known error.
> + * Otherwise, the error will be sent through mcelog
> + * interface
> + */
> + if (edac_mce_parse(mce))
> + return;

for the third time (!): this may run in NMI context and as such does not
obey to normal kernel locking rules and you cannot safely use almost any
kernel resources involving locking. This way, your hook calls into a
module, which is a very bad idea. Please remove that hook and put in the
polling routine or somewhere more appropriate.

> +
> + /*
> * When the buffer fills up discard new entries.
> * Assume that the earlier errors are the more
> * interesting ones:
> @@ -193,6 +203,8 @@ static void print_mce(struct mce *m)
> m->cpuvendor, m->cpuid, m->time, m->socketid,
> m->apicid);
>
> + edac_mce_parse(m);
> +
> decode_mce(m);
> }

--
Regards/Gruss,
Boris.

Operating | Advanced Micro Devices GmbH
System | Karl-Hammerschmidt-Str. 34, 85609 Dornach b. München, Germany
Research | Geschäftsführer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni
Center | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
(OSRC) | Registergericht München, HRB Nr. 43632

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/