Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 7 Feb 2002 13:41:28 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 7 Feb 2002 13:41:15 -0500 Received: from e31.co.us.ibm.com ([32.97.110.129]:17828 "EHLO e31.co.us.ibm.com") by vger.kernel.org with ESMTP id ; Thu, 7 Feb 2002 13:40:51 -0500 Date: Thu, 7 Feb 2002 10:38:11 -0800 From: Russ Weight To: torvalds@transmeta.com Cc: lkml Subject: [PATCH] Scalable phys_cpu_present_map for 2.5.4 Message-ID: <20020207103811.A2638@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Linus, Please consider this patch for 2.5.4-pre2. Note that this patch depends on my previous patch entitled: "[PATCH] Scalable CPU bitmasks for 2.5.4". This patch modifies the phys_cpu_present_map bitmask to be a "scalable CPU bitmask". The datatype is changed to cpumap_t, and all accesses to the bitmask are done through the appropriate supporting functions. This patch has been tested on a 2-quad NUMA system. It affects i386 architecture specific code, but does not affect other architectures. - Russ -- Russ Weight (rweight@us.ibm.com) Linux Technology Center diff -u cpumap/include/asm-i386/smp.h linux/include/asm-i386/smp.h --- cpumap/include/asm-i386/smp.h Mon Jan 21 16:28:09 2002 +++ linux/include/asm-i386/smp.h Tue Jan 29 15:04:41 2002 @@ -8,6 +8,7 @@ #include #include #include +#include #endif #ifdef CONFIG_X86_LOCAL_APIC @@ -53,7 +54,7 @@ */ extern void smp_alloc_memory(void); -extern unsigned long phys_cpu_present_map; +extern cpumap_t phys_cpu_present_map; extern unsigned long cpu_online_map; extern volatile unsigned long smp_invalidate_needed; extern int pic_mode; diff -u cpumap/include/asm-i386/mpspec.h linux/include/asm-i386/mpspec.h --- cpumap/include/asm-i386/mpspec.h Mon Jan 21 16:28:09 2002 +++ linux/include/asm-i386/mpspec.h Tue Jan 29 15:04:41 2002 @@ -1,6 +1,8 @@ #ifndef __ASM_MPSPEC_H #define __ASM_MPSPEC_H +#include + /* * Structure definitions for SMP machines following the * Intel Multiprocessing Specification 1.1 and 1.4. @@ -201,7 +203,7 @@ extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES]; extern unsigned int boot_cpu_physical_apicid; -extern unsigned long phys_cpu_present_map; +extern cpumap_t phys_cpu_present_map; extern int smp_found_config; extern void find_smp_config (void); extern void get_smp_config (void); diff -u cpumap/arch/i386/kernel/process.c linux/arch/i386/kernel/process.c --- cpumap/arch/i386/kernel/process.c Tue Jan 29 14:33:08 2002 +++ linux/arch/i386/kernel/process.c Tue Jan 29 15:04:41 2002 @@ -370,7 +370,7 @@ if its not, default to the BSP */ if ((reboot_cpu == -1) || (reboot_cpu > (NR_CPUS -1)) || - !(phys_cpu_present_map & (1<= 0) && (max_cpus <= cpucount+1)) continue; @@ -1122,7 +1132,7 @@ * Make sure we unmap all failed CPUs */ if ((boot_apicid_to_cpu(apicid) == -1) && - (phys_cpu_present_map & (1 << bit))) + (cpumap_test_bit(bit, phys_cpu_present_map))) printk("CPU #%d not responding - cannot use it.\n", apicid); } diff -u cpumap/arch/i386/kernel/apic.c linux/arch/i386/kernel/apic.c --- cpumap/arch/i386/kernel/apic.c Tue Jan 29 14:33:08 2002 +++ linux/arch/i386/kernel/apic.c Tue Jan 29 15:04:41 2002 @@ -283,7 +283,7 @@ * This is meaningless in clustered apic mode, so we skip it. */ if (!clustered_apic_mode && - !test_bit(GET_APIC_ID(apic_read(APIC_ID)), &phys_cpu_present_map)) + !cpumap_test_bit(GET_APIC_ID(apic_read(APIC_ID)), phys_cpu_present_map)) BUG(); /* @@ -1137,7 +1137,8 @@ connect_bsp_APIC(); - phys_cpu_present_map = 1; + cpumap_clear_mask(phys_cpu_present_map); + cpumap_set_bit(0, phys_cpu_present_map); apic_write_around(APIC_ID, boot_cpu_physical_apicid); apic_pm_init2(); diff -u cpumap/arch/i386/kernel/mpparse.c linux/arch/i386/kernel/mpparse.c --- cpumap/arch/i386/kernel/mpparse.c Fri Nov 9 14:58:18 2001 +++ linux/arch/i386/kernel/mpparse.c Tue Jan 29 15:04:41 2002 @@ -61,7 +61,7 @@ static unsigned int num_processors; /* Bitmask of physically existing CPUs */ -unsigned long phys_cpu_present_map; +cpumap_t phys_cpu_present_map; /* * Intel MP BIOS table parsing routines: @@ -224,9 +224,10 @@ ver = m->mpc_apicver; if (clustered_apic_mode) { - phys_cpu_present_map |= (logical_apicid&0xf) << (4*quad); + int cpuid = ffs(logical_apicid&0xf) - 1 + (4*quad); + cpumap_set_bit(cpuid, phys_cpu_present_map); } else { - phys_cpu_present_map |= 1 << m->mpc_apicid; + cpumap_set_bit(m->mpc_apicid, phys_cpu_present_map); } /* * Validate version @@ -819,7 +820,7 @@ { smp_found_config = 1; - phys_cpu_present_map |= 2; /* or in id 1 */ + cpumap_set_bit(1, phys_cpu_present_map); apic_version[1] |= 0x10; /* integrated APIC */ apic_version[0] |= 0x10; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/