Re: [PATCH v1 13/26] x86/cpuid: Scan CPUID(0x2)
Ingo Molnar <[email protected]>
| Newsgroups | dev.linux.lists.x86-cpuid,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
* Ahmed S. Darwish <[email protected]> wrote: > +static void cpuid_read_0x2(const struct cpuid_scan_entry *e, struct cpuid_read_output *output) > +{ > + union leaf_0x2_regs *regs = (union leaf_0x2_regs *)output->leaf; > + struct leaf_0x2_0 *l2 = (struct leaf_0x2_0 *)output->leaf; > + int invalid_regs = 0; > + > + /* > + * All Intel CPUs must report an iteration count of 1. In case of > + * bogus hardware, keep the leaf marked as invalid at the CPUID table. > + */ > + cpuid_subleaf(e->leaf, e->subleaf, l2); > + if (l2->iteration_count != 0x01) > + return; > + > + /* > + * The most significant bit (MSB) of each register must be clear. > + * If a register is malformed, replace its descriptors with NULL. > + */ > + for (int i = 0; i < 4; i++) { > + if (regs->reg[i].invalid) { > + regs->regv[i] = 0; > + invalid_regs++; > + } Could we please emit a one-time syslog warning & diagnostic when we run across invalid or otherwise weird looking CPUID data, instead of just silently skipping and sanitizing it? Thanks, Ingo