I think that I have found the culprit code change that is causing the
slow boot issue.  I have been comparing changes across the 3.2, 3.5, and
3.8 kernels and paying attention to the changes that remained the same
across the 3.5 and 3.8 sources.

All calls to exit_idle() and irq_enter() were reversed from the 3.2 kernel to 
the 3.5 and 3.8 kernels in the file arch/x86/kernel/apic/apic.c.  I reversed 
them all to match the 3.2 kernel and have been booting successfully with this 
kernel build.  I have tried booting in every combination I could think of 
(quickly and slowly booting from grub, booting plugged in and uplugged etc.).  
My changes are marked by the ADDED and REMOVED comments.  The following is a 
copy of all the functions I edited.

void __irq_entry smp_apic_timer_interrupt(struct pt_regs *regs)
{
        struct pt_regs *old_regs = set_irq_regs(regs);

        /*
         * NOTE! We'd better ACK the irq immediately,
         * because timer handling can be slow.
         */
        ack_APIC_irq();
        /*
         * update_process_times() expects us to have done irq_enter().
         * Besides, if we don't timer interrupts ignore the global
         * interrupt lock, which is the WrongThing (tm) to do.
         */
        exit_idle();//ADDED
        irq_enter();
//REMOVED       exit_idle();
        local_apic_timer_interrupt();
        irq_exit();

        set_irq_regs(old_regs);
}

void smp_spurious_interrupt(struct pt_regs *regs)
{
        u32 v;
        exit_idle();//ADDED
        irq_enter();
//REMOVED       exit_idle();
        /*
         * Check if this really is a spurious interrupt and ACK it
         * if it is a vectored one.  Just in case...
         * Spurious interrupts should not be ACKed.
         */
        v = apic_read(APIC_ISR + ((SPURIOUS_APIC_VECTOR & ~0x1f) >> 1));
        if (v & (1 << (SPURIOUS_APIC_VECTOR & 0x1f)))
                ack_APIC_irq();

        inc_irq_stat(irq_spurious_count);

        /* see sw-dev-man vol 3, chapter 7.4.13.5 */
        pr_info("spurious APIC interrupt on CPU#%d, "
                "should never happen.\n", smp_processor_id());
        irq_exit();
}

void smp_error_interrupt(struct pt_regs *regs)
{
        u32 v0, v1;
        u32 i = 0;
        static const char * const error_interrupt_reason[] = {
                "Send CS error",                /* APIC Error Bit 0 */
                "Receive CS error",             /* APIC Error Bit 1 */
                "Send accept error",            /* APIC Error Bit 2 */
                "Receive accept error",         /* APIC Error Bit 3 */
                "Redirectable IPI",             /* APIC Error Bit 4 */
                "Send illegal vector",          /* APIC Error Bit 5 */
                "Received illegal vector",      /* APIC Error Bit 6 */
                "Illegal register address",     /* APIC Error Bit 7 */
        };
        exit_idle();//ADDED
        irq_enter();
//REMOVED       exit_idle();
        /* First tickle the hardware, only then report what went on. -- REW */
        v0 = apic_read(APIC_ESR);
        apic_write(APIC_ESR, 0);
        v1 = apic_read(APIC_ESR);
        ack_APIC_irq();
        atomic_inc(&irq_err_count);

        apic_printk(APIC_DEBUG, KERN_DEBUG "APIC error on CPU%d: %02x(%02x)",
                    smp_processor_id(), v0 , v1);

        v1 = v1 & 0xff;
        while (v1) {
                if (v1 & 0x1)
                        apic_printk(APIC_DEBUG, KERN_CONT " : %s", 
error_interrupt_reason[i]);
                i++;
                v1 >>= 1;
        }

        apic_printk(APIC_DEBUG, KERN_CONT "\n");

        irq_exit();
}

Other than the changes at the ADDED and REMOVED comments the source code
I used to build my kernel is identical to 3.8.0-23.34, which I believe
is the latest Raring kernel.

I am not sure how to submit these changes for approval/testing, is
anyone willing to apply these changes and test it out on their machine
and/or submit the changes?

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1093217

Title:
  Ubuntu 12.04/12.10/13.04 10-20min boot delay (From 3.2.0.29->3.8.0.19)
  [Lenovo IdeaPad Z580]

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1093217/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to