mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Yinghai Lu" <yhlu.kernel@gmail.com>
To: "Sam Ravnborg" <sam@ravnborg.org>
Cc: "Ingo Molnar" <mingo@elte.hu>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: RFC [PATCH] x86: make generic arch support NUMAQ
Date: Thu, 5 Jun 2008 10:26:46 -0700	[thread overview]
Message-ID: <86802c440806051026o113a3b0kea16d49cdfb9d488@mail.gmail.com> (raw)
In-Reply-To: <20080605110002.GB17961@uranus.ravnborg.org>

On Thu, Jun 5, 2008 at 4:00 AM, Sam Ravnborg <sam@ravnborg.org> wrote:
> Hi Yinghai Lu.
>
> Some random comments after skimming through the diff.
>
> In general I like the simplification moving numaq.
> But there is too much ifdef going on - and it
> can be done better.
> Part of this may belong in a followup patch - other parts
> should be addressed in this patch.
>
>> +#if defined(CONFIG_X86_NUMAQ) || defined(CONFIG_X86_GENERICARCH)
>
> I counted several places where you test for the above.
> Introducing a CONFIG_X86_NUMAQ_OR_GENERIC would simplify stuff.
>
>
>> -obj-$(CONFIG_X86_NUMAQ)              += numaq_32.o
>> +
>> +ifeq ($(CONFIG_X86_NUMAQ), y)
>> +obj-y                                += numaq_32.o
>> +else
>> +ifeq ($(CONFIG_X86_GENERICARCH), y)
>> +obj-$(CONFIG_NUMA)           += numaq_32.o
>> +endif
>> +endif
>
> Can we move these dependencies to Kconfig?
> It should looks roughtly like this in the Makefile:
>
> obj-$(CONFIG_X86_NUMAQ)           += numaq_32.o
> obj-$(CONFIG_X86_NUMA_OR_GENERIC) += numaq_32.o
>
>
>> -#ifndef CONFIG_X86_NUMAQ
>>  static void __init setup_ioapic_ids_from_mpc(void)
>>  {
>>       union IO_APIC_reg_00 reg_00;
>> @@ -1725,6 +1724,11 @@ static void __init setup_ioapic_ids_from_mpc(void)
>>       unsigned char old_id;
>>       unsigned long flags;
>>
>> +#if defined(CONFIG_X86_NUMAQ) || defined(CONFIG_X86_GENERICARCH)
>> +     if (found_numaq)
>> +             return;
>> +#endif
> This ifdef should be found in a .h file defining a simple inline.
> Then you could just do:
>        if (found_numaq())
>                return;
>
>> +
>> +int mp_bus_id_to_node[MAX_MP_BUSSES];
>> +
>> +int mp_bus_id_to_local[MAX_MP_BUSSES];
>
> static? and introduce helper functions with proper
> prototypes in a .h file?
>
>> +++ b/arch/x86/mach-generic/probe.c
>> @@ -16,6 +16,9 @@
>>  #include <asm/apicdef.h>
>>  #include <asm/genapic.h>
>>
>> +#ifdef CONFIG_NUMA
>> +extern struct genapic apic_numaq;
>> +#endif
>
> No reason to use ifdef araound a extern.
>
>> diff --git a/arch/x86/pci/Makefile_32 b/arch/x86/pci/Makefile_32
>> index 89ec35d..88d6fcc 100644
>> --- a/arch/x86/pci/Makefile_32
>> +++ b/arch/x86/pci/Makefile_32
>> @@ -16,7 +16,13 @@ pci-y                              += legacy.o irq.o
>>  # Careful: VISWS and NUMAQ overrule the pci-y above. The colons are
>>  # therefor correct. This needs a proper fix by distangling the code.
>>  pci-$(CONFIG_X86_VISWS)              := visws.o fixup.o
>> -pci-$(CONFIG_X86_NUMAQ)              := numa.o irq.o
>> +
>> +ifeq ($(CONFIG_X86_NUMAQ), y)
>> +pci-y                                := numa.o irq.o
>> +endif
>> +ifeq ($(CONFIG_X86_GENERICARCH), y)
>> +pci-y                                += numa.o
>> +endif
>
> Use:
> pci-$(CONFIG_X86_NUMAQ)       :=  numa.o irq.o
> pci-$(CONFIG_X86_GENERICARCH) += numa.o
>
>
>> diff --git a/arch/x86/pci/numa.c b/arch/x86/pci/numa.c
>> index d9afbae..a4ff536 100644
>> --- a/arch/x86/pci/numa.c
>> +++ b/arch/x86/pci/numa.c
>> @@ -11,38 +11,18 @@
>>  #define XQUAD_PORTIO_BASE 0xfe400000
>>  #define XQUAD_PORTIO_QUAD 0x40000  /* 256k per quad. */
>>
>> -int mp_bus_id_to_node[MAX_MP_BUSSES];
>> +extern int mp_bus_id_to_node[MAX_MP_BUSSES];
>>  #define BUS2QUAD(global) (mp_bus_id_to_node[global])
>>
>> -int mp_bus_id_to_local[MAX_MP_BUSSES];
>> +extern int mp_bus_id_to_local[MAX_MP_BUSSES];
>>  #define BUS2LOCAL(global) (mp_bus_id_to_local[global])
>
> Move extern to .h file and consider introducing a helper function.
>
>> --- a/include/asm-x86/mmzone_32.h
>> +++ b/include/asm-x86/mmzone_32.h
>> @@ -12,9 +12,10 @@
>>  extern struct pglist_data *node_data[];
>>  #define NODE_DATA(nid)       (node_data[nid])
>>
>> -#ifdef CONFIG_X86_NUMAQ
>> +#if defined(CONFIG_X86_NUMAQ) || defined(CONFIG_X86_GENERICARCH)
>>       #include <asm/numaq.h>
>> -#elif defined(CONFIG_ACPI_SRAT)/* summit or generic arch */
>> +#endif
>> +#if defined(CONFIG_ACPI_SRAT)/* summit or generic arch */
>>       #include <asm/srat.h>
>>  #endif
>
> Move ifdef to .h files.
> If at all needed.
>
>> +#if defined(CONFIG_ACPI_SRAT)
>>       if (get_memcfg_from_srat())
>>               return;
>>  #endif
>
> Create a dummy inline in a .h file for this function
> so we can drop the ifdef here.
>
Thanks, will check it.

YH

  parent reply	other threads:[~2008-06-05 17:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-05 10:09 Yinghai Lu
2008-06-05 11:00 ` Sam Ravnborg
2008-06-05 12:39   ` Ingo Molnar
2008-06-05 17:33     ` Yinghai Lu
2008-06-05 17:26   ` Yinghai Lu [this message]
2008-06-06  0:14 ` [PATCH] x86: make generic arch support NUMAQ v2 Yinghai Lu
2008-06-06  0:54   ` Yinghai Lu
2008-06-06  6:17     ` Sam Ravnborg
2008-06-06  6:27       ` Yinghai Lu
2008-06-06 14:09         ` Ingo Molnar
2008-06-06 18:05           ` Yinghai Lu
2008-06-06 21:41   ` [PATCH] x86: make generic arch support NUMAQ v3 Yinghai Lu
2008-06-07  7:31     ` [PATCH] x86: make generic arch support NUMAQ v4 Yinghai Lu
2008-06-09  1:29       ` [PATCH] x86: introduce max_physical_apicid for bigsmp switching Yinghai Lu
2008-06-10  9:53         ` Ingo Molnar
2008-06-09  1:31       ` [PATCH] x86: make generic arch support NUMAQ v5 Yinghai Lu
2008-06-09 14:41         ` Andy Whitcroft
2008-06-09 18:00           ` Yinghai Lu
2008-06-10  0:00         ` [PATCH] x86: make generic arch support NUMAQ - fix Yinghai Lu
2008-06-10  1:11         ` [PATCH] x86: make generic arch support NUMAQ - fix #2 Yinghai Lu
2008-06-10  9:55         ` [PATCH] x86: make generic arch support NUMAQ v5 Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86802c440806051026o113a3b0kea16d49cdfb9d488@mail.gmail.com \
    --to=yhlu.kernel@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sam@ravnborg.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®