From: John L. <mov...@us...> - 2001-08-10 02:04:14
|
Update of /cvsroot/oprofile/oprofile In directory usw-pr-cvs1:/tmp/cvs-serv1926 Modified Files: ChangeLog oprofile.c Log Message: small tidy Index: ChangeLog =================================================================== RCS file: /cvsroot/oprofile/oprofile/ChangeLog,v retrieving revision 1.67 retrieving revision 1.68 diff -u -d -r1.67 -r1.68 --- ChangeLog 2001/08/02 17:55:21 1.67 +++ ChangeLog 2001/08/10 02:04:08 1.68 @@ -1,3 +1,7 @@ +2001-08-10 John Levon <mo...@co...> + + * oprofile.c: small tidy in apic setup + 2001-08-02 John Levon <mo...@co...> * oprofile.c: fix mod unload race, small fixes Index: oprofile.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/oprofile.c,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -r1.66 -r1.67 --- oprofile.c 2001/08/02 17:55:22 1.66 +++ oprofile.c 2001/08/10 02:04:08 1.67 @@ -58,7 +58,7 @@ memcpy(&data->buffer[data->nextbuf], ops, sizeof(struct op_sample)); if (++data->nextbuf != (data->buf_size - OP_PRE_WATERMARK)) { if (data->nextbuf == data->buf_size) - data->nextbuf=0; + data->nextbuf = 0; return; } oprof_ready[smp_processor_id()] = 1; @@ -229,7 +229,7 @@ static uint old_lvtpc[NR_CPUS]; -static void __init smp_apic_setup(void *dummy) +static void __init lvtpc_apic_setup(void *dummy) { uint val; @@ -250,25 +250,29 @@ apic_write(APIC_LVTPC, old_lvtpc[smp_processor_id()]); } -static int __init apic_setup(void) +static int __init apic_needs_setup(void) { /* FIXME: we need to detect UP kernel, SMP hardware, and - * not go past smp_apic_setup, to avoid screwing up the APIC + * return 0 here, to avoid screwing up the APIC */ - if (smp_num_cpus > 1) { - smp_apic_setup(NULL); - return 0; - } - + return /* if enabled, the kernel has already set it up */ #ifdef CONFIG_X86_UP_APIC - smp_apic_setup(NULL); - return 0; -#else - { + 0 && +#endif + smp_num_cpus == 1; +} + +static int __init apic_setup(void) +{ uint msr_low, msr_high; uint val; + if (!apic_needs_setup()) { + lvtpc_apic_setup(NULL); + return 0; + } + /* ugly hack */ my_set_fixmap(); @@ -328,7 +332,7 @@ /* If the local APIC NMI watchdog has been disabled, we'll need * to set up NMI delivery anyway ... */ - smp_apic_setup(NULL); + lvtpc_apic_setup(NULL); printk(KERN_INFO "oprofile: enabled local APIC\n"); @@ -340,8 +344,6 @@ rdmsr(MSR_IA32_APICBASE, msr_low, msr_high); wrmsr(MSR_IA32_APICBASE, msr_low & ~(1<<11), msr_high); return -ENODEV; - } -#endif /* CONFIG_X86_UP_APIC */ } /* ---------------- PMC setup ------------------ */ @@ -1089,7 +1091,7 @@ if ((err = init_sysctl())) goto out_err; - if ((err = smp_call_function(smp_apic_setup, NULL, 0, 1))) + if ((err = smp_call_function(lvtpc_apic_setup, NULL, 0, 1))) goto out_err; err = op_major = register_chrdev(0, "oprof", &oprof_fops); |