[PATCHv2 2/2] Update ibm,client-architecture call field based on device tree
Benjamin Herrenschmidt
benh at kernel.crashing.org
Thu Feb 4 14:27:45 EST 2010
On Tue, 2010-02-02 at 12:37 -0600, Joel Schopp wrote:
> >> + if(*cores != NR_CPUS)
> >> + prom_printf("client-architecture structure corrupted\n");
> >> + *cores = (NR_CPUS / prom_smt_way());
> >> + prom_printf("setting client-architecture cores to %x\n", *cores);
> >>
> >
> > I don't know if I'm painting a bike shed of if this is a real concern, but if
> > *cores isn't NR_CPUS shouldn't we do nothing rather then clobbering it?
> >
> > Yours Tony
> >
> If it isn't NR_CPUS we're pretty broken if we set it or if we don't. My
> previous version did a BUILD_BUG_ON() but Ben didn't like that and said
> he preferred just a warning message.
BUILD_BUG_ON would probably not have worked unless gcc smarter than I
think it is :-) Your latest approach is bad because when you detect
you are poking at the wrong thing ... you still proceed and do it. In
fact you -are- poking at the wrong thing always since you are missing
PTRRELOC() to relocate the pointer to the vec.
I'll post a new variant of that patch.
Cheers,
Ben.
More information about the Linuxppc-dev
mailing list