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

Andi Kleen
2006-08-11T04:10:39Z

> > +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