From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 17 09:59:07 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9E7216A420 for ; Sun, 17 Feb 2008 09:59:07 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from falcon.cybervisiontech.com (falcon.cybervisiontech.com [217.20.163.9]) by mx1.freebsd.org (Postfix) with ESMTP id 4911F13C467 for ; Sun, 17 Feb 2008 09:59:07 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from localhost (localhost [127.0.0.1]) by falcon.cybervisiontech.com (Postfix) with ESMTP id BC98743D547 for ; Sun, 17 Feb 2008 11:59:04 +0200 (EET) X-Virus-Scanned: Debian amavisd-new at falcon.cybervisiontech.com Received: from falcon.cybervisiontech.com ([127.0.0.1]) by localhost (falcon.cybervisiontech.com [127.0.0.1]) (amavisd-new, port 10027) with ESMTP id G2UtYR+sNgJT for ; Sun, 17 Feb 2008 11:59:04 +0200 (EET) Received: from [10.74.70.239] (unknown [193.138.145.53]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by falcon.cybervisiontech.com (Postfix) with ESMTP id 3790D43D52E for ; Sun, 17 Feb 2008 11:59:04 +0200 (EET) Message-ID: <47B8055C.4060305@icyb.net.ua> Date: Sun, 17 Feb 2008 11:58:52 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.9 (X11/20071208) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <47B4A514.1020103@icyb.net.ua> In-Reply-To: <47B4A514.1020103@icyb.net.ua> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: cpu stats and another interrupt question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2008 09:59:07 -0000 Come on, guys, simple yes or no would be enough for me :-) on 14/02/2008 22:31 Andriy Gapon said the following: > Dear hackers, > I'd like to check with you if my understanding of some code is correct. > > If we speak about a typical older i386 system, with UP and "AT" PIC, I > think this is how the CPU utilization stats are collected. > RTC is configured to generate interrupts (IRQ8) 128 times per second. > Each time interrupt is generated RTC interrupt handler (I will use > simple non technical terms) takes a peek at what was interrupted and > depending on the properties of that thing (kernel thread) bills a tick > to particular category. E.g. if it sees that the "idle" thread is > interrupted then a tick is billed to "idle", if an interrupt thread is > interrupted (software or hardware) then a tick is billed to interrupt, > if a thread is running user-mode code then a tick is billed to "user" or > "nice", otherwise it's "system". > I understand that I oversimplify, but is the above correct in general ? > > Another, unrelated, question. > Considering this snippet from sys/i386/isa/atpic.c, i8259_init(): > #ifndef PC98 > /* OCW2_L1 sets priority order to 3-7, 0-2 (com2 first). */ > if (!slave) > outb(pic->at_ioaddr, OCW2_R | OCW2_SL | OCW2_L1); > #endif > > Do I understand correctly the code and the comment that here we use a > feature of 8259 PIC that can be called "cyclic shift of interrupt > priorities" ? > So, we really have the following order of interrupts, from higher > priority to lower: 3-7,0,1,8-15? Considering two chained 8259s, of course. > -- Andriy Gapon