From owner-svn-src-projects@FreeBSD.ORG Sun Dec 16 17:11:03 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B81EDCFD; Sun, 16 Dec 2012 17:11:03 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id D35EC8FC0C; Sun, 16 Dec 2012 17:11:02 +0000 (UTC) Received: by mail-we0-f182.google.com with SMTP id u54so2367336wey.13 for ; Sun, 16 Dec 2012 09:10:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=VfCQsS8QRZJgV4PGHKKBEmWJFnk4r3jEzJZo3/zeU9k=; b=A8nzTcNPtEvjcy9j1lY9Fx1q0QSEinXRZh/35BQwrcxnGJqAJ7r13UXZvf1+7XFZM8 4LqX3nkq+LnK71bxd0YabKolvILLW7bve1zKtibWpau/4ahjIlBNWtO9UE3Prtza9M+d RtalEXFxV6r0IO8NWylcglDOgTv4vIcaCY0GX8d99sJalnVI/CZo32edPfX2APrEyG1u Pzf9CicpJjQLXKpp0PwdbdZa3U+QS32fa48+TQZ+4Px7PTu6HfWySClvP5B04B/tX7ap wGBX4qa/wqsAWPidAn8nw7BSSGCBDgIVZ9hPK8T5EuWR4nl2zSJOvFxcPoXqfbtysU/i iCGg== Received: by 10.194.88.98 with SMTP id bf2mr12797547wjb.49.1355677855709; Sun, 16 Dec 2012 09:10:55 -0800 (PST) Received: from mavbook.mavhome.dp.ua (mavhome.mavhome.dp.ua. [213.227.240.37]) by mx.google.com with ESMTPS id h19sm7391209wiv.7.2012.12.16.09.10.53 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 16 Dec 2012 09:10:54 -0800 (PST) Sender: Alexander Motin Message-ID: <50CE009B.7010804@FreeBSD.org> Date: Sun, 16 Dec 2012 19:10:51 +0200 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120628 Thunderbird/13.0.1 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r244287 - projects/calloutng/sys/x86/isa References: <201212161116.qBGBGEwn063983@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 17:11:03 -0000 On 16.12.2012 18:57, Adrian Chadd wrote: > Have you guys even remotely verified that all the weird i8254 clones > support this operation? > > Considering our track record with breaking some of the legacy hardware > (and preventing stable operation on things like Alix boards), I'd > really like to see this particular option hide behind a runtime or > build config twiddle. This change affects only one-shot operation mode of i8254 eventtimer, which we can't enable by default because it can't coexist with i8254 timecounter, which we can't disable by default because we can't be sure that there is any other timecounter. That is why I've written about fun. And no, I have no all possible weird i8254 clones to test, so any help and ideas are welcome. :) > On 16 December 2012 03:16, Alexander Motin wrote: >> Author: mav >> Date: Sun Dec 16 11:16:13 2012 >> New Revision: 244287 >> URL: http://svnweb.freebsd.org/changeset/base/244287 >> >> Log: >> Mostly out of fun, teach i8254 eventtimer driver to program only LSB for >> very short time intervals (<214us). This allows to get less then 22us >> usleep(1) time from this anscient timer. It is even better then HPET time >> now, just with much higher CPU usage. >> >> Modified: >> projects/calloutng/sys/x86/isa/clock.c >> >> Modified: projects/calloutng/sys/x86/isa/clock.c >> ============================================================================== >> --- projects/calloutng/sys/x86/isa/clock.c Sun Dec 16 10:12:40 2012 (r244286) >> +++ projects/calloutng/sys/x86/isa/clock.c Sun Dec 16 11:16:13 2012 (r244287) >> @@ -125,6 +125,7 @@ struct attimer_softc { >> static struct attimer_softc *attimer_sc = NULL; >> >> static int timer0_period = -2; >> +static int timer0_last = 0xffff; >> >> /* Values for timerX_state: */ >> #define RELEASED 0 >> @@ -433,11 +434,17 @@ set_i8254_freq(int mode, uint32_t period >> outb(TIMER_CNTR0, new_count >> 8); >> break; >> case MODE_ONESHOT: >> + if (new_count < 256 && timer0_last < 256) { >> + outb(TIMER_MODE, TIMER_SEL0 | TIMER_INTTC | TIMER_LSB); >> + outb(TIMER_CNTR0, new_count & 0xff); >> + break; >> + } >> outb(TIMER_MODE, TIMER_SEL0 | TIMER_INTTC | TIMER_16BIT); >> outb(TIMER_CNTR0, new_count & 0xff); >> outb(TIMER_CNTR0, new_count >> 8); >> break; >> } >> + timer0_last = new_count; >> out: >> mtx_unlock_spin(&clock_lock); >> } -- Alexander Motin