Re: [PATCH -v4] x86: MCE: Re-implement MCE log ring buffer as per-CPUring buffer

From: Hidetoshi Seto
Date: Sun Jun 07 2009 - 23:10:25 EST


Huang Ying wrote:
> Emm, it seem hard to analyze mce_log_cpu from per_cpu_var(mce_log_cpus),
> how about following method:
>
> struct mce_log {
> char signature[12];
> ...
> struct mce_log_cpu *mcelog_cpus[];
> };
>
> void mcelog_init(void)
> {
> int cpu;
> mcelog.mcelog_cpus = kmalloc(sizeof(void *) * num_possible_cpus();
> for_each_possible_cpu(cpu)
> mcelog.mcelog_cpus[cpu] = &per_cpu(mce_log_cpus, cpu);
> }

It would be good. Using kzalloc() will be better.
It might be a bit much, but how about adding:

+ mcelog.nr_mcelog_cpus = num_possible_cpus();

Be careful that mcheck_init(), caller of mcelog_init(), will be called
for each booted CPU. You will need:

+ if (mcelog.mcelog_cpus)
+ return;


Thanks,
H.Seto

--
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/