From owner-freebsd-current@FreeBSD.ORG Tue Sep 27 14:58:48 2011 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 64F0B1065672; Tue, 27 Sep 2011 14:58:48 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 851208FC1A; Tue, 27 Sep 2011 14:58:47 +0000 (UTC) Received: by fxg9 with SMTP id 9so9343516fxg.13 for ; Tue, 27 Sep 2011 07:58:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; 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; bh=4KdsNYmFnFPdgsqqJPrYPPlj5YsuaaSgg09YgMQSNH8=; b=iLUMro9u0V8GRBCtL44D0o9RLDGXgBpva40Yf5rlKv97BGUAxFhAJITnpFwEyIZP/x YAstojMlf/1lJkQX2B6Qh1PYw1TQy7aCTiG4FOj6WxcqJ5JLC5FwV9rY14639Iypiz5q 7w36ba1fGdDUoE7Kmx8yI6EMVcEM5PgTuh96w= Received: by 10.223.65.141 with SMTP id j13mr12560408fai.101.1317135526390; Tue, 27 Sep 2011 07:58:46 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id a7sm23864787fam.22.2011.09.27.07.58.44 (version=SSLv3 cipher=OTHER); Tue, 27 Sep 2011 07:58:45 -0700 (PDT) Sender: Alexander Motin Message-ID: <4E81E4A1.3070301@FreeBSD.org> Date: Tue, 27 Sep 2011 17:58:41 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Adrian Chadd References: <201109261053.30410.jhb@freebsd.org> <201109261305.57602.jhb@freebsd.org> In-Reply-To: X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org Subject: Re: ath / 802.11n performance issues and timer code 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, 27 Sep 2011 14:58:48 -0000 Adrian Chadd wrote: > .. erm, sys/mips/mips/machdep.c: > > /* > * call platform specific code to halt (until next interrupt) for the idle loop > */ > void > cpu_idle(int busy) > { > KASSERT((mips_rd_status() & MIPS_SR_INT_IE) != 0, > ("interrupts disabled in idle process.")); > KASSERT((mips_rd_status() & MIPS_INT_MASK) != 0, > ("all interrupts masked in idle process.")); > > if (!busy) { > critical_enter(); > cpu_idleclock(); > } > __asm __volatile ("wait"); > if (!busy) { > cpu_activeclock(); > critical_exit(); > } > } > > .. does that look right? Yes it does. x86 does the same, but with more details. The general idea of the critical section is to block context switch out of idle thread until missed time events will be handled inside cpu_activeclock(). Yes, this increases interrupt latency after long idle period. That's why I have made it disabling under the high interrupt rate (busy flag set) and written specially optimized hardclock() handler to be called only once. Possibly same should be done to statclock() also. -- Alexander Motin