Re: [patch] bug in cpuid & msr on nosmp machine

From: Paul Jackson
Date: Thu May 20 2004 - 04:46:13 EST


Jeff wrote:
> but on nosmp machine if the cpu!=0 this procude a BUG();

The line you refer to here is, I believe, in include/linux/cpumask.h:

#ifdef CONFIG_SMP
...
#else
...
#define cpu_online(cpu) ({ BUG_ON((cpu) != 0); 1; })
...
#endif

Any thoughts on whether that BUG() is serving any useful purpose?

I'm of a mind to have the non-SMP case of cpu_online(cpu) simply
respond true (1) hardcoded:

#define cpu_online(cpu) (1)

Or at least remove the BUG and have it respond true iff cpu == 0:

#define cpu_online(cpu) ((cpu) == 0)

While theoretically correct, that BUG() is, so far as I know, of
no redeeming social value. And it wastes a few bytes of kernel
text space each time cpu_online() is used on an SMP, and causes
the occassional confusion, as in this case.

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@xxxxxxx> 1.650.933.1373
-
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/