Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 1533

kernel-2.6.18-238.el5.src.rpm

From: Luming Yu <luyu@redhat.com>
Date: Fri, 20 Jun 2008 16:14:56 +0800
Subject: [ia64] use platform_send_ipi in check_sal_cache_flush
Message-id: 485B6700.4030508@redhat.com
O-Subject: [RHEL 5.3 PATCH 1/2] bz 451745: Update check_sal_cache_flush to use platform_send_ipi
Bugzilla: 451745
RH-Acked-by: Prarit Bhargava <prarit@redhat.com>

BZ 451745

Description of problem:

   check_sal_cache_flush is used to detect broken firmware that drops
    pending interrupts.

    The old implementation schedules a timer interrupt for itself in
    the future by getting the current value of the Interval Timer
    Counter + 1000 cycles, waits for the interrupt to be pended, calls
    SAL_CACHE_FLUSH, and finally checks to see if the interrupt is
    still pending.

    This implementation can cause problems for virtual machine code if
    the process of scheduling the timer interrupt takes more than 1000
    cycles; the virtual machine can end up sleeping for several hundred
    years while waiting for the ITC to wrap around.

    The fix is to use platform_send_ipi. The processor will still send
    an interrupt to itself, using the IA64_IPI_DM_INT delivery mode,
    which causes the IPI to look like an external interrupt. The rest
    of the SAL_CACHE_FLUSH + checking to see if the interrupt is still
    pending remains unchanged.

    This fix has been boot tested successfully on:

        - intel tiger2
        - hp rx6600
        - hp rx5670

    The rx5670 has known buggy firmware, where SAL_CACHE_FLUSH drops
    pending interrupts. A boot test on this machine showed this message
    on the console:

    SAL: SAL_CACHE_FLUSH drops interrupts; PAL_CACHE_FLUSH will be used instead

    Which proves that the self-inflicted IPI approach is viable. And
    as expected, the other tested platforms correctly did not display
    the warning.

    Signed-off-by: Alex Chiang <achiang@hp.com>
    Signed-off-by: Tony Luck <tony.luck@intel.com>

Upstream status:
3463a93def55c309f3c0d0a8aaf216be3be42d64

Testing status:
Boot fine on tiger4 and Cold fusion, and nothing unusual found.

Please review,  test and ACK.

Thanks,
Luming

diff --git a/arch/ia64/kernel/sal.c b/arch/ia64/kernel/sal.c
index 642fdc7..6c3eb0b 100644
--- a/arch/ia64/kernel/sal.c
+++ b/arch/ia64/kernel/sal.c
@@ -234,11 +234,10 @@ check_sal_cache_flush (void)
 	local_irq_save(flags);
 
 	/*
-	 * Schedule a timer interrupt, wait until it's reported, and see if
-	 * SAL_CACHE_FLUSH drops it.
+	 * Send ourselves a timer interrupt, wait until it's reported, and see
+	 * if SAL_CACHE_FLUSH drops it.
 	 */
-	ia64_set_itv(IA64_TIMER_VECTOR);
-	ia64_set_itm(ia64_get_itc() + 1000);
+	platform_send_ipi(cpu, IA64_TIMER_VECTOR, IA64_IPI_DM_INT, 0);
 
 	while (!ia64_get_irr(IA64_TIMER_VECTOR))
 		cpu_relax();