From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.redhat.com (mail.redhat.com [199.183.24.239]) by listman.redhat.com (Postfix) with ESMTP id 1E8092F01E for ; Fri, 5 Oct 2001 09:17:36 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.11.0/8.8.7) id f95DHZs16337 for axp-list@listman.redhat.com; Fri, 5 Oct 2001 09:17:35 -0400 Received: from zmamail03.zma.compaq.com (zmamail03.zma.compaq.com [161.114.64.103]) by mail.redhat.com (8.11.0/8.8.7) with ESMTP id f95DHZg16333 for ; Fri, 5 Oct 2001 09:17:35 -0400 Received: by zmamail03.zma.compaq.com (Postfix, from userid 12345) id 47907A30D; Fri, 5 Oct 2001 09:17:30 -0400 (EDT) Received: from tayexg12.americas.cpqcorp.net (tayexg12.americas.cpqcorp.net [16.103.130.103]) by zmamail03.zma.compaq.com (Postfix) with ESMTP id 3D15A9F7A for ; Fri, 5 Oct 2001 09:17:30 -0400 (EDT) Received: from tayexc14.americas.cpqcorp.net ([16.103.130.45]) by tayexg12.americas.cpqcorp.net with Microsoft SMTPSVC(5.0.2195.2966); Fri, 5 Oct 2001 09:17:29 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.0.4712.0 content-class: urn:content-classes:message Subject: RE: Hangs with 100baseTX, RedHat 7.1, kernel 2.4.x and AlphaPC 164 Date: Fri, 5 Oct 2001 09:17:29 -0400 MIME-Version: 1.0 Message-ID: Content-Type: text/plain; charset="iso-8859-1" X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Hangs with 100baseTX, RedHat 7.1, kernel 2.4.x and AlphaPC 164 Thread-Index: AcFNiTHFGF0ndrl7EdW0MQAIx7qemwAFhHbQ From: "Jemiolo, John" To: X-OriginalArrivalTime: 05 Oct 2001 13:17:29.0960 (UTC) FILETIME=[15D6F680:01C14DA0] Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.redhat.com id f95DHZg16333 X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0.1 Precedence: bulk Reply-To: axp-list@redhat.com List-Help: List-Post: List-Subscribe: , List-Id: Linux and Red Hat on Alpha processors List-Unsubscribe: , List-Archive: The emergency time-out worked just fine :^) I installed your patch in place of the fix Jay performed last week on my xp1000.. That plus the ac4 patch, seems to make 2.4.10 stable (for me), as I have been unable to hang it anymore.. Thanks JJ -----Original Message----- From: Ivan Kokshaysky [mailto:ink@jurassic.park.msu.ru] Sent: Friday, October 05, 2001 6:32 AM To: axp-list@redhat.com Subject: Re: Hangs with 100baseTX, RedHat 7.1, kernel 2.4.x and AlphaPC 164 On Thu, Oct 04, 2001 at 06:26:10PM -0400, Jay Estabrook wrote: > I think maybe Ivan has some patches that do a better job in that area, > and I know he's going to submit them soon. Maybe he'll post them here > for some additional testing... :-) :-) Sure, especially because my latest patch doesn't work on a pc164, as Richard reported. :-( So I would return to my previous thought - compare the measured frequency with one reported in the hwrpb and return failure if we see twofold or higher difference. Also emergency timeout added, as you suggested. Ivan. --- 2.4.10/arch/alpha/kernel/time.c Fri Oct 5 13:43:01 2001 +++ linux/arch/alpha/kernel/time.c Fri Oct 5 13:53:20 2001 @@ -170,28 +170,28 @@ common_init_rtc(void) } /* - * Calibrate CPU clock using legacy 8254 timer/counter. Stolen from - * arch/i386/time.c. + * Calibrate CPU clock using legacy 8254 programmable interval timer. + * Based on arch/i386/time.c. */ -#define CALIBRATE_LATCH (52 * LATCH) -#define CALIBRATE_TIME (52 * 1000020 / HZ) +#define CALIBRATE_LATCH 0xffff +#define TIMEOUT_COUNT 0x100000 static unsigned long __init -calibrate_cc_with_pic(void) +calibrate_cc_with_pit(void) { - int cc; - unsigned long count = 0; + int cc, count = 0; + unsigned long freq, hwrpbfreq = hwrpb->cycle_freq; /* Set the Gate high, disable speaker */ outb((inb(0x61) & ~0x02) | 0x01, 0x61); /* - * Now let's take care of CTC channel 2 + * Now let's take care of PIT channel 2 * - * Set the Gate high, program CTC channel 2 for mode 0, + * Set the Gate high, program PIT channel 2 for mode 0, * (interrupt on terminal count mode), binary count, - * load 5 * LATCH count, (LSB and MSB) to begin countdown. + * load CALIBRATE_LATCH count (LSB and MSB) to begin countdown. */ outb(0xb0, 0x43); /* binary, mode 0, LSB/MSB, Ch 2 */ outb(CALIBRATE_LATCH & 0xff, 0x42); /* LSB of count */ @@ -200,29 +200,23 @@ calibrate_cc_with_pic(void) cc = rpcc(); do { count++; - } while ((inb(0x61) & 0x20) == 0); + } while (!(inb(0x61) & 0x20) && count < TIMEOUT_COUNT); cc = rpcc() - cc; - /* Error: ECTCNEVERSET */ - if (count <= 1) - goto bad_ctc; - - /* Error: ECPUTOOFAST */ - if (count >> 32) - goto bad_ctc; - - /* Error: ECPUTOOSLOW */ - if (cc <= CALIBRATE_TIME) - goto bad_ctc; + /* Error: EPITNEVERSET or ECPUTOOFAST */ + if (count <= 1 || count == TIMEOUT_COUNT) + goto bad_pit; + + freq = ((long)cc * CLOCK_TICK_RATE) / (CALIBRATE_LATCH + 1); + + /* CPU cycle frequency reported in the hwrpb is often bogus. + However, even in the worst case the difference shouldn't + exceed 30-40%, so we can still use hwrpb value to validate + the frequency we've found with PIT. */ + if ((max(freq, hwrpbfreq) + 1) / (min(freq, hwrpbfreq) + 1) < 2) + return freq; - return ((long)cc * 1000000) / CALIBRATE_TIME; - - /* - * The CTC wasn't reliable: we got a hit on the very first read, - * or the CPU was so fast/slow that the quotient wouldn't fit in - * 32 bits.. - */ - bad_ctc: + bad_pit: return 0; } @@ -249,7 +243,7 @@ time_init(void) /* Calibrate CPU clock -- attempt #1. */ if (!est_cycle_freq) - est_cycle_freq = calibrate_cc_with_pic(); + est_cycle_freq = calibrate_cc_with_pit(); cc1 = rpcc_after_update_in_progress(); _______________________________________________ Axp-list mailing list Axp-list@redhat.com https://listman.redhat.com/mailman/listinfo/axp-list