From owner-freebsd-current@FreeBSD.ORG Tue Sep 27 17:42:55 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 D7397106574D; Tue, 27 Sep 2011 17:42:55 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 147408FC12; Tue, 27 Sep 2011 17:42:54 +0000 (UTC) Received: by eyg7 with SMTP id 7so6793341eyg.13 for ; Tue, 27 Sep 2011 10:42:53 -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=ogH16WaVAIH03lbKcgZT3i8UoZqo8xuNRugvdi4Xl3c=; b=H4qZbQUqdwxl3fGnWLV6PzevvLiYoUKWnczjAJCP3DfUzeZswOfUcgOhno7Yx2C4ev ybZesjluVFhAZ+L0dkQu2UMa3YYbh1SuIaZm/HHLS1je6qzpZemp0m5tCj3QP4mGphkQ oz24nVQ8sMy1XOiDuFFts9LfldvWmE7FpRE30= Received: by 10.223.40.145 with SMTP id k17mr3404004fae.76.1317145368205; Tue, 27 Sep 2011 10:42:48 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id n1sm24280405fad.20.2011.09.27.10.42.46 (version=SSLv3 cipher=OTHER); Tue, 27 Sep 2011 10:42:47 -0700 (PDT) Sender: Alexander Motin Message-ID: <4E820B12.9040209@FreeBSD.org> Date: Tue, 27 Sep 2011 20:42:42 +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> <4E81E4A1.3070301@FreeBSD.org> <4E81F21D.7000209@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 17:42:55 -0000 Adrian Chadd wrote: > On 27 September 2011 23:56, Alexander Motin wrote: >>> 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(). >> I was wrong. That's not good. I have no idea about mips wait instruction >> semantics, related to disabling interrupts. In x86 semantics proper >> solution is: > > [snip] > > Why is that you've protected the halt/wait part of the idle code > inside a critical section? > > I'm not sure what to do about MIPS Until proper solution found, try this patch. I think it should not harm: --- machdep.c (revision 225796) +++ machdep.c (working copy) @@ -497,7 +497,8 @@ critical_enter(); cpu_idleclock(); } - __asm __volatile ("wait"); + if (!sched_runnable()) + __asm __volatile ("wait"); if (!busy) { cpu_activeclock(); critical_exit(); -- Alexander Motin