Re: [PATCH - 2/2] tip, x86-microcode: refactor microcode outputmessages

From: Ingo Molnar
Date: Thu Nov 26 2009 - 04:31:37 EST



* dimm <dmitry.adamushko@xxxxxxxxx> wrote:

> +static int summarize_cpu_range(struct cpumask *range, struct cpu_signature *csig)
> +{
> + char *cpu_str, *ver_str;
> + int ret = -1;
> +
> + cpu_str = kmalloc(128, GFP_KERNEL);
> + ver_str = kmalloc(128, GFP_KERNEL);
> + if (!cpu_str || !ver_str)
> + goto out;
> +
> + cpulist_scnprintf(cpu_str, 128, range);
> + microcode_ops->version_snprintf(ver_str, 128, csig);
> +
> + printk(KERN_INFO "microcode: CPU%s: %s\n", cpu_str, ver_str);
> + ret = 0;
> +out:
> + if (cpu_str)
> + kfree(cpu_str);
> + if (ver_str)
> + kfree(ver_str);
> +
> + return ret;
> +}
> +
> +static void summarize_cpu_info(void)
> +{
> + struct cpu_info_array_ctx *ctx_array;
> + cpumask_var_t cpulist;
> + int base, cpu, ret;
> +
> + if (!zalloc_cpumask_var(&cpulist, GFP_KERNEL))
> + return;
> +
> + ctx_array = kmalloc(nr_cpu_ids * sizeof(*ctx_array), GFP_KERNEL);
> + if (!ctx_array)
> + goto out;
> +
> + ret = on_each_cpu(collect_cpu_info_array, ctx_array, 1);
> + if (ret)
> + goto out;
> +
> + base = cpumask_first(cpu_online_mask);
> + cpu = base;
> + cpumask_set_cpu(cpu, cpulist);
> +
> + while ((cpu = cpumask_next(cpu, cpu_online_mask)) < nr_cpu_ids) {
> + if (memcmp(&ctx_array[base].cpu_sig, &ctx_array[cpu].cpu_sig,
> + sizeof(ctx_array[base].cpu_sig)) != 0) {
> + summarize_cpu_range(cpulist, &ctx_array[base].cpu_sig);
> + cpumask_clear(cpulist);
> + base = cpu;
> + }
> + cpumask_set_cpu(cpu, cpulist);
> + }
> + summarize_cpu_range(cpulist, &ctx_array[base].cpu_sig);
> +out:
> + free_cpumask_var(cpulist);
> + if (ctx_array)
> + kfree(ctx_array);
> +}

Could we please leave out this summarizing logic (it's bloaty and
unnecessary), and just print a single line message when applying the
microcode?

Thanks,

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