lkml.org 
[lkml]   [2009]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH - 2/2] tip, x86-microcode: refactor microcode output messages

* dimm <dmitry.adamushko@gmail.com> 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


\
 
 \ /
  Last update: 2009-11-26 10:33    [W:0.049 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site