Re: [PATCH for review] [26/145] x86_64: Add initalization of the RDTSCP auxilliary values

From: Andi Kleen
Date: Fri Aug 11 2006 - 00:08:28 EST



> > +static int __cpuinit
> > +time_cpu_notifier(struct notifier_block *nb, unsigned long action, void *hcpu)
> > {
> > - char *timename;
> > - char *gtod;
> > + unsigned cpu = (unsigned long) hcpu;
>
> Is this some kind of "endian magic" ? I mean getting high or low word of 64
> pointer to 32 variable ? Why cast just with (unsigned) doesn't work ?

This is just to avoid a warning from gcc that a pointer is converted
to a 32bit integer -- which is ok here since it uses a "void *" callback argument
to pass an integer.

Arguably there should be a standard macro for this construct, but there
isn't currently.

>
> > + if (action == CPU_ONLINE &&
> > + cpu_has(&cpu_data[cpu], X86_FEATURE_RDTSCP)) {
> > + unsigned p;
> > + p = smp_processor_id() | (cpu_to_node(smp_processor_id())<<12);
>
> Is this code runs under SMP ? I couldn't figure that out.

Yes it is. It handles additional CPUs.

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