Re: [PATCH 2/5] x86, MCA: Convert dont_log_ce, banks and tolerant

From: Borislav Petkov
Date: Wed Oct 17 2012 - 09:15:53 EST


On Wed, Oct 17, 2012 at 05:37:54PM +0530, Naveen N. Rao wrote:
> Nit: no need for the above? Only 2 references below and I think we
> can simply continue to use mca_cfg for uniformity. Ditto for the use
> of cfg further below.
>
> >
> >- mce_banks = kzalloc(banks * sizeof(struct mce_bank), GFP_KERNEL);
> >+ mce_banks = kzalloc(num_banks * sizeof(struct mce_bank), GFP_KERNEL);
> > if (!mce_banks)
> > return -ENOMEM;

For the simple reason that this line violates the 80 columns and I
didn't want to bring any uglification to the code by breaking the line
in two.

For the generated asm it doesn't matter - it is simply done for keeping
the code as readable as possible.

> >- for (i = 0; i < banks; i++) {
> >+
> >+ for (i = 0; i < num_banks; i++) {
> > struct mce_bank *b = &mce_banks[i];
> >
> > b->ctl = -1ULL;
> >@@ -1401,7 +1405,7 @@ static int __cpuinit __mcheck_cpu_cap_init(void)
> > rdmsrl(MSR_IA32_MCG_CAP, cap);
> >
> > b = cap & MCG_BANKCNT_MASK;
> >- if (!banks)
> >+ if (!mca_cfg.banks)
> > pr_info("CPU supports %d MCE banks\n", b);
> >
> > if (b > MAX_NR_BANKS) {
> >@@ -1411,8 +1415,9 @@ static int __cpuinit __mcheck_cpu_cap_init(void)
> > }
> >
> > /* Don't support asymmetric configurations today */
> >- WARN_ON(banks != 0 && b != banks);
> >- banks = b;
> >+ WARN_ON(mca_cfg.banks != 0 && b != mca_cfg.banks);
> >+ mca_cfg.banks = b;
> >+
> > if (!mce_banks) {
> > int err = __mcheck_cpu_mce_banks_init();
> >
> >@@ -1448,7 +1453,7 @@ static void __mcheck_cpu_init_generic(void)
> > if (cap & MCG_CTL_P)
> > wrmsr(MSR_IA32_MCG_CTL, 0xffffffff, 0xffffffff);
> >
> >- for (i = 0; i < banks; i++) {
> >+ for (i = 0; i < mca_cfg.banks; i++) {
> > struct mce_bank *b = &mce_banks[i];
> >
> > if (!b->init)
> >@@ -1489,6 +1494,8 @@ static void quirk_sandybridge_ifu(int bank, struct mce *m, struct pt_regs *regs)
> > /* Add per CPU specific workarounds here */
> > static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
> > {
> >+ struct mca_config *cfg = &mca_cfg;
> >+
>
> Same as above. We could probably continue using mca_cfg for uniformity.

There are 13 mca_cfg references total in that function so having it
shorter with a declaration at the beginning of the function of what cfg
is, is better IMO.

[ â ]

> > __init mcheck_enable(char *str)
> > {
> >+ struct mca_config *cfg = &mca_cfg;
> >+
>
> Same as above.

Ditto, 8 refs here.

--
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551
--
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/