From owner-freebsd-current@FreeBSD.ORG Tue Aug 31 21:27:47 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31FE910656B7; Tue, 31 Aug 2010 21:27:47 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 830158FC1C; Tue, 31 Aug 2010 21:27:46 +0000 (UTC) Received: by bwz20 with SMTP id 20so5772266bwz.13 for ; Tue, 31 Aug 2010 14:27:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=XI+IGy+BBBPBSo5JPS5zU7vzaVhtGCtQqOaNc9UqFMY=; b=uZyMsO5BAOO5H9SreQF56ulevPa3myY2REzQNaQu9b7yaTAvAIWpOvVHIFE+sIonpb 5xld7cWg38223H54X7kNyZQgSRF9WuiD1o1BlBlBnXw/bt43w3grJyiEyIWXw0aTP/ah 46fUNwxZHucY4uHSKzitrK82vMvcWgiTZ26hI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=B5uPKRJ4/cnzT5pEDQVhhj+lp2U+K0dy80F1vtPjgJth1aeDHbOCGjhSGKvD76ioV1 ihbwlHvp4X+mq9xSlLyB2BVNQdE86PrkX+Pt/Hh6ycRf6b1MnPHejZoyUbzTwqgjEiwX VJ/TKqVDfLAix1Wb5InlXXSYVTg5pzPnfUTdA= Received: by 10.204.45.136 with SMTP id e8mr5016477bkf.94.1283290065374; Tue, 31 Aug 2010 14:27:45 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id y2sm6619713bkx.20.2010.08.31.14.27.44 (version=SSLv3 cipher=RC4-MD5); Tue, 31 Aug 2010 14:27:44 -0700 (PDT) Sender: Alexander Motin Message-ID: <4C7D73C8.5050205@FreeBSD.org> Date: Wed, 01 Sep 2010 00:27:36 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: gljennjohn@googlemail.com References: <4C7A5C28.1090904@FreeBSD.org> <20100830110932.23425932@ernst.jennejohn.org> <4C7B82EA.2040104@FreeBSD.org> <20100830121148.11926306@ernst.jennejohn.org> In-Reply-To: <20100830121148.11926306@ernst.jennejohn.org> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org, FreeBSD-Current Subject: Re: One-shot-oriented event timers management X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2010 21:27:47 -0000 Gary Jennejohn wrote: > On Mon, 30 Aug 2010 13:07:38 +0300 > Alexander Motin wrote: >> Yes, as I have said, at this moment empty ticks skipped only while CPU >> is in C2/C3 states. In C1 state there is no way to handle lost events on >> wake up. While it may be not very dangerous, it is not very good. >> > Too bad. I'd say that systems which are limited to C1 don't benefit > much (or not at all) from your changes. I've solved it! :) I've recalled that most of our interrupts are working in interrupt threads. It means that it may be not so important to disable interrupts completely, but only delay their threads execution by putting cpu_idle() inside critical section and releasing it only after all missed events handled. Sure, this approach will not help FILTER interrupt handlers, executed inside hardware interrupt context, but we have very few of them and they are usually very simple and I hope not very depend on system time precision. Also this new approach allows simple interrupts (like TLB invalidation IPIs) to execute before processing lost events. It should reduce performance penalty. To limit penalty even more, I have added counting of cpu_idle() calls per HZ tick. It allows to bypass timer stuff if CPU wakes up too often. It should help handle high interrupt rates without high overhead. Also I have added set of checks, blocking ACPI C3 state usage when C3-variant APIC timer is used and reduced priority of such timer. It makes use of C3 state usage safe enough and often allows AMD CPUs to not disable C1E state as it was done before. New patch is here: http://people.freebsd.org/~mav/timers_oneshot5.patch -- Alexander Motin