Re: [PATCH 27/31] x86: MCE: Print header/footer only once for multiple MCEs

From: Andi Kleen
Date: Wed May 27 2009 - 03:04:19 EST


On Wed, May 27, 2009 at 01:31:36PM +0900, Hidetoshi Seto wrote:
> I suppose one possible benefit not to have it and do like this is that we
> can suppress printing header if there is no log to print.
> But on the other hand footer is always printed.

If there's a machine check exception there's a hardware error,
so that message should be printed.

This can happen for example in the "external agent" case.

> > #define PANIC_TIMEOUT 5 /* 5 seconds */
>
> And if there is no log, do we still need to run mcelog?

Not manually if it runs correctly, but the kernel doesn't know that in
advance. So in case someone picks it up from a console log
it might be still needed.

> > * Make sure only one CPU runs in machine check panic
> > @@ -240,7 +246,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
> > struct mce *m = &mcelog.entry[i];
> > if ((m->status & MCI_STATUS_VAL) &&
> > !(m->status & MCI_STATUS_UC))
> > - print_mce(m);
> > + print_mce(m, &first);
> > }
> > /* Now print uncorrected but with the final one last */
> > for (i = 0; i < MCE_LOG_LEN; i++) {
> > @@ -248,12 +254,13 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
> > if (!(m->status & MCI_STATUS_VAL))
> > continue;
> > if (!final || memcmp(m, final, sizeof(struct mce)))
> > - print_mce(m);
> > + print_mce(m, &first);
> > }
> > if (final)
> > - print_mce(final);
> > + print_mce(final, &first);
> > if (cpu_missing)
> > printk(KERN_EMERG "Some CPUs didn't answer in synchronization\n");
> > + print_mce_tail();
> > if (exp)
> > printk(KERN_EMERG "Machine check: %s\n", exp);
> > if (mce_panic_timeout < panic_timeout)
>
> If mce_panic is only caller of mce_log_tail (and possible mce_log_head),
> it would be better to use printk directly than having such sub-function.

The coding standard recommends to avoid too long functions, so I split it out.


-Andi

--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.
--
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/