direct-io.hg

changeset 8424:03ea37841682

This patch is intended to correct the number of CPUs.

Our IPF machines are the following configurations.
- Total logical cpus = 16
-- 4 sockets
-- 2 cores
-- 2 threads

I changed the setting of BIOS, and invalidated the hyperthread, and I built Xen with NR_CPUS=8.
As a result, it became like attached file xendmesg1.txt.
- Available cpus 3
- Total cpus 8

Next, I built Xen with NR_CPUS=16.
As a result, it became like attached file xendmesg2.txt.
- Available cpus 8
- Total cpus 16

I thought not to match the analysis of the lsapic entry to the value of NR_CPUS.

It is an outline of patch as follows.
1. Count up the lsapic entry by using acpi_table_count_madt()/acpi_table_count_madt_family().
2. Call acpi_parse_lsapic() by using the number of lsapic entries.
3. Count up the available_cpus by using acpi_parse_lsapic(), however NR_CPUS is not exceeded.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>

Best Regards,
Kan
author djm@kirby.fc.hp.com
date Wed Dec 21 08:53:40 2005 -0600 (2005-12-21)
parents 663c487a5f2c
children 85261a82e02c
files xen/arch/ia64/xen/acpi.c xen/drivers/acpi/tables.c xen/include/xen/acpi.h
line diff
     1.1 --- a/xen/arch/ia64/xen/acpi.c	Wed Dec 21 08:49:31 2005 -0600
     1.2 +++ b/xen/arch/ia64/xen/acpi.c	Wed Dec 21 08:53:40 2005 -0600
     1.3 @@ -203,12 +203,18 @@ acpi_parse_lsapic (acpi_table_entry_head
     1.4  	else {
     1.5  		printk(" enabled");
     1.6  #ifdef CONFIG_SMP
     1.7 -		smp_boot_data.cpu_phys_id[available_cpus] = (lsapic->id << 8) | lsapic->eid;
     1.8 -		if (hard_smp_processor_id()
     1.9 -		    == (unsigned int) smp_boot_data.cpu_phys_id[available_cpus])
    1.10 -			printk(" (BSP)");
    1.11 +		if (available_cpus < NR_CPUS) {
    1.12 +			smp_boot_data.cpu_phys_id[available_cpus] = (lsapic->id << 8) | lsapic->eid;
    1.13 +			if (hard_smp_processor_id()
    1.14 +			    == (unsigned int) smp_boot_data.cpu_phys_id[available_cpus])
    1.15 +				printk(" (BSP)");
    1.16 +			++available_cpus;
    1.17 +		} else {
    1.18 +			printk(" - however, ignored...");
    1.19 +		}
    1.20 +#else
    1.21 +		++available_cpus;
    1.22  #endif
    1.23 -		++available_cpus;
    1.24  	}
    1.25  
    1.26  	printk("\n");
    1.27 @@ -598,8 +604,17 @@ acpi_boot_init (void)
    1.28  	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0)
    1.29  		printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
    1.30  
    1.31 +#ifdef CONFIG_SMP
    1.32 +	int count;
    1.33 +	if ((count = acpi_table_count_madt(ACPI_MADT_LSAPIC)) < 1) {
    1.34 +		printk(KERN_ERR PREFIX "Error parsing MADT - no LSAPIC entries\n");
    1.35 +	} else {
    1.36 +		acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, count);
    1.37 +	}
    1.38 +#else
    1.39  	if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS) < 1)
    1.40 -		printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC entries\n");
    1.41 +		printk(KERN_ERR PREFIX "Error parsing MADT - no LSAPIC entries\n");
    1.42 +#endif
    1.43  
    1.44  	if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0) < 0)
    1.45  		printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
     2.1 --- a/xen/drivers/acpi/tables.c	Wed Dec 21 08:49:31 2005 -0600
     2.2 +++ b/xen/drivers/acpi/tables.c	Wed Dec 21 08:53:40 2005 -0600
     2.3 @@ -607,3 +607,60 @@ acpi_table_init (void)
     2.4  
     2.5  	return 0;
     2.6  }
     2.7 +
     2.8 +int __init
     2.9 +acpi_table_count_madt_family (
    2.10 +	enum acpi_table_id	id,
    2.11 +	unsigned long		madt_size,
    2.12 +	int			entry_id)
    2.13 +{
    2.14 +	void			*madt = NULL;
    2.15 +	acpi_table_entry_header	*entry;
    2.16 +	unsigned int		count = 0;
    2.17 +	unsigned long		madt_end;
    2.18 +	unsigned int		i;
    2.19 +
    2.20 +	/* Locate the MADT (if exists). There should only be one. */
    2.21 +
    2.22 +	for (i = 0; i < sdt_count; i++) {
    2.23 +		if (sdt_entry[i].id != id)
    2.24 +			continue;
    2.25 +		madt = (void *)
    2.26 +			__acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
    2.27 +		if (!madt) {
    2.28 +			printk(KERN_WARNING PREFIX "Unable to map %s\n",
    2.29 +				acpi_table_signatures[id]);
    2.30 +			return -ENODEV;
    2.31 +		}
    2.32 +		break;
    2.33 +	}
    2.34 +
    2.35 +	if (!madt) {
    2.36 +		printk(KERN_WARNING PREFIX "%s not present\n",
    2.37 +			acpi_table_signatures[id]);
    2.38 +		return -ENODEV;
    2.39 +	}
    2.40 +
    2.41 +	madt_end = (unsigned long) madt + sdt_entry[i].size;
    2.42 +
    2.43 +	/* Parse all entries looking for a match. */
    2.44 +
    2.45 +	entry = (acpi_table_entry_header *)
    2.46 +		((unsigned long) madt + madt_size);
    2.47 +
    2.48 +	while (((unsigned long) entry) + sizeof(acpi_table_entry_header) < madt_end) {
    2.49 +		if (entry->type == entry_id) count++;
    2.50 +
    2.51 +		entry = (acpi_table_entry_header *)
    2.52 +			((unsigned long) entry + entry->length);
    2.53 +	}
    2.54 +
    2.55 +	return count;
    2.56 +}
    2.57 +
    2.58 +
    2.59 +int __init
    2.60 +acpi_table_count_madt (enum acpi_madt_entry_id id)
    2.61 +{
    2.62 +	return acpi_table_count_madt_family(ACPI_APIC, sizeof(struct acpi_table_madt), id);
    2.63 +}
     3.1 --- a/xen/include/xen/acpi.h	Wed Dec 21 08:49:31 2005 -0600
     3.2 +++ b/xen/include/xen/acpi.h	Wed Dec 21 08:53:40 2005 -0600
     3.3 @@ -390,6 +390,7 @@ int acpi_table_parse_srat (enum acpi_sra
     3.4  void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr);
     3.5  void acpi_table_print_madt_entry (acpi_table_entry_header *madt);
     3.6  void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
     3.7 +int acpi_table_count_madt (enum acpi_madt_entry_id id);
     3.8  
     3.9  /* the following four functions are architecture-dependent */
    3.10  void acpi_numa_slit_init (struct acpi_table_slit *slit);