Re: [patch] APIC, NMI watchdog support on UP systems

From: Mikael Pettersson (mikpe@csd.uu.se)
Date: Thu Oct 05 2000 - 17:04:15 EST


On Wed, 4 Oct 2000, Ingo Molnar wrote:

>the latest UP-APIC patch against 2.4.0-test9 (upapic-2.4.0-test9-F5), can
>be downloaded from:
>
> http://www.kernel.org/pub/linux/kernel/people/mingo/apic-patches/
>
>this one should work on all systems - let me know how it behaves, reports,
>suggestions welcome. If any change didnt make it into this patch then
>please resubmit, there were major changes.
>...
> - reworked the APIC-enabling code and boot order along the suggestion of
> Mikael Pettersson, APICs should now be enabled early enough on all
> systems. This should also fix the boot problems seen by Prasanna
> Narayana. (me)

Sorry, but this still doesn't work. I tested -F5 and -F8 and they both
hang at "Calibrating delay loop". Same problem as before: the local APIC's
LVT0 and LVT1 entries hadn't yet been reprogrammed to ExtINT and NMI,
respectively, so no interrupts could be delivered to the CPU core.

I did the following to make -F8 work on my UP Pentium III machine:
* Moved the low-level APIC enabling code out of APIC_init_uniprocessor
  to a separate function APIC_enable_uniprocessor (just a wrapper
  around setup_local_APIC).
* In init_apic_mappings() I call APIC_enable_uniprocessor immediately
  after it has been mapped; without this call, the kernel won't get any
  interrupts.
* Moved setup_apic_nmi_watchdog from setup_local_APIC to
  APIC_init_uniprocessor; this is because setup_apic_nmi_watchdog needs
  cpu_khz, but cpu_khz hasn't been computed yet when my patch calls
  setup_local_APIC. I don't know how this will affect SMP systems.
  (side note: why not just make setup_apic_nmi_watchdog an __initcall?)

/Mikael

--- linux-2.4.0-test9-upapic-F8/arch/i386/kernel/apic.c.~1~ Thu Oct 5 17:12:13 2000
+++ linux-2.4.0-test9-upapic-F8/arch/i386/kernel/apic.c Thu Oct 5 20:45:12 2000
@@ -32,6 +32,8 @@
 int prof_old_multiplier[NR_CPUS] = { 1, };
 int prof_counter[NR_CPUS] = { 1, };
 
+static void APIC_enable_uniprocessor(void);
+
 int get_maxlvt(void)
 {
         unsigned int v, ver, maxlvt;
@@ -315,9 +317,6 @@
          * Must be "all ones" explicitly for 82489DX.
          */
         apic_write_around(APIC_DFR, 0xffffffff);
-
- if (nmi_watchdog == NMI_LOCAL_APIC)
- setup_apic_nmi_watchdog();
 }
 
 /*
@@ -398,6 +397,8 @@
         set_fixmap_nocache(FIX_APIC_BASE, apic_phys);
         Dprintk("mapped APIC to %08lx (%08lx)\n", APIC_BASE, apic_phys);
 
+ APIC_enable_uniprocessor();
+
         /*
          * Fetch the APIC ID of the BSP in case we have a
          * default configuration (or the MP table is broken).
@@ -826,10 +827,10 @@
 }
 
 /*
- * This initializes the IO-APIC and APIC hardware if this is
- * a UP kernel.
+ * Enable the BSP's local APIC.
+ * Note: interrupts are not yet enabled and cpu_khz is not yet known.
  */
-void __init APIC_init_uniprocessor (void)
+static void __init APIC_enable_uniprocessor (void)
 {
         if (!cpu_has_apic)
                 return;
@@ -840,9 +841,21 @@
         apic_write_around(APIC_ID, 0);
 
         setup_local_APIC();
+}
 
- if (nmi_watchdog == NMI_LOCAL_APIC)
+/*
+ * This initializes the IO-APIC and APIC hardware if this is
+ * a UP kernel.
+ */
+void __init APIC_init_uniprocessor (void)
+{
+ if (!cpu_has_apic)
+ return;
+
+ if (nmi_watchdog == NMI_LOCAL_APIC) {
+ setup_apic_nmi_watchdog();
                 check_nmi_watchdog();
+ }
 #ifdef CONFIG_X86_IO_APIC
         if (smp_found_config)
                 setup_IO_APIC();
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Oct 07 2000 - 21:00:18 EST