Re: [git-pull -tip] x86: cpu_debug patches

From: Ingo Molnar
Date: Mon Apr 20 2009 - 07:16:40 EST



* Jaswinder Singh Rajput <jaswinder@xxxxxxxxxx> wrote:

> static DEFINE_PER_CPU(struct cpu_cpuX_base, cpu_arr[CPU_REG_ALL_BIT]);
> static DEFINE_PER_CPU(struct cpu_private *, priv_arr[MAX_CPU_FILES]);
> static DEFINE_PER_CPU(unsigned, cpu_modelflag);
> static DEFINE_PER_CPU(int, cpu_priv_count);
> -static DEFINE_PER_CPU(unsigned, cpu_model);
> +
> +/* Storing vendor locally because it is used excessive in this code */
> +static unsigned cpu_vendor;

There's still no need to store it locally - what's wrong with
cpu_data(cpu) or current_cpu_data?

Also, do we need the per-cpu cpu_modelflag variable too? I'd suggest
to integrate that kind of enumeration into struct cpuinfo_x86 and
cpu_info. We often have such kinds of constructs in x86 code:

c->x86 <= 0x11

So extending your scheme to other code would benefit all code.

Plus this kind of enumeration:

switch (model) {
case 0x0501:
case 0x0502:
case 0x0504:
flag = CPU_INTEL_PENTIUM;
break;
case 0x0601:
case 0x0603:
case 0x0605:
case 0x0607:
case 0x0608:
case 0x060A:
case 0x060B:
flag = CPU_INTEL_P6;

The 0x05/0x06 there is already available as the family flag in
cpuinfo_x86, as cpu_info::x86. The 01,02...0B model portion is also
already available as cpu_info::x86_model.

[ there's also cpu_info::x86_mask, which gives the stepping. ]

This is what i meant when i said that you needlessly duplicate
already existing information. You encode/decode it in some weird
looking way instead of using the already existing, per CPU
information of cpu_info.

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/