Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S265111AbUFHAOg (ORCPT ); Mon, 7 Jun 2004 20:14:36 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S265141AbUFHAOg (ORCPT ); Mon, 7 Jun 2004 20:14:36 -0400 Received: from e2.ny.us.ibm.com ([32.97.182.102]:57845 "EHLO e2.ny.us.ibm.com") by vger.kernel.org with ESMTP id S265111AbUFHAOd (ORCPT ); Mon, 7 Jun 2004 20:14:33 -0400 Subject: [PATCH]linux-2.6.7-rc3_cyclone-bad-pit_A0 From: john stultz To: lkml Cc: Andrew Morton , Andi Kleen Content-Type: text/plain Message-Id: <1086653665.2234.192.camel@cog.beaverton.ibm.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 (1.4.5-7) Date: Mon, 07 Jun 2004 17:14:26 -0700 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1487 Lines: 51 All, In testing for SLES9, we ran across a bug caused by userspace apps poking the PIT which caused bad values to be read by the kernel. This would then trigger the lost tick detection code with insane values and would then break the SCSI subsystem. This patch includes the PIT sanity check from the TSC timesource into the cyclone timesource code, which catches the bad case described above and resolves the issue. Please apply. thanks -john diff -Nru a/arch/i386/kernel/timers/timer_cyclone.c b/arch/i386/kernel/timers/timer_cyclone.c --- a/arch/i386/kernel/timers/timer_cyclone.c Mon Jun 7 17:02:41 2004 +++ b/arch/i386/kernel/timers/timer_cyclone.c Mon Jun 7 17:02:41 2004 @@ -17,6 +17,7 @@ #include #include #include +#include "io_ports.h" extern spinlock_t i8253_lock; @@ -62,6 +63,17 @@ count = inb_p(0x40); /* read the latched count */ count |= inb(0x40) << 8; + + /* + * VIA686a test code... reset the latch if count > max + 1 + * from timer_pit.c - cjb + */ + if (count > LATCH) { + outb_p(0x34, PIT_MODE); + outb_p(LATCH & 0xff, PIT_CH0); + outb(LATCH >> 8, PIT_CH0); + count = LATCH - 1; + } spin_unlock(&i8253_lock); /* lost tick compensation */ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/