linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFC: ACPI table overflow handling
@ 2004-01-08 14:45 Jes Sorensen
  2004-01-08 16:20 ` [ACPI] " Bjorn Helgaas
  0 siblings, 1 reply; 10+ messages in thread
From: Jes Sorensen @ 2004-01-08 14:45 UTC (permalink / raw)
  To: linux-kernel; +Cc: acpi-devel, jbarnes, steiner

Hi,

We ran into a problem with the current ACPI NUMA code overflowing an
array if the number of CPUs found in the SRAT was greater than NR_CPUS.

Looking at the acpi_table_parse_madt() I noticed that it doesn't do
anything to handle overflows, instead it relies on hacks in the
call-back functions to come up with a check instead, the various checks
in place are somewhat inconsistent in their implementation.

I could just hack the NUMA srat_num_cpus handling code to have a limit
as IMHO it is a lot cleaner to improve the acpi_table_parse_madt() API
by adding a max_entries argument and then have acpi_table_parse_madt
spit out a warning if it found too many entries.

Patch attached, it was generated against 2.6.0-test11 but applies fine
with a little fuzz to 2.6.1-rc2 (my apologies for not having fixed
x86_64 yet, it should be trivial to apply the i386 changes to the x86_64
tree as well).

I'd appreciate comments/oppinions/suggestions?

Thanks,
Jes

diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/arch/i386/kernel/acpi/boot.c linux-2.6.0-test11-ia64/arch/i386/kernel/acpi/boot.c
--- orig/linux-2.6.0-test11-ia64/arch/i386/kernel/acpi/boot.c	Wed Nov 26 12:45:28 2003
+++ linux-2.6.0-test11-ia64/arch/i386/kernel/acpi/boot.c	Thu Jan  8 05:11:49 2004
@@ -44,8 +44,8 @@
 extern int acpi_irq;
 extern int acpi_ht;
 
-int acpi_lapic = 0;
-int acpi_ioapic = 0;
+int acpi_lapic;
+int acpi_ioapic;
 
 /* --------------------------------------------------------------------------
                               Boot-time Configuration
@@ -418,7 +418,7 @@
 	 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
 	 */
 
-	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr);
+	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 65536);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
 		return result;
@@ -426,7 +426,8 @@
 
 	mp_register_lapic_address(acpi_lapic_addr);
 
-	result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic);
+	result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
+				       MAX_APICS);
 	if (!result) { 
 		printk(KERN_ERR PREFIX "No LAPIC entries present\n");
 		/* TBD: Cleanup to allow fallback to MPS */
@@ -438,7 +439,7 @@
 		return result;
 	}
 
-	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi);
+	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 65536);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
@@ -475,8 +476,8 @@
 		return 1;
 	}
 
-	result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic);
-	if (!result) { 
+	result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, MAX_IO_APICS);
+	if (!result) {
 		printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
 		return -ENODEV;
 	}
@@ -488,14 +489,14 @@
 	/* Build a default routing table for legacy (ISA) interrupts. */
 	mp_config_acpi_legacy_irqs();
 
-	result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr);
+	result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, NR_IRQ_VECTORS);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
 		return result;
 	}
 
-	result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src);
+	result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, NR_IRQ_VECTORS);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c
--- orig/linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c	Wed Nov 26 12:44:07 2003
+++ linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c	Thu Jan  8 03:03:46 2004
@@ -550,29 +550,34 @@
 
 	/* Local APIC */
 
-	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr) < 0)
+	/*
+	 * For the callback functions that do not have problems with maximum
+	 * table sizes internally, we use 65536 - please adjust if you ever
+	 * build a system with more ;-)
+	 */
+	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 65536) < 0)
 		printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
 
-	if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic) < 1)
+	if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS) < 1)
 		printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC entries\n");
 
-	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi) < 0)
+	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 65536) < 0)
 		printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
 
 	/* I/O APIC */
 
-	if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic) < 1)
+	if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, 256) < 1)
 		printk(KERN_ERR PREFIX "Error parsing MADT - no IOSAPIC entries\n");
 
 	/* System-Level Interrupt Routing */
 
-	if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src) < 0)
+	if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src, ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
 		printk(KERN_ERR PREFIX "Error parsing platform interrupt source entry\n");
 
-	if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr) < 0)
+	if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 65536) < 0)
 		printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
 
-	if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src) < 0)
+	if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 65536) < 0)
 		printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
   skip_madt:
 
diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/drivers/acpi/numa.c linux-2.6.0-test11-ia64/drivers/acpi/numa.c
--- orig/linux-2.6.0-test11-ia64/drivers/acpi/numa.c	Thu Dec 11 04:22:40 2003
+++ linux-2.6.0-test11-ia64/drivers/acpi/numa.c	Thu Jan  8 02:49:24 2004
@@ -38,7 +38,7 @@
 #define Dprintk(x...)
 #endif
 
-extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler);
+extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler, int max_entries);
 
 void __init
 acpi_table_print_srat_entry (
@@ -156,10 +156,11 @@
 int __init
 acpi_table_parse_srat (
 	enum acpi_srat_entry_id	id,
-	acpi_madt_entry_handler	handler)
+	acpi_madt_entry_handler	handler,
+	int max_entries)
 {
 	return acpi_table_parse_madt_family(ACPI_SRAT, sizeof(struct acpi_table_srat),
-					    id, handler);
+					    id, handler, max_entries);
 }
 
 
@@ -173,9 +174,11 @@
 
 	if (result > 0) {
 		result = acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY,
-					       acpi_parse_processor_affinity);
+					       acpi_parse_processor_affinity,
+					       NR_CPUS);
 		result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY,
-					       acpi_parse_memory_affinity);
+					       acpi_parse_memory_affinity,
+					       NR_MEMBLKS);
 	} else {
 		/* FIXME */
 		printk("Warning: acpi_table_parse(ACPI_SRAT) returned %d!\n",result);
diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/drivers/acpi/tables.c linux-2.6.0-test11-ia64/drivers/acpi/tables.c
--- orig/linux-2.6.0-test11-ia64/drivers/acpi/tables.c	Thu Dec 11 04:22:40 2003
+++ linux-2.6.0-test11-ia64/drivers/acpi/tables.c	Thu Jan  8 04:46:09 2004
@@ -295,13 +295,14 @@
 	enum acpi_table_id	id,
 	unsigned long		madt_size,
 	int			entry_id,
-	acpi_madt_entry_handler	handler)
+	acpi_madt_entry_handler	handler,
+	int			max_entries)
 {
 	void			*madt = NULL;
-	acpi_table_entry_header	*entry = NULL;
-	unsigned long		count = 0;
-	unsigned long		madt_end = 0;
-	unsigned int			i = 0;
+	acpi_table_entry_header	*entry;
+	unsigned int		count = 0;
+	unsigned long		madt_end;
+	unsigned int		i;
 
 	if (!handler)
 		return -EINVAL;
@@ -335,13 +336,17 @@
 		((unsigned long) madt + madt_size);
 
 	while (((unsigned long) entry) < madt_end) {
-		if (entry->type == entry_id) {
-			count++;
+		if (entry->type == entry_id && count++ < max_entries)
 			handler(entry);
-		}
+
 		entry = (acpi_table_entry_header *)
 			((unsigned long) entry + entry->length);
 	}
+	if (count > max_entries) {
+		printk(KERN_WARNING PREFIX "[%s:0x%02x] ignored %i entries of "
+		       "%i found\n", acpi_table_signatures[id], entry_id,
+		       count - max_entries, count);
+	}
 
 	return count;
 }
@@ -350,10 +355,11 @@
 int __init
 acpi_table_parse_madt (
 	enum acpi_madt_entry_id	id,
-	acpi_madt_entry_handler	handler)
+	acpi_madt_entry_handler	handler,
+	int max_entries)
 {
 	return acpi_table_parse_madt_family(ACPI_APIC, sizeof(struct acpi_table_madt),
-					    id, handler);
+					    id, handler, max_entries);
 }
 
 
@@ -578,4 +584,3 @@
 
 	return 0;
 }
-
diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/include/linux/acpi.h linux-2.6.0-test11-ia64/include/linux/acpi.h
--- orig/linux-2.6.0-test11-ia64/include/linux/acpi.h	Wed Nov 26 12:42:43 2003
+++ linux-2.6.0-test11-ia64/include/linux/acpi.h	Thu Jan  8 03:08:06 2004
@@ -355,8 +355,8 @@
 int acpi_table_init (void);
 int acpi_table_parse (enum acpi_table_id id, acpi_table_handler handler);
 int acpi_get_table_header_early (enum acpi_table_id id, struct acpi_table_header **header);
-int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler);
-int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler);
+int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler, int max_entries);
+int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler, int max_entries);
 void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr);
 void acpi_table_print_madt_entry (acpi_table_entry_header *madt);
 void acpi_table_print_srat_entry (acpi_table_entry_header *srat);

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

* Re: [ACPI] RFC: ACPI table overflow handling
  2004-01-08 14:45 RFC: ACPI table overflow handling Jes Sorensen
@ 2004-01-08 16:20 ` Bjorn Helgaas
  2004-01-11 11:49   ` Jes Sorensen
  2004-01-11 14:30   ` Jes Sorensen
  0 siblings, 2 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2004-01-08 16:20 UTC (permalink / raw)
  To: Jes Sorensen, linux-kernel; +Cc: acpi-devel, jbarnes, steiner

On Thursday 08 January 2004 7:45 am, Jes Sorensen wrote:
> I could just hack the NUMA srat_num_cpus handling code to have a limit
> as IMHO it is a lot cleaner to improve the acpi_table_parse_madt() API
> by adding a max_entries argument and then have acpi_table_parse_madt
> spit out a warning if it found too many entries.

I really like this idea.  I notice you didn't take the opportunity to
remove the ad hoc checking in ia64 acpi_parse_lsapic; probably that's
the next step.  Also, did you consider using max_entries==0 to signify
"unlimited"?  Zero seems like an otherwise useless value for max_entries
and would avoid having to choose an arbitrary limit.


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

* Re: [ACPI] RFC: ACPI table overflow handling
  2004-01-08 16:20 ` [ACPI] " Bjorn Helgaas
@ 2004-01-11 11:49   ` Jes Sorensen
  2004-01-11 14:30   ` Jes Sorensen
  1 sibling, 0 replies; 10+ messages in thread
From: Jes Sorensen @ 2004-01-11 11:49 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-kernel, acpi-devel, jbarnes, steiner

>>>>> "Bjorn" == Bjorn Helgaas <bjorn.helgaas@hp.com> writes:

Bjorn> On Thursday 08 January 2004 7:45 am, Jes Sorensen wrote:
>> I could just hack the NUMA srat_num_cpus handling code to have a
>> limit as IMHO it is a lot cleaner to improve the
>> acpi_table_parse_madt() API by adding a max_entries argument and
>> then have acpi_table_parse_madt spit out a warning if it found too
>> many entries.

Bjorn> I really like this idea.  I notice you didn't take the
Bjorn> opportunity to remove the ad hoc checking in ia64
Bjorn> acpi_parse_lsapic; probably that's the next step.  Also, did
Bjorn> you consider using max_entries==0 to signify "unlimited"?  Zero
Bjorn> seems like an otherwise useless value for max_entries and would
Bjorn> avoid having to choose an arbitrary limit.

Hi Bjorn,

Since it seems my efforts weren't for nothing then I'll take another
round on this one and clean it up further. Zero is such a pretty
number so I agree, lets make that be unlimited.

Cheers,
Jes

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

* Re: [ACPI] RFC: ACPI table overflow handling
  2004-01-08 16:20 ` [ACPI] " Bjorn Helgaas
  2004-01-11 11:49   ` Jes Sorensen
@ 2004-01-11 14:30   ` Jes Sorensen
  2004-01-12 16:24     ` Bjorn Helgaas
  1 sibling, 1 reply; 10+ messages in thread
From: Jes Sorensen @ 2004-01-11 14:30 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-kernel, acpi-devel, jbarnes, steiner

>>>>> "Bjorn" == Bjorn Helgaas <bjorn.helgaas@hp.com> writes:

Bjorn> I really like this idea.  I notice you didn't take the
Bjorn> opportunity to remove the ad hoc checking in ia64
Bjorn> acpi_parse_lsapic; probably that's the next step.  Also, did
Bjorn> you consider using max_entries==0 to signify "unlimited"?  Zero
Bjorn> seems like an otherwise useless value for max_entries and would
Bjorn> avoid having to choose an arbitrary limit.

Ok,

Here is a new version of the acpi patch, it uses 0 as 'unlimited' as
suggested by Bjorn and also removes two now obsolete ad-hoc overflow
tests as well as introduces x86_64 changes (not tested).

Cheers,
Jes

diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/arch/i386/kernel/acpi/boot.c linux-2.6.0-test11-ia64/arch/i386/kernel/acpi/boot.c
--- orig/linux-2.6.0-test11-ia64/arch/i386/kernel/acpi/boot.c	Wed Nov 26 12:45:28 2003
+++ linux-2.6.0-test11-ia64/arch/i386/kernel/acpi/boot.c	Sun Jan 11 05:16:24 2004
@@ -44,8 +44,8 @@
 extern int acpi_irq;
 extern int acpi_ht;
 
-int acpi_lapic = 0;
-int acpi_ioapic = 0;
+int acpi_lapic;
+int acpi_ioapic;
 
 /* --------------------------------------------------------------------------
                               Boot-time Configuration
@@ -418,7 +418,7 @@
 	 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
 	 */
 
-	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr);
+	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
 		return result;
@@ -426,7 +426,8 @@
 
 	mp_register_lapic_address(acpi_lapic_addr);
 
-	result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic);
+	result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
+				       MAX_APICS);
 	if (!result) { 
 		printk(KERN_ERR PREFIX "No LAPIC entries present\n");
 		/* TBD: Cleanup to allow fallback to MPS */
@@ -438,7 +439,7 @@
 		return result;
 	}
 
-	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi);
+	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
@@ -475,8 +476,8 @@
 		return 1;
 	}
 
-	result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic);
-	if (!result) { 
+	result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, MAX_IO_APICS);
+	if (!result) {
 		printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
 		return -ENODEV;
 	}
@@ -488,14 +489,14 @@
 	/* Build a default routing table for legacy (ISA) interrupts. */
 	mp_config_acpi_legacy_irqs();
 
-	result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr);
+	result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, NR_IRQ_VECTORS);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
 		return result;
 	}
 
-	result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src);
+	result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, NR_IRQ_VECTORS);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c
--- orig/linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c	Wed Nov 26 12:44:07 2003
+++ linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c	Sun Jan 11 05:15:22 2004
@@ -189,8 +189,6 @@
 
 	if (!lsapic->flags.enabled)
 		printk(" disabled");
-	else if (available_cpus >= NR_CPUS)
-		printk(" ignored (increase NR_CPUS)");
 	else {
 		printk(" enabled");
 #ifdef CONFIG_SMP
@@ -393,12 +391,6 @@
 	size = ma->length_hi;
 	size = (size << 32) | ma->length_lo;
 
-	if (num_memblks >= NR_MEMBLKS) {
-		printk(KERN_ERR "Too many mem chunks in SRAT. Ignoring %ld MBytes at %lx\n",
-		       size/(1024*1024), paddr);
-		return;
-	}
-
 	/* Ignore disabled entries */
 	if (!ma->flags.enabled)
 		return;
@@ -550,29 +542,29 @@
 
 	/* Local APIC */
 
-	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr) < 0)
+	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0)
 		printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
 
-	if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic) < 1)
+	if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS) < 1)
 		printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC entries\n");
 
-	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi) < 0)
+	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0) < 0)
 		printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
 
 	/* I/O APIC */
 
-	if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic) < 1)
+	if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, 256) < 1)
 		printk(KERN_ERR PREFIX "Error parsing MADT - no IOSAPIC entries\n");
 
 	/* System-Level Interrupt Routing */
 
-	if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src) < 0)
+	if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src, ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
 		printk(KERN_ERR PREFIX "Error parsing platform interrupt source entry\n");
 
-	if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr) < 0)
+	if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0)
 		printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
 
-	if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src) < 0)
+	if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 0) < 0)
 		printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
   skip_madt:
 
diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/arch/x86_64/kernel/acpi/boot.c linux-2.6.0-test11-ia64/arch/x86_64/kernel/acpi/boot.c
--- orig/linux-2.6.0-test11-ia64/arch/x86_64/kernel/acpi/boot.c	Wed Nov 26 12:43:24 2003
+++ linux-2.6.0-test11-ia64/arch/x86_64/kernel/acpi/boot.c	Sun Jan 11 05:31:58 2004
@@ -46,8 +46,8 @@
 #include <asm/proto.h>
 #include <asm/tlbflush.h>
 
-int acpi_lapic = 0;
-int acpi_ioapic = 0;
+int acpi_lapic;
+int acpi_ioapic;
 
 #define PREFIX			"ACPI: "
 
@@ -398,7 +398,7 @@
 	 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
 	 */
 
-	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr);
+	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
 		return result;
@@ -406,7 +406,8 @@
 
 	mp_register_lapic_address(acpi_lapic_addr);
 
-	result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic);
+	result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
+				       MAX_APICS);
 	if (!result) { 
 		printk(KERN_ERR PREFIX "No LAPIC entries present\n");
 		/* TBD: Cleanup to allow fallback to MPS */
@@ -418,7 +419,7 @@
 		return result;
 	}
 
-	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi);
+	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
@@ -455,8 +456,8 @@
 		return 1;
 	}
 
-	result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic);
-	if (!result) { 
+	result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, MAX_IO_APICS);
+	if (!result) {
 		printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
 		return -ENODEV;
 	}
@@ -468,14 +469,15 @@
 	/* Build a default routing table for legacy (ISA) interrupts. */
 	mp_config_acpi_legacy_irqs();
 
-	result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr);
+	result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, NR_IRQ_VECTORS);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
 		return result;
 	}
 
-	result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src);
+	result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src,
+				       NO_IRQ_VECTORS);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/drivers/acpi/numa.c linux-2.6.0-test11-ia64/drivers/acpi/numa.c
--- orig/linux-2.6.0-test11-ia64/drivers/acpi/numa.c	Thu Dec 11 04:22:40 2003
+++ linux-2.6.0-test11-ia64/drivers/acpi/numa.c	Thu Jan  8 02:49:24 2004
@@ -38,7 +38,7 @@
 #define Dprintk(x...)
 #endif
 
-extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler);
+extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler, int max_entries);
 
 void __init
 acpi_table_print_srat_entry (
@@ -156,10 +156,11 @@
 int __init
 acpi_table_parse_srat (
 	enum acpi_srat_entry_id	id,
-	acpi_madt_entry_handler	handler)
+	acpi_madt_entry_handler	handler,
+	int max_entries)
 {
 	return acpi_table_parse_madt_family(ACPI_SRAT, sizeof(struct acpi_table_srat),
-					    id, handler);
+					    id, handler, max_entries);
 }
 
 
@@ -173,9 +174,11 @@
 
 	if (result > 0) {
 		result = acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY,
-					       acpi_parse_processor_affinity);
+					       acpi_parse_processor_affinity,
+					       NR_CPUS);
 		result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY,
-					       acpi_parse_memory_affinity);
+					       acpi_parse_memory_affinity,
+					       NR_MEMBLKS);
 	} else {
 		/* FIXME */
 		printk("Warning: acpi_table_parse(ACPI_SRAT) returned %d!\n",result);
diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/drivers/acpi/tables.c linux-2.6.0-test11-ia64/drivers/acpi/tables.c
--- orig/linux-2.6.0-test11-ia64/drivers/acpi/tables.c	Thu Dec 11 04:22:40 2003
+++ linux-2.6.0-test11-ia64/drivers/acpi/tables.c	Sun Jan 11 05:38:51 2004
@@ -295,13 +295,14 @@
 	enum acpi_table_id	id,
 	unsigned long		madt_size,
 	int			entry_id,
-	acpi_madt_entry_handler	handler)
+	acpi_madt_entry_handler	handler,
+	int			max_entries)
 {
 	void			*madt = NULL;
-	acpi_table_entry_header	*entry = NULL;
-	unsigned long		count = 0;
-	unsigned long		madt_end = 0;
-	unsigned int			i = 0;
+	acpi_table_entry_header	*entry;
+	unsigned int		count = 0;
+	unsigned long		madt_end;
+	unsigned int		i;
 
 	if (!handler)
 		return -EINVAL;
@@ -335,13 +336,18 @@
 		((unsigned long) madt + madt_size);
 
 	while (((unsigned long) entry) < madt_end) {
-		if (entry->type == entry_id) {
-			count++;
+		if (entry->type == entry_id &&
+		    (!max_entries || count++ < max_entries))
 			handler(entry);
-		}
+
 		entry = (acpi_table_entry_header *)
 			((unsigned long) entry + entry->length);
 	}
+	if (max_entries && count > max_entries) {
+		printk(KERN_WARNING PREFIX "[%s:0x%02x] ignored %i entries of "
+		       "%i found\n", acpi_table_signatures[id], entry_id,
+		       count - max_entries, count);
+	}
 
 	return count;
 }
@@ -350,10 +356,11 @@
 int __init
 acpi_table_parse_madt (
 	enum acpi_madt_entry_id	id,
-	acpi_madt_entry_handler	handler)
+	acpi_madt_entry_handler	handler,
+	int max_entries)
 {
 	return acpi_table_parse_madt_family(ACPI_APIC, sizeof(struct acpi_table_madt),
-					    id, handler);
+					    id, handler, max_entries);
 }
 
 
@@ -578,4 +585,3 @@
 
 	return 0;
 }
-
diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/include/linux/acpi.h linux-2.6.0-test11-ia64/include/linux/acpi.h
--- orig/linux-2.6.0-test11-ia64/include/linux/acpi.h	Wed Nov 26 12:42:43 2003
+++ linux-2.6.0-test11-ia64/include/linux/acpi.h	Thu Jan  8 03:08:06 2004
@@ -355,8 +355,8 @@
 int acpi_table_init (void);
 int acpi_table_parse (enum acpi_table_id id, acpi_table_handler handler);
 int acpi_get_table_header_early (enum acpi_table_id id, struct acpi_table_header **header);
-int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler);
-int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler);
+int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler, int max_entries);
+int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler, int max_entries);
 void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr);
 void acpi_table_print_madt_entry (acpi_table_entry_header *madt);
 void acpi_table_print_srat_entry (acpi_table_entry_header *srat);

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

* Re: [ACPI] RFC: ACPI table overflow handling
  2004-01-11 14:30   ` Jes Sorensen
@ 2004-01-12 16:24     ` Bjorn Helgaas
  2004-01-13  9:49       ` Jes Sorensen
  2004-01-13 13:13       ` [patch] ia64 header cleanup Jes Sorensen
  0 siblings, 2 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2004-01-12 16:24 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: linux-kernel, acpi-devel, jbarnes, steiner

On Sunday 11 January 2004 7:30 am, Jes Sorensen wrote:
> +++ linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c	Sun Jan 11 05:15:22 2004
> -	if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic) < 1)
> +	if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, 256) < 1)

The "256" looks like it's based on the "iosapic_lists[256]" definition.
We probably should introduce a #define for those cases (sorry, I should
have noticed this the first time).

> +++ linux-2.6.0-test11-ia64/arch/x86_64/kernel/acpi/boot.c	Sun Jan 11 05:31:58 2004
> +	result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, NR_IRQ_VECTORS);
>...
> +	result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src,
> +				       NO_IRQ_VECTORS);

Is NO_IRQ_VECTORS a typo for NR_IRQ_VECTORS?

> +++ linux-2.6.0-test11-ia64/drivers/acpi/numa.c	Thu Jan  8 02:49:24 2004
>  acpi_table_parse_srat (
>  	enum acpi_srat_entry_id	id,
> -	acpi_madt_entry_handler	handler)
> +	acpi_madt_entry_handler	handler,
> +	int max_entries)

Should "max_entries" be unsigned?  I notice you used unsigned types in the
implementation, i.e., "count".

Bjorn


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

* Re: [ACPI] RFC: ACPI table overflow handling
  2004-01-12 16:24     ` Bjorn Helgaas
@ 2004-01-13  9:49       ` Jes Sorensen
  2004-01-13 10:45         ` [patch] ACPI NUMA quiet printk and cleanup Jes Sorensen
  2004-01-13 23:01         ` [ACPI] RFC: ACPI table overflow handling Bjorn Helgaas
  2004-01-13 13:13       ` [patch] ia64 header cleanup Jes Sorensen
  1 sibling, 2 replies; 10+ messages in thread
From: Jes Sorensen @ 2004-01-13  9:49 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-kernel, acpi-devel, jbarnes, steiner

>>>>> "Bjorn" == Bjorn Helgaas <bjorn.helgaas@hp.com> writes:

Bjorn> On Sunday 11 January 2004 7:30 am, Jes Sorensen wrote:
>> (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, 256)

Bjorn> The "256" looks like it's based on the "iosapic_lists[256]"
Bjorn> definition.  We probably should introduce a #define for those
Bjorn> cases (sorry, I should have noticed this the first time).

No problem, easy fix.

>> +++ linux-2.6.0-test11-ia64/arch/x86_64/kernel/acpi/boot.c Sun Jan
>> 11 05:31:58 2004 + result =
Bjorn> Is NO_IRQ_VECTORS a typo for NR_IRQ_VECTORS?

Yup typo, thanks for catching this one.

>> +++ linux-2.6.0-test11-ia64/drivers/acpi/numa.c Thu Jan 8 02:49:24
>> 2004 acpi_table_parse_srat ( enum acpi_srat_entry_id id, -
>> acpi_madt_entry_handler handler) + acpi_madt_entry_handler handler,
>> + int max_entries)

Bjorn> Should "max_entries" be unsigned?  I notice you used unsigned
Bjorn> types in the implementation, i.e., "count".

I have no strong preference since I find it unlikely that anyone will
want to loop it 2^31 times, but for esthetics lets make it unsigned.

How about this one then?

Cheers,
Jes

diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/arch/i386/kernel/acpi/boot.c linux-2.6.0-test11-ia64/arch/i386/kernel/acpi/boot.c
--- orig/linux-2.6.0-test11-ia64/arch/i386/kernel/acpi/boot.c	Wed Nov 26 12:45:28 2003
+++ linux-2.6.0-test11-ia64/arch/i386/kernel/acpi/boot.c	Sun Jan 11 05:16:24 2004
@@ -44,8 +44,8 @@
 extern int acpi_irq;
 extern int acpi_ht;
 
-int acpi_lapic = 0;
-int acpi_ioapic = 0;
+int acpi_lapic;
+int acpi_ioapic;
 
 /* --------------------------------------------------------------------------
                               Boot-time Configuration
@@ -418,7 +418,7 @@
 	 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
 	 */
 
-	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr);
+	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
 		return result;
@@ -426,7 +426,8 @@
 
 	mp_register_lapic_address(acpi_lapic_addr);
 
-	result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic);
+	result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
+				       MAX_APICS);
 	if (!result) { 
 		printk(KERN_ERR PREFIX "No LAPIC entries present\n");
 		/* TBD: Cleanup to allow fallback to MPS */
@@ -438,7 +439,7 @@
 		return result;
 	}
 
-	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi);
+	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
@@ -475,8 +476,8 @@
 		return 1;
 	}
 
-	result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic);
-	if (!result) { 
+	result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, MAX_IO_APICS);
+	if (!result) {
 		printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
 		return -ENODEV;
 	}
@@ -488,14 +489,14 @@
 	/* Build a default routing table for legacy (ISA) interrupts. */
 	mp_config_acpi_legacy_irqs();
 
-	result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr);
+	result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, NR_IRQ_VECTORS);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
 		return result;
 	}
 
-	result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src);
+	result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, NR_IRQ_VECTORS);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c
--- orig/linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c	Wed Nov 26 12:44:07 2003
+++ linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c	Tue Jan 13 01:30:49 2004
@@ -189,8 +189,6 @@
 
 	if (!lsapic->flags.enabled)
 		printk(" disabled");
-	else if (available_cpus >= NR_CPUS)
-		printk(" ignored (increase NR_CPUS)");
 	else {
 		printk(" enabled");
 #ifdef CONFIG_SMP
@@ -393,12 +391,6 @@
 	size = ma->length_hi;
 	size = (size << 32) | ma->length_lo;
 
-	if (num_memblks >= NR_MEMBLKS) {
-		printk(KERN_ERR "Too many mem chunks in SRAT. Ignoring %ld MBytes at %lx\n",
-		       size/(1024*1024), paddr);
-		return;
-	}
-
 	/* Ignore disabled entries */
 	if (!ma->flags.enabled)
 		return;
@@ -550,29 +542,29 @@
 
 	/* Local APIC */
 
-	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr) < 0)
+	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0)
 		printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
 
-	if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic) < 1)
+	if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS) < 1)
 		printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC entries\n");
 
-	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi) < 0)
+	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0) < 0)
 		printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
 
 	/* I/O APIC */
 
-	if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic) < 1)
+	if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1)
 		printk(KERN_ERR PREFIX "Error parsing MADT - no IOSAPIC entries\n");
 
 	/* System-Level Interrupt Routing */
 
-	if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src) < 0)
+	if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src, ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
 		printk(KERN_ERR PREFIX "Error parsing platform interrupt source entry\n");
 
-	if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr) < 0)
+	if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0)
 		printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
 
-	if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src) < 0)
+	if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 0) < 0)
 		printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
   skip_madt:
 
diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/arch/ia64/kernel/iosapic.c linux-2.6.0-test11-ia64/arch/ia64/kernel/iosapic.c
--- orig/linux-2.6.0-test11-ia64/arch/ia64/kernel/iosapic.c	Wed Nov 26 12:44:02 2003
+++ linux-2.6.0-test11-ia64/arch/ia64/kernel/iosapic.c	Tue Jan 13 01:29:44 2004
@@ -114,7 +114,7 @@
 	char		*addr;		/* base address of IOSAPIC */
 	unsigned int 	gsi_base;	/* first GSI assigned to this IOSAPIC */
 	unsigned short 	num_rte;	/* number of RTE in this IOSAPIC */
-} iosapic_lists[256];
+} iosapic_lists[NR_IOSAPICS];
 
 static int num_iosapic;
 
diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/arch/x86_64/kernel/acpi/boot.c linux-2.6.0-test11-ia64/arch/x86_64/kernel/acpi/boot.c
--- orig/linux-2.6.0-test11-ia64/arch/x86_64/kernel/acpi/boot.c	Wed Nov 26 12:43:24 2003
+++ linux-2.6.0-test11-ia64/arch/x86_64/kernel/acpi/boot.c	Tue Jan 13 00:33:45 2004
@@ -46,8 +46,8 @@
 #include <asm/proto.h>
 #include <asm/tlbflush.h>
 
-int acpi_lapic = 0;
-int acpi_ioapic = 0;
+int acpi_lapic;
+int acpi_ioapic;
 
 #define PREFIX			"ACPI: "
 
@@ -398,7 +398,7 @@
 	 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
 	 */
 
-	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr);
+	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
 		return result;
@@ -406,7 +406,8 @@
 
 	mp_register_lapic_address(acpi_lapic_addr);
 
-	result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic);
+	result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
+				       MAX_APICS);
 	if (!result) { 
 		printk(KERN_ERR PREFIX "No LAPIC entries present\n");
 		/* TBD: Cleanup to allow fallback to MPS */
@@ -418,7 +419,7 @@
 		return result;
 	}
 
-	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi);
+	result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
@@ -455,8 +456,8 @@
 		return 1;
 	}
 
-	result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic);
-	if (!result) { 
+	result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, MAX_IO_APICS);
+	if (!result) {
 		printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
 		return -ENODEV;
 	}
@@ -468,14 +469,15 @@
 	/* Build a default routing table for legacy (ISA) interrupts. */
 	mp_config_acpi_legacy_irqs();
 
-	result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr);
+	result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, NR_IRQ_VECTORS);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
 		return result;
 	}
 
-	result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src);
+	result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src,
+				       NR_IRQ_VECTORS);
 	if (result < 0) {
 		printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/drivers/acpi/numa.c linux-2.6.0-test11-ia64/drivers/acpi/numa.c
--- orig/linux-2.6.0-test11-ia64/drivers/acpi/numa.c	Thu Dec 11 04:22:40 2003
+++ linux-2.6.0-test11-ia64/drivers/acpi/numa.c	Tue Jan 13 00:49:40 2004
@@ -38,7 +38,7 @@
 #define Dprintk(x...)
 #endif
 
-extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler);
+extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler, unsigned int max_entries);
 
 void __init
 acpi_table_print_srat_entry (
@@ -156,10 +156,11 @@
 int __init
 acpi_table_parse_srat (
 	enum acpi_srat_entry_id	id,
-	acpi_madt_entry_handler	handler)
+	acpi_madt_entry_handler	handler,
+	unsigned int max_entries)
 {
 	return acpi_table_parse_madt_family(ACPI_SRAT, sizeof(struct acpi_table_srat),
-					    id, handler);
+					    id, handler, max_entries);
 }
 
 
@@ -173,9 +174,11 @@
 
 	if (result > 0) {
 		result = acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY,
-					       acpi_parse_processor_affinity);
+					       acpi_parse_processor_affinity,
+					       NR_CPUS);
 		result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY,
-					       acpi_parse_memory_affinity);
+					       acpi_parse_memory_affinity,
+					       NR_MEMBLKS);
 	} else {
 		/* FIXME */
 		printk("Warning: acpi_table_parse(ACPI_SRAT) returned %d!\n",result);
diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/drivers/acpi/tables.c linux-2.6.0-test11-ia64/drivers/acpi/tables.c
--- orig/linux-2.6.0-test11-ia64/drivers/acpi/tables.c	Thu Dec 11 04:22:40 2003
+++ linux-2.6.0-test11-ia64/drivers/acpi/tables.c	Tue Jan 13 00:52:36 2004
@@ -295,13 +295,14 @@
 	enum acpi_table_id	id,
 	unsigned long		madt_size,
 	int			entry_id,
-	acpi_madt_entry_handler	handler)
+	acpi_madt_entry_handler	handler,
+	unsigned int		max_entries)
 {
 	void			*madt = NULL;
-	acpi_table_entry_header	*entry = NULL;
-	unsigned long		count = 0;
-	unsigned long		madt_end = 0;
-	unsigned int			i = 0;
+	acpi_table_entry_header	*entry;
+	unsigned int		count = 0;
+	unsigned long		madt_end;
+	unsigned int		i;
 
 	if (!handler)
 		return -EINVAL;
@@ -335,13 +336,18 @@
 		((unsigned long) madt + madt_size);
 
 	while (((unsigned long) entry) < madt_end) {
-		if (entry->type == entry_id) {
-			count++;
+		if (entry->type == entry_id &&
+		    (!max_entries || count++ < max_entries))
 			handler(entry);
-		}
+
 		entry = (acpi_table_entry_header *)
 			((unsigned long) entry + entry->length);
 	}
+	if (max_entries && count > max_entries) {
+		printk(KERN_WARNING PREFIX "[%s:0x%02x] ignored %i entries of "
+		       "%i found\n", acpi_table_signatures[id], entry_id,
+		       count - max_entries, count);
+	}
 
 	return count;
 }
@@ -350,10 +356,11 @@
 int __init
 acpi_table_parse_madt (
 	enum acpi_madt_entry_id	id,
-	acpi_madt_entry_handler	handler)
+	acpi_madt_entry_handler	handler,
+	unsigned int max_entries)
 {
 	return acpi_table_parse_madt_family(ACPI_APIC, sizeof(struct acpi_table_madt),
-					    id, handler);
+					    id, handler, max_entries);
 }
 
 
@@ -578,4 +585,3 @@
 
 	return 0;
 }
-
diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/include/asm-ia64/iosapic.h linux-2.6.0-test11-ia64/include/asm-ia64/iosapic.h
--- orig/linux-2.6.0-test11-ia64/include/asm-ia64/iosapic.h	Wed Nov 26 12:44:21 2003
+++ linux-2.6.0-test11-ia64/include/asm-ia64/iosapic.h	Tue Jan 13 01:30:32 2004
@@ -52,6 +52,9 @@
 #ifndef __ASSEMBLY__
 
 #ifdef CONFIG_IOSAPIC
+
+#define NR_IOSAPICS			256
+
 extern void __init iosapic_system_init (int pcat_compat);
 extern void __init iosapic_init (unsigned long address,
 				    unsigned int gsi_base);
diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn --exclude='qla1280.[ch]' orig/linux-2.6.0-test11-ia64/include/linux/acpi.h linux-2.6.0-test11-ia64/include/linux/acpi.h
--- orig/linux-2.6.0-test11-ia64/include/linux/acpi.h	Wed Nov 26 12:42:43 2003
+++ linux-2.6.0-test11-ia64/include/linux/acpi.h	Tue Jan 13 00:51:02 2004
@@ -355,8 +355,8 @@
 int acpi_table_init (void);
 int acpi_table_parse (enum acpi_table_id id, acpi_table_handler handler);
 int acpi_get_table_header_early (enum acpi_table_id id, struct acpi_table_header **header);
-int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler);
-int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler);
+int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);
+int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);
 void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr);
 void acpi_table_print_madt_entry (acpi_table_entry_header *madt);
 void acpi_table_print_srat_entry (acpi_table_entry_header *srat);



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

* [patch] ACPI NUMA quiet printk and cleanup
  2004-01-13  9:49       ` Jes Sorensen
@ 2004-01-13 10:45         ` Jes Sorensen
  2004-01-13 23:01         ` [ACPI] RFC: ACPI table overflow handling Bjorn Helgaas
  1 sibling, 0 replies; 10+ messages in thread
From: Jes Sorensen @ 2004-01-13 10:45 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, acpi-devel, Jesse Barnes, Jack Steiner,
	David Mosberger, Bjorn Helgaas

Hi,

I'd love to see the following patch go into -mm. It turns two current
ACPI printk's into ACPI debug messages thgat only shows when
ACPI_DEBUG is enabled and eliminates some excessive NULL
initialization of variables that are immediately being set to their
real value afterwards.

The patch should be very easy to verify - compiled and booted on an sn2.

Thanks,
Jes

diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-jb-acpi-clean/drivers/acpi/numa.c linux-2.6.1/drivers/acpi/numa.c
--- orig/linux-2.6.1-jb-acpi-clean/drivers/acpi/numa.c	Tue Jan 13 02:25:32 2004
+++ linux-2.6.1/drivers/acpi/numa.c	Tue Jan 13 02:38:32 2004
@@ -30,6 +30,7 @@
 #include <linux/errno.h>
 #include <linux/acpi.h>
 #include <acpi/acpi_bus.h>
+#include <acpi/acmacros.h>
 
 extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler, unsigned int max_entries);
 
@@ -46,9 +47,9 @@
 	{
 		struct acpi_table_processor_affinity *p =
 			(struct acpi_table_processor_affinity*) header;
-		printk(KERN_INFO PREFIX "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
 		       p->apic_id, p->lsapic_eid, p->proximity_domain,
-		       p->flags.enabled?"enabled":"disabled");
+		       p->flags.enabled?"enabled":"disabled"));
 	}
 		break;
 
@@ -56,11 +57,11 @@
 	{
 		struct acpi_table_memory_affinity *p =
 			(struct acpi_table_memory_affinity*) header;
-		printk(KERN_INFO PREFIX "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n",
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n",
 		       p->base_addr_hi, p->base_addr_lo, p->length_hi, p->length_lo,
 		       p->memory_type, p->proximity_domain,
 		       p->flags.enabled ? "enabled" : "disabled",
-		       p->flags.hot_pluggable ? " hot-pluggable" : "");
+		       p->flags.hot_pluggable ? " hot-pluggable" : ""));
 	}
 		break;
 
@@ -97,7 +98,7 @@
 static int __init
 acpi_parse_processor_affinity (acpi_table_entry_header *header)
 {
-	struct acpi_table_processor_affinity *processor_affinity = NULL;
+	struct acpi_table_processor_affinity *processor_affinity;
 
 	processor_affinity = (struct acpi_table_processor_affinity*) header;
 	if (!processor_affinity)
@@ -115,7 +116,7 @@
 static int __init
 acpi_parse_memory_affinity (acpi_table_entry_header *header)
 {
-	struct acpi_table_memory_affinity *memory_affinity = NULL;
+	struct acpi_table_memory_affinity *memory_affinity;
 
 	memory_affinity = (struct acpi_table_memory_affinity*) header;
 	if (!memory_affinity)
@@ -133,7 +134,7 @@
 static int __init
 acpi_parse_srat (unsigned long phys_addr, unsigned long size)
 {
-	struct acpi_table_srat	*srat = NULL;
+	struct acpi_table_srat	*srat;
 
 	if (!phys_addr || !size)
 		return -EINVAL;

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

* [patch] ia64 header cleanup
  2004-01-12 16:24     ` Bjorn Helgaas
  2004-01-13  9:49       ` Jes Sorensen
@ 2004-01-13 13:13       ` Jes Sorensen
  1 sibling, 0 replies; 10+ messages in thread
From: Jes Sorensen @ 2004-01-13 13:13 UTC (permalink / raw)
  To: David Mosberger; +Cc: linux-kernel, Jesse Barnes, Jack Steiner, Andrew Morton

Hi David,

I fixed the code to compile with CONFIG_ACPI_NUMA and
!CONFIG_DISCONTIG since it's actually possible to compile that
configuration as well as cleaned up the #include usage a litte.

Patch relative to 2.6.1 - I'd like to suggest it as a candidate for
2.6.2.

Thanks,
Jes

diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-jb-acpi-clean/arch/ia64/mm/numa.c linux-2.6.1-test/arch/ia64/mm/numa.c
--- orig/linux-2.6.1-jb-acpi-clean/arch/ia64/mm/numa.c	Wed Dec 17 18:58:38 2003
+++ linux-2.6.1-test/arch/ia64/mm/numa.c	Mon Jan 12 06:54:38 2004
@@ -18,6 +18,7 @@
 #include <linux/node.h>
 #include <linux/init.h>
 #include <linux/bootmem.h>
+#include <asm/mmzone.h>
 #include <asm/numa.h>
 
 static struct memblk *sysfs_memblks;
@@ -28,7 +29,7 @@
  * The following structures are usually initialized by ACPI or
  * similar mechanisms and describe the NUMA characteristics of the machine.
  */
-int num_memblks = 0;
+int num_memblks;
 struct node_memblk_s node_memblk[NR_MEMBLKS];
 struct node_cpuid_s node_cpuid[NR_CPUS];
 /*
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-jb-acpi-clean/include/asm-ia64/acpi.h linux-2.6.1-test/include/asm-ia64/acpi.h
--- orig/linux-2.6.1-jb-acpi-clean/include/asm-ia64/acpi.h	Sun Jan 11 07:00:36 2004
+++ linux-2.6.1-test/include/asm-ia64/acpi.h	Mon Jan 12 07:20:13 2004
@@ -30,6 +30,8 @@
 
 #ifdef __KERNEL__
 
+#include <linux/init.h>
+#include <linux/numa.h>
 #include <asm/system.h>
 
 #define COMPILER_DEPENDENT_INT64	long
@@ -92,7 +94,6 @@
 int acpi_irq_to_vector (u32 irq);
 
 #ifdef CONFIG_ACPI_NUMA
-#include <asm/numa.h>
 /* Proximity bitmap length; _PXM is at most 255 (8 bit)*/
 #define MAX_PXM_DOMAINS (256)
 extern int __initdata pxm_to_nid_map[MAX_PXM_DOMAINS];
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-jb-acpi-clean/include/asm-ia64/mmzone.h linux-2.6.1-test/include/asm-ia64/mmzone.h
--- orig/linux-2.6.1-jb-acpi-clean/include/asm-ia64/mmzone.h	Wed Dec 17 19:00:01 2003
+++ linux-2.6.1-test/include/asm-ia64/mmzone.h	Mon Jan 12 07:09:14 2004
@@ -33,5 +33,8 @@
 #define page_to_pfn(page)	((unsigned long) (page - vmem_map))
 #define pfn_to_page(pfn)	(vmem_map + (pfn))
 
+#else /* CONFIG_DISCONTIGMEM */
+#define NR_MEMBLKS		1
+
 #endif /* CONFIG_DISCONTIGMEM */
 #endif /* _ASM_IA64_MMZONE_H */
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-jb-acpi-clean/include/asm-ia64/numa.h linux-2.6.1-test/include/asm-ia64/numa.h
--- orig/linux-2.6.1-jb-acpi-clean/include/asm-ia64/numa.h	Sun Jan 11 07:00:36 2004
+++ linux-2.6.1-test/include/asm-ia64/numa.h	Mon Jan 12 06:56:51 2004
@@ -16,7 +16,6 @@
 #ifdef CONFIG_NUMA
 
 #include <linux/cache.h>
-#include <linux/cache.h>
 #include <linux/cpumask.h>
 #include <linux/numa.h>
 #include <linux/smp.h>

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

* Re: [ACPI] RFC: ACPI table overflow handling
  2004-01-13  9:49       ` Jes Sorensen
  2004-01-13 10:45         ` [patch] ACPI NUMA quiet printk and cleanup Jes Sorensen
@ 2004-01-13 23:01         ` Bjorn Helgaas
  1 sibling, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2004-01-13 23:01 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: linux-kernel, acpi-devel, jbarnes, steiner

On Tuesday 13 January 2004 2:49 am, Jes Sorensen wrote:
> How about this one then?

I like it, for whatever that's worth ;-)


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

* Re: [ACPI] RFC: ACPI table overflow handling
       [not found] <BF1FE1855350A0479097B3A0D2A80EE001E60811@hdsmsx402.hd.intel.com>
@ 2004-01-28  5:20 ` Len Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Len Brown @ 2004-01-28  5:20 UTC (permalink / raw)
  To: Jes Sorensen
  Cc: Bjorn Helgaas, linux-kernel, ACPI Developers, jbarnes, steiner

Accepted.

thanks Jes, Bjorn,
-Len

On Tue, 2004-01-13 at 04:49, Jes Sorensen wrote:
> >>>>> "Bjorn" == Bjorn Helgaas <bjorn.helgaas@hp.com> writes:
> 
> Bjorn> On Sunday 11 January 2004 7:30 am, Jes Sorensen wrote:
> >> (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, 256)
> 
> Bjorn> The "256" looks like it's based on the "iosapic_lists[256]"
> Bjorn> definition.  We probably should introduce a #define for those
> Bjorn> cases (sorry, I should have noticed this the first time).
> 
> No problem, easy fix.
> 
> >> +++ linux-2.6.0-test11-ia64/arch/x86_64/kernel/acpi/boot.c Sun Jan
> >> 11 05:31:58 2004 + result =
> Bjorn> Is NO_IRQ_VECTORS a typo for NR_IRQ_VECTORS?
> 
> Yup typo, thanks for catching this one.
> 
> >> +++ linux-2.6.0-test11-ia64/drivers/acpi/numa.c Thu Jan 8 02:49:24
> >> 2004 acpi_table_parse_srat ( enum acpi_srat_entry_id id, -
> >> acpi_madt_entry_handler handler) + acpi_madt_entry_handler handler,
> >> + int max_entries)
> 
> Bjorn> Should "max_entries" be unsigned?  I notice you used unsigned
> Bjorn> types in the implementation, i.e., "count".
> 
> I have no strong preference since I find it unlikely that anyone will
> want to loop it 2^31 times, but for esthetics lets make it unsigned.
> 
> How about this one then?
> 
> Cheers,
> Jes
> 
> diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn
> --exclude='qla1280.[ch]'
> orig/linux-2.6.0-test11-ia64/arch/i386/kernel/acpi/boot.c
> linux-2.6.0-test11-ia64/arch/i386/kernel/acpi/boot.c
> --- orig/linux-2.6.0-test11-ia64/arch/i386/kernel/acpi/boot.c   Wed
> Nov 26 12:45:28 2003
> +++ linux-2.6.0-test11-ia64/arch/i386/kernel/acpi/boot.c        Sun
> Jan 11 05:16:24 2004
> @@ -44,8 +44,8 @@
>  extern int acpi_irq;
>  extern int acpi_ht;
> 
> -int acpi_lapic = 0;
> -int acpi_ioapic = 0;
> +int acpi_lapic;
> +int acpi_ioapic;
> 
>  /*
> --------------------------------------------------------------------------
>                                Boot-time Configuration
> @@ -418,7 +418,7 @@
>          * and (optionally) overriden by a LAPIC_ADDR_OVR entry
> (64-bit value).
>          */
> 
> -       result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,
> acpi_parse_lapic_addr_ovr);
> +       result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,
> acpi_parse_lapic_addr_ovr, 0);
>         if (result < 0) {
>                 printk(KERN_ERR PREFIX "Error parsing LAPIC address
> override entry\n");
>                 return result;
> @@ -426,7 +426,8 @@
> 
>         mp_register_lapic_address(acpi_lapic_addr);
> 
> -       result = acpi_table_parse_madt(ACPI_MADT_LAPIC,
> acpi_parse_lapic);
> +       result = acpi_table_parse_madt(ACPI_MADT_LAPIC,
> acpi_parse_lapic,
> +                                      MAX_APICS);
>         if (!result) {
>                 printk(KERN_ERR PREFIX "No LAPIC entries present\n");
>                 /* TBD: Cleanup to allow fallback to MPS */
> @@ -438,7 +439,7 @@
>                 return result;
>         }
> 
> -       result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI,
> acpi_parse_lapic_nmi);
> +       result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI,
> acpi_parse_lapic_nmi, 0);
>         if (result < 0) {
>                 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI
> entry\n");
>                 /* TBD: Cleanup to allow fallback to MPS */
> @@ -475,8 +476,8 @@
>                 return 1;
>         }
> 
> -       result = acpi_table_parse_madt(ACPI_MADT_IOAPIC,
> acpi_parse_ioapic);
> -       if (!result) {
> +       result = acpi_table_parse_madt(ACPI_MADT_IOAPIC,
> acpi_parse_ioapic, MAX_IO_APICS);
> +       if (!result) {
>                 printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
>                 return -ENODEV;
>         }
> @@ -488,14 +489,14 @@
>         /* Build a default routing table for legacy (ISA) interrupts.
> */
>         mp_config_acpi_legacy_irqs();
> 
> -       result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR,
> acpi_parse_int_src_ovr);
> +       result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR,
> acpi_parse_int_src_ovr, NR_IRQ_VECTORS);
>         if (result < 0) {
>                 printk(KERN_ERR PREFIX "Error parsing interrupt source
> overrides entry\n");
>                 /* TBD: Cleanup to allow fallback to MPS */
>                 return result;
>         }
> 
> -       result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC,
> acpi_parse_nmi_src);
> +       result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC,
> acpi_parse_nmi_src, NR_IRQ_VECTORS);
>         if (result < 0) {
>                 printk(KERN_ERR PREFIX "Error parsing NMI SRC
> entry\n");
>                 /* TBD: Cleanup to allow fallback to MPS */
> diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn
> --exclude='qla1280.[ch]'
> orig/linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c
> linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c
> --- orig/linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c        Wed
> Nov 26 12:44:07 2003
> +++ linux-2.6.0-test11-ia64/arch/ia64/kernel/acpi.c     Tue Jan 13
> 01:30:49 2004
> @@ -189,8 +189,6 @@
> 
>         if (!lsapic->flags.enabled)
>                 printk(" disabled");
> -       else if (available_cpus >= NR_CPUS)
> -               printk(" ignored (increase NR_CPUS)");
>         else {
>                 printk(" enabled");
>  #ifdef CONFIG_SMP
> @@ -393,12 +391,6 @@
>         size = ma->length_hi;
>         size = (size << 32) | ma->length_lo;
> 
> -       if (num_memblks >= NR_MEMBLKS) {
> -               printk(KERN_ERR "Too many mem chunks in SRAT. Ignoring
> %ld MBytes at %lx\n",
> -                      size/(1024*1024), paddr);
> -               return;
> -       }
> -
>         /* Ignore disabled entries */
>         if (!ma->flags.enabled)
>                 return;
> @@ -550,29 +542,29 @@
> 
>         /* Local APIC */
> 
> -       if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,
> acpi_parse_lapic_addr_ovr) < 0)
> +       if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,
> acpi_parse_lapic_addr_ovr, 0) < 0)
>                 printk(KERN_ERR PREFIX "Error parsing LAPIC address
> override entry\n");
> 
> -       if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic)
> < 1)
> +       if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic,
> NR_CPUS) < 1)
>                 printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC
> entries\n");
> 
> -       if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI,
> acpi_parse_lapic_nmi) < 0)
> +       if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI,
> acpi_parse_lapic_nmi, 0) < 0)
>                 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI
> entry\n");
> 
>         /* I/O APIC */
> 
> -       if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC,
> acpi_parse_iosapic) < 1)
> +       if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC,
> acpi_parse_iosapic, NR_IOSAPICS) < 1)
>                 printk(KERN_ERR PREFIX "Error parsing MADT - no
> IOSAPIC entries\n");
> 
>         /* System-Level Interrupt Routing */
> 
> -       if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC,
> acpi_parse_plat_int_src) < 0)
> +       if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC,
> acpi_parse_plat_int_src, ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
>                 printk(KERN_ERR PREFIX "Error parsing platform
> interrupt source entry\n");
> 
> -       if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR,
> acpi_parse_int_src_ovr) < 0)
> +       if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR,
> acpi_parse_int_src_ovr, 0) < 0)
>                 printk(KERN_ERR PREFIX "Error parsing interrupt source
> overrides entry\n");
> 
> -       if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC,
> acpi_parse_nmi_src) < 0)
> +       if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC,
> acpi_parse_nmi_src, 0) < 0)
>                 printk(KERN_ERR PREFIX "Error parsing NMI SRC
> entry\n");
>    skip_madt:
> 
> diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn
> --exclude='qla1280.[ch]'
> orig/linux-2.6.0-test11-ia64/arch/ia64/kernel/iosapic.c
> linux-2.6.0-test11-ia64/arch/ia64/kernel/iosapic.c
> --- orig/linux-2.6.0-test11-ia64/arch/ia64/kernel/iosapic.c     Wed
> Nov 26 12:44:02 2003
> +++ linux-2.6.0-test11-ia64/arch/ia64/kernel/iosapic.c  Tue Jan 13
> 01:29:44 2004
> @@ -114,7 +114,7 @@
>         char            *addr;          /* base address of IOSAPIC */
>         unsigned int    gsi_base;       /* first GSI assigned to this
> IOSAPIC */
>         unsigned short  num_rte;        /* number of RTE in this
> IOSAPIC */
> -} iosapic_lists[256];
> +} iosapic_lists[NR_IOSAPICS];
> 
>  static int num_iosapic;
> 
> diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn
> --exclude='qla1280.[ch]'
> orig/linux-2.6.0-test11-ia64/arch/x86_64/kernel/acpi/boot.c
> linux-2.6.0-test11-ia64/arch/x86_64/kernel/acpi/boot.c
> --- orig/linux-2.6.0-test11-ia64/arch/x86_64/kernel/acpi/boot.c Wed
> Nov 26 12:43:24 2003
> +++ linux-2.6.0-test11-ia64/arch/x86_64/kernel/acpi/boot.c      Tue
> Jan 13 00:33:45 2004
> @@ -46,8 +46,8 @@
>  #include <asm/proto.h>
>  #include <asm/tlbflush.h>
> 
> -int acpi_lapic = 0;
> -int acpi_ioapic = 0;
> +int acpi_lapic;
> +int acpi_ioapic;
> 
>  #define PREFIX                 "ACPI: "
> 
> @@ -398,7 +398,7 @@
>          * and (optionally) overriden by a LAPIC_ADDR_OVR entry
> (64-bit value).
>          */
> 
> -       result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,
> acpi_parse_lapic_addr_ovr);
> +       result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,
> acpi_parse_lapic_addr_ovr, 0);
>         if (result < 0) {
>                 printk(KERN_ERR PREFIX "Error parsing LAPIC address
> override entry\n");
>                 return result;
> @@ -406,7 +406,8 @@
> 
>         mp_register_lapic_address(acpi_lapic_addr);
> 
> -       result = acpi_table_parse_madt(ACPI_MADT_LAPIC,
> acpi_parse_lapic);
> +       result = acpi_table_parse_madt(ACPI_MADT_LAPIC,
> acpi_parse_lapic,
> +                                      MAX_APICS);
>         if (!result) {
>                 printk(KERN_ERR PREFIX "No LAPIC entries present\n");
>                 /* TBD: Cleanup to allow fallback to MPS */
> @@ -418,7 +419,7 @@
>                 return result;
>         }
> 
> -       result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI,
> acpi_parse_lapic_nmi);
> +       result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI,
> acpi_parse_lapic_nmi, 0);
>         if (result < 0) {
>                 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI
> entry\n");
>                 /* TBD: Cleanup to allow fallback to MPS */
> @@ -455,8 +456,8 @@
>                 return 1;
>         }
> 
> -       result = acpi_table_parse_madt(ACPI_MADT_IOAPIC,
> acpi_parse_ioapic);
> -       if (!result) {
> +       result = acpi_table_parse_madt(ACPI_MADT_IOAPIC,
> acpi_parse_ioapic, MAX_IO_APICS);
> +       if (!result) {
>                 printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
>                 return -ENODEV;
>         }
> @@ -468,14 +469,15 @@
>         /* Build a default routing table for legacy (ISA) interrupts.
> */
>         mp_config_acpi_legacy_irqs();
> 
> -       result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR,
> acpi_parse_int_src_ovr);
> +       result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR,
> acpi_parse_int_src_ovr, NR_IRQ_VECTORS);
>         if (result < 0) {
>                 printk(KERN_ERR PREFIX "Error parsing interrupt source
> overrides entry\n");
>                 /* TBD: Cleanup to allow fallback to MPS */
>                 return result;
>         }
> 
> -       result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC,
> acpi_parse_nmi_src);
> +       result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC,
> acpi_parse_nmi_src,
> +                                      NR_IRQ_VECTORS);
>         if (result < 0) {
>                 printk(KERN_ERR PREFIX "Error parsing NMI SRC
> entry\n");
>                 /* TBD: Cleanup to allow fallback to MPS */
> diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn
> --exclude='qla1280.[ch]'
> orig/linux-2.6.0-test11-ia64/drivers/acpi/numa.c
> linux-2.6.0-test11-ia64/drivers/acpi/numa.c
> --- orig/linux-2.6.0-test11-ia64/drivers/acpi/numa.c    Thu Dec 11
> 04:22:40 2003
> +++ linux-2.6.0-test11-ia64/drivers/acpi/numa.c Tue Jan 13 00:49:40
> 2004
> @@ -38,7 +38,7 @@
>  #define Dprintk(x...)
>  #endif
> 
> -extern int __init acpi_table_parse_madt_family (enum acpi_table_id
> id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler
> handler);
> +extern int __init acpi_table_parse_madt_family (enum acpi_table_id
> id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler
> handler, unsigned int max_entries);
> 
>  void __init
>  acpi_table_print_srat_entry (
> @@ -156,10 +156,11 @@
>  int __init
>  acpi_table_parse_srat (
>         enum acpi_srat_entry_id id,
> -       acpi_madt_entry_handler handler)
> +       acpi_madt_entry_handler handler,
> +       unsigned int max_entries)
>  {
>         return acpi_table_parse_madt_family(ACPI_SRAT, sizeof(struct
> acpi_table_srat),
> -                                           id, handler);
> +                                           id, handler, max_entries);
>  }
> 
> 
> @@ -173,9 +174,11 @@
> 
>         if (result > 0) {
>                 result =
> acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY,
> -                                             
> acpi_parse_processor_affinity);
> +                                             
> acpi_parse_processor_affinity,
> +                                              NR_CPUS);
>                 result =
> acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY,
> -                                             
> acpi_parse_memory_affinity);
> +                                             
> acpi_parse_memory_affinity,
> +                                              NR_MEMBLKS);
>         } else {
>                 /* FIXME */
>                 printk("Warning: acpi_table_parse(ACPI_SRAT) returned
> %d!\n",result);
> diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn
> --exclude='qla1280.[ch]'
> orig/linux-2.6.0-test11-ia64/drivers/acpi/tables.c
> linux-2.6.0-test11-ia64/drivers/acpi/tables.c
> --- orig/linux-2.6.0-test11-ia64/drivers/acpi/tables.c  Thu Dec 11
> 04:22:40 2003
> +++ linux-2.6.0-test11-ia64/drivers/acpi/tables.c       Tue Jan 13
> 00:52:36 2004
> @@ -295,13 +295,14 @@
>         enum acpi_table_id      id,
>         unsigned long           madt_size,
>         int                     entry_id,
> -       acpi_madt_entry_handler handler)
> +       acpi_madt_entry_handler handler,
> +       unsigned int            max_entries)
>  {
>         void                    *madt = NULL;
> -       acpi_table_entry_header *entry = NULL;
> -       unsigned long           count = 0;
> -       unsigned long           madt_end = 0;
> -       unsigned int                    i = 0;
> +       acpi_table_entry_header *entry;
> +       unsigned int            count = 0;
> +       unsigned long           madt_end;
> +       unsigned int            i;
> 
>         if (!handler)
>                 return -EINVAL;
> @@ -335,13 +336,18 @@
>                 ((unsigned long) madt + madt_size);
> 
>         while (((unsigned long) entry) < madt_end) {
> -               if (entry->type == entry_id) {
> -                       count++;
> +               if (entry->type == entry_id &&
> +                   (!max_entries || count++ < max_entries))
>                         handler(entry);
> -               }
> +
>                 entry = (acpi_table_entry_header *)
>                         ((unsigned long) entry + entry->length);
>         }
> +       if (max_entries && count > max_entries) {
> +               printk(KERN_WARNING PREFIX "[%s:0x%02x] ignored %i
> entries of "
> +                      "%i found\n", acpi_table_signatures[id],
> entry_id,
> +                      count - max_entries, count);
> +       }
> 
>         return count;
>  }
> @@ -350,10 +356,11 @@
>  int __init
>  acpi_table_parse_madt (
>         enum acpi_madt_entry_id id,
> -       acpi_madt_entry_handler handler)
> +       acpi_madt_entry_handler handler,
> +       unsigned int max_entries)
>  {
>         return acpi_table_parse_madt_family(ACPI_APIC, sizeof(struct
> acpi_table_madt),
> -                                           id, handler);
> +                                           id, handler, max_entries);
>  }
> 
> 
> @@ -578,4 +585,3 @@
> 
>         return 0;
>  }
> -
> diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn
> --exclude='qla1280.[ch]'
> orig/linux-2.6.0-test11-ia64/include/asm-ia64/iosapic.h
> linux-2.6.0-test11-ia64/include/asm-ia64/iosapic.h
> --- orig/linux-2.6.0-test11-ia64/include/asm-ia64/iosapic.h     Wed
> Nov 26 12:44:21 2003
> +++ linux-2.6.0-test11-ia64/include/asm-ia64/iosapic.h  Tue Jan 13
> 01:30:32 2004
> @@ -52,6 +52,9 @@
>  #ifndef __ASSEMBLY__
> 
>  #ifdef CONFIG_IOSAPIC
> +
> +#define NR_IOSAPICS                    256
> +
>  extern void __init iosapic_system_init (int pcat_compat);
>  extern void __init iosapic_init (unsigned long address,
>                                     unsigned int gsi_base);
> diff -urN -X /usr/people/jes/exclude-linux --exclude=io --exclude=sn
> --exclude='qla1280.[ch]'
> orig/linux-2.6.0-test11-ia64/include/linux/acpi.h
> linux-2.6.0-test11-ia64/include/linux/acpi.h
> --- orig/linux-2.6.0-test11-ia64/include/linux/acpi.h   Wed Nov 26
> 12:42:43 2003
> +++ linux-2.6.0-test11-ia64/include/linux/acpi.h        Tue Jan 13
> 00:51:02 2004
> @@ -355,8 +355,8 @@
>  int acpi_table_init (void);
>  int acpi_table_parse (enum acpi_table_id id, acpi_table_handler
> handler);
>  int acpi_get_table_header_early (enum acpi_table_id id, struct
> acpi_table_header **header);
> -int acpi_table_parse_madt (enum acpi_madt_entry_id id,
> acpi_madt_entry_handler handler);
> -int acpi_table_parse_srat (enum acpi_srat_entry_id id,
> acpi_madt_entry_handler handler);
> +int acpi_table_parse_madt (enum acpi_madt_entry_id id,
> acpi_madt_entry_handler handler, unsigned int max_entries);
> +int acpi_table_parse_srat (enum acpi_srat_entry_id id,
> acpi_madt_entry_handler handler, unsigned int max_entries);
>  void acpi_table_print (struct acpi_table_header *header, unsigned
> long phys_addr);
>  void acpi_table_print_madt_entry (acpi_table_entry_header *madt);
>  void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: Perforce Software.
> Perforce is the Fast Software Configuration Management System offering
> advanced branching capabilities and atomic changes on 50+ platforms.
> Free Eval! http://www.perforce.com/perforce/loadprog.html
> _______________________________________________
> Acpi-devel mailing list
> Acpi-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/acpi-devel
> 
> 


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

end of thread, other threads:[~2004-01-28  5:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-08 14:45 RFC: ACPI table overflow handling Jes Sorensen
2004-01-08 16:20 ` [ACPI] " Bjorn Helgaas
2004-01-11 11:49   ` Jes Sorensen
2004-01-11 14:30   ` Jes Sorensen
2004-01-12 16:24     ` Bjorn Helgaas
2004-01-13  9:49       ` Jes Sorensen
2004-01-13 10:45         ` [patch] ACPI NUMA quiet printk and cleanup Jes Sorensen
2004-01-13 23:01         ` [ACPI] RFC: ACPI table overflow handling Bjorn Helgaas
2004-01-13 13:13       ` [patch] ia64 header cleanup Jes Sorensen
     [not found] <BF1FE1855350A0479097B3A0D2A80EE001E60811@hdsmsx402.hd.intel.com>
2004-01-28  5:20 ` [ACPI] RFC: ACPI table overflow handling Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).