public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* topology api confusion
@ 2005-07-22 21:33 Nathan Lynch
  2005-07-25 21:41 ` Matthew Dobson
  2005-08-01  5:07 ` Anton Blanchard
  0 siblings, 2 replies; 7+ messages in thread
From: Nathan Lynch @ 2005-07-22 21:33 UTC (permalink / raw)
  To: lkml; +Cc: colpatch, Anton Blanchard

We need some clarity on how asm-generic/topology.h is intended to be
used.  I suspect that it's supposed to be unconditionally included at
the end of the architecture's topology.h so that any elements which
are undefined by the arch have sensible default definitions.  Looking
at 2.6.13-rc3, this is what ppc64, ia64, and x86_64 currently do,
however i386 does not (i386 pulls in the generic version only when
!CONFIG_NUMA).

The #ifndef guards around each element of the topology api
cannot serve their apparent intended purpose when the architecture
implements a given bit as a function instead of a macro
(e.g. cpu_to_node in ppc64):

----

asm-generic/topology.h:

#ifndef cpu_to_node
#define cpu_to_node(cpu)        (0)
#endif

----

asm-ppc64/topology.h:

static inline int cpu_to_node(int cpu)
{
        int node;

        node = numa_cpu_lookup_table[cpu];
	....

----

Since ppc64 unconditionally includes asm-generic/topology.h, all uses
of cpu_to_node are preprocessed to (0).  Similar damage occurs with
every other topology function which happens to be a real function
instead of a macro.  I'm surprised my ppc64 numa systems even boot ;)

If the intent is that the architecture is free to define only a subset
of the api and include the generic header for fallback definitions,
then we need to do the #ifndef __HAVE_ARCH_FOO thing, no?  That is,
the code above would look like:

----

asm-generic/topology.h:

#ifndef __HAVE_ARCH_CPU_TO_NODE
#define cpu_to_node(cpu)        (0)
#endif

----

asm-ppc64/topology.h:

#define __HAVE_ARCH_CPU_TO_NODE
static inline int cpu_to_node(int cpu)
{
        int node;

        node = numa_cpu_lookup_table[cpu];
	....

----

Thought I'd ask for input first since this would involve a sweep of
include/asm-*.


Nathan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-08-01  8:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-22 21:33 topology api confusion Nathan Lynch
2005-07-25 21:41 ` Matthew Dobson
2005-07-25 23:25   ` Nathan Lynch
2005-07-26 15:16   ` Bill Davidsen
2005-08-01  5:07 ` Anton Blanchard
2005-08-01  5:22   ` Nathan Lynch
2005-08-01  8:10   ` Paul Mackerras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox