Re: [PATCH 01/10] Add driver auto probing for x86 features

From: Andi Kleen
Date: Thu Dec 08 2011 - 09:45:18 EST


On Thu, Dec 08, 2011 at 10:35:40AM +0100, Jean Delvare wrote:
> > +/**
> > + * x86_match_cpu - match current CPU again an array of x86_cpu_ids
>
> The code is actually matching the boot cpu, which isn't necessarily the
> current CPU. I think it would be better to let the caller pass a
> specific cpu as a parameter. At least the hwmon drivers would benefit
> from that. Then you can add an helper function x86_match_boot_cpu()
> calling x86_match_cpu() on &boot_cpu_data if you want.

I don't really see a point of this currently -- the udev/modprobe loading is
global anyways. If we really want to support asymmetric configs a lot
more work all over the kernel is needed and this could be still
changed.
>
> > + * @match: Pointer to array of x86_cpu_ids. Last entry terminated with
> > + * X86_MODEL_END.
>
> I see no such X86_MODEL_END, your loop below is instead treating entries
> with all fields set to 0 as the terminating entry (which seems
> reasonable.)

Hmm yes I ended up with {}. I'll fix the comment.

> > +#define X86_VENDOR_ANY 0xffff
> > +#define X86_FAMILY_ANY 0
> > +#define X86_MODEL_ANY 0
>
> Are you sure family 0 or model 0 are never used, by any vendor? I

They could be, but we never match for them.

> wouldn't take the risk. What's wrong with 0xffff?

That would not allow abbreviating the entries: the C compiler
doesn't know how to fill in 0xffff automatically.

>
> > +#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */
>
> Might be better to set X86_FEATURE_ANY to either 10 (unused feature
> bit) or 0xffff then.

I don't think this is a problem in practice.

Thanks for the review.

-Andi
--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.
--
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/