Bug 2069 - SRAT parsing code is duplicated
Summary: SRAT parsing code is duplicated
Status: REJECTED WILL_NOT_FIX
Alias: None
Product: ACPI
Classification: Unclassified
Component: Config-Tables (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: ykzhao
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-09 23:14 UTC by Len Brown
Modified: 2007-10-26 00:16 UTC (History)
3 users (show)

See Also:
Kernel Version: 2.6
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description Len Brown 2004-02-09 23:14:23 UTC
ia64 NUMA uses drivers/acpi/numa.c to parse the SRAT. 
ia32 NUMA uses arch/i386/kernel/srat.c to parse the SRAT. 
 
the SRAT table parsing code should appear in 1 place.
Comment 1 keith mannthey 2006-09-28 16:24:47 UTC
As well as x86_64 arch/x86_64/mm/srat.c.  Besides all 3 versions being diffrent
I know for sure x86_64 has a RESERVED based hot-add memory solution built into
it that will have to be a config option for the generic case.  

I have access to all 3 machines types (ia64/x86_64/i386) and can start looking
at this sometime during 2.6.19 with any luck. 
Comment 2 keith mannthey 2006-10-06 16:07:41 UTC
Rignt now 2.6.18ish it seems acpi_numa_memory_affinity_init and
acpi_numa_processor_affinity_init are arch independant.  Do we think these
should all be arch generic functions and have numa.c do everything?
Comment 3 Natalie Protasevich 2007-10-15 22:46:32 UTC
Keith,
I think this has been finally worked out, many felt same way you did about duplicating things between x86_64 and ia32. I just tested latest git tree and it was working great. Have you tried it by chance? Take a look and if you like what you see then we can close this issue. The common arch is arch/x86. commit 89039b37be7c34194db0e72f956a5f02cfa30941 and several others by Thomas Gleixner (and several others)
Thanks.
Comment 4 ykzhao 2007-10-16 00:17:58 UTC
Now ia32/ia64/x86_64 all support numa architecture and will get the memory affinity by parsing SRAT. But it is different how and where to parse SRAT table. 
1.ia32 : The parse of ACPI table is required by the parse of parse the SRAT in drivers/acpi/numa.c, But before acpi table is parsed, kmap_init is required, which is called by paginig_init. In order to initialize the paging_init, it is required that memory affinity in numa is known.For example : max pfn, end_pfn, the size of physical memory. And the memory affinity is obtained by parse SRAT table. So it is   required that the SRAT table should be parsed first in IA32 architeture. 
2.IA64 and X86_64 have the similiar flowcharts. And x86_64 is described in the following.
  a .BSP first sets up the premilinary memory mapping mechanism, which is enough for parse acpi table. 
  b. ACPI tables are initialized by the OS.(acpi_boot_table_init).
  c. Parse the memory affinity of numa if SRAT table exists. And acpi_numa_init is realized in drivers/acpi/numa.c
  d. Call paging_init. 

From the above analysis it seems that IA32 and X86_64 can't use the SRAT parsing  code to parse SRAT table.
Comment 5 ykzhao 2007-10-26 00:15:57 UTC
Based on the comment #4, the flowchart of parsing SRAT table is related with how memory is initialized. the IA32 and IA64(x86_64) can't use the same SRAT parsing cide to parse SRAT table. It is difficult to merge the SRAT parsing code of IA32 and IA64(x86_64).

Note You need to log in before you can comment on or make changes to this bug.