for (cpu = 0; cpu < NR_CPUS; cpu++) 
for (cpu = 0; cpu < NR_CPUS; cpu++) { 
static void __init smp_boot_cpus(unsigned int max_cpus){	int apicid, cpu, bit, kicked;	unsigned long bogosum = 0;	/*	 * Setup boot CPU information	 */	smp_store_cpu_info(0); /* Final full version of the data */	printk("CPU%d: ", 0);	print_cpu_info(&cpu_data[0]);	boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));	boot_cpu_logical_apicid = logical_smp_processor_id();	x86_cpu_to_apicid[0] = boot_cpu_physical_apicid;	current_thread_info()->cpu = 0;	smp_tune_scheduling();	cpus_clear(cpu_sibling_map[0]);	cpu_set(0, cpu_sibling_map[0]);	/*	 * If we couldn't find an SMP configuration at boot time,	 * get out of here now!	 */	if (!smp_found_config && !acpi_lapic) {		printk(KERN_NOTICE "SMP motherboard not detected.\n");		smpboot_clear_io_apic_irqs();		phys_cpu_present_map = physid_mask_of_physid(0);		if (APIC_init_uniprocessor())			printk(KERN_NOTICE "Local APIC not detected."					   " Using dummy APIC emulation.\n");		map_cpu_to_logical_apicid();		return;	}	/*	 * Should not be necessary because the MP table should list the boot	 * CPU too, but we do it for the sake of robustness anyway.	 * Makes no sense to do this check in clustered apic mode, so skip it	 */	if (!check_phys_apicid_present(boot_cpu_physical_apicid)) {		printk("weird, boot CPU (#%d) not listed by the BIOS.\n",				boot_cpu_physical_apicid);		physid_set(hard_smp_processor_id(), phys_cpu_present_map);	}	/*	 * If we couldn't find a local APIC, then get out of here now!	 */	if (APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid]) && !cpu_has_apic) {		printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n",			boot_cpu_physical_apicid);		printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n");		smpboot_clear_io_apic_irqs();		phys_cpu_present_map = physid_mask_of_physid(0);		return;	}	verify_local_APIC();	/*	 * If SMP should be disabled, then really disable it!	 */	if (!max_cpus) {		smp_found_config = 0;		printk(KERN_INFO "SMP mode deactivated, forcing use of dummy APIC emulation.\n");		smpboot_clear_io_apic_irqs();		phys_cpu_present_map = physid_mask_of_physid(0);		return;	}	connect_bsp_APIC();	setup_local_APIC();	map_cpu_to_logical_apicid();	setup_portio_remap();	/*	 * Scan the CPU present map and fire up the other CPUs via do_boot_cpu	 *	 * In clustered apic mode, phys_cpu_present_map is a constructed thus:	 * bits 0-3 are quad0, 4-7 are quad1, etc. A perverse twist on the 	 * clustered apic ID.	 */	Dprintk("CPU present map: %lx\n", physids_coerce(phys_cpu_present_map));	kicked = 1;	for (bit = 0; kicked < NR_CPUS && bit < MAX_APICS; bit++) {		apicid = cpu_present_to_apicid(bit);		/*		 * Don't even attempt to start the boot CPU!		 */		if ((apicid == boot_cpu_apicid) || (apicid == BAD_APICID))			continue;		if (!check_apicid_present(bit))			continue;		if (max_cpus <= cpucount+1)			continue;		if (do_boot_cpu(apicid))			printk("CPU #%d not responding - cannot use it.\n",								apicid);		else			++kicked;	}	/*	 * Cleanup possible dangling ends...	 */	smpboot_restore_warm_reset_vector();	/*	 * Allow the user to impress friends.	 */	Dprintk("Before bogomips.\n");	for (cpu = 0; cpu < NR_CPUS; cpu++)		if (cpu_isset(cpu, cpu_callout_map))			bogosum += cpu_data[cpu].loops_per_jiffy;	printk(KERN_INFO		"Total of %d processors activated (%lu.%02lu BogoMIPS).\n",		cpucount+1,		bogosum/(500000/HZ),		(bogosum/(5000/HZ))%100);		Dprintk("Before bogocount - setting activated=1.\n");	if (smp_b_stepping)		printk(KERN_WARNING "WARNING: SMP operation may be unreliable with B stepping processors.\n");	/*	 * Don't taint if we are running SMP kernel on a single non-MP	 * approved Athlon	 */	if (tainted & TAINT_UNSAFE_SMP) {		if (cpucount)			printk (KERN_INFO "WARNING: This combination of AMD processors is not suitable for SMP.\n");		else			tainted &= ~TAINT_UNSAFE_SMP;	}	Dprintk("Boot done.\n");	/*	 * construct cpu_sibling_map[], so that we can tell sibling CPUs	 * efficiently.	 */	for (cpu = 0; cpu < NR_CPUS; cpu++)		cpus_clear(cpu_sibling_map[cpu]);	for (cpu = 0; cpu < NR_CPUS; cpu++) {		int siblings = 0;		int i;		if (!cpu_isset(cpu, cpu_callout_map))			continue;		if (smp_num_siblings > 1) {			for (i = 0; i < NR_CPUS; i++) {				if (!cpu_isset(i, cpu_callout_map))					continue;				if (phys_proc_id[cpu] == phys_proc_id[i]) {					siblings++;					cpu_set(i, cpu_sibling_map[cpu]);				}			}		} else {			siblings++;			cpu_set(cpu, cpu_sibling_map[cpu]);		}		if (siblings != smp_num_siblings)			printk(KERN_WARNING "WARNING: %d siblings found for CPU%d, should be %d\n", siblings, cpu, smp_num_siblings);	}	if (nmi_watchdog == NMI_LOCAL_APIC)		check_nmi_watchdog();	smpboot_setup_io_apic();	setup_boot_APIC_clock();	/*	 * Synchronize the TSC with the AP	 */	if (cpu_has_tsc && cpucount && cpu_khz)		synchronize_tsc_bp();}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/3dd9d514846cdca1dcef2e4fce666d85e199e844/smpboot.c/buggy/arch/i386/kernel/smpboot.c