From owner-freebsd-hackers@FreeBSD.ORG Sat Oct 1 09:49:15 2011 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 D62E3106566B; Sat, 1 Oct 2011 09:49:15 +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 441FD8FC13; Sat, 1 Oct 2011 09:49:14 +0000 (UTC) Received: by eyg7 with SMTP id 7so2199940eyg.13 for ; Sat, 01 Oct 2011 02:49:14 -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=BXXCJDBwdpO2hQNiqN61+OL+cFUE/ueS4uD4+N7u7zk=; b=xy/PjiexyvBHJjf1MUCZgX1yfmH8hvZriTIFGF0pWictTJmaEBuxgI4q4ffaKAIOJQ hkrzw/wgirEE0yv0BrJCeXE/0p/ZFRVuNienW26jFTarWNxg4nGM2Nuk7YHe7iaeg2dz fhpXbxHpg5gxgfFvi5o6BA0jrCYtp0oHoPLAw= Received: by 10.223.43.211 with SMTP id x19mr10840593fae.142.1317462554165; Sat, 01 Oct 2011 02:49:14 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id f25sm10765759faf.7.2011.10.01.02.49.12 (version=SSLv3 cipher=OTHER); Sat, 01 Oct 2011 02:49:13 -0700 (PDT) Sender: Alexander Motin Message-ID: <4E86E20B.7000703@FreeBSD.org> Date: Sat, 01 Oct 2011 12:48:59 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Adrian Chadd References: <4E86DC86.3040204@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-hackers@freebsd.org Subject: Re: how are callouts handled in cpu_idle() ? 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: Sat, 01 Oct 2011 09:49:15 -0000 Adrian Chadd wrote: > On 1 October 2011 17:25, Alexander Motin wrote: > >> Use of critical section in cpu_idle() from the beginning was based on >> number of assumptions about filter interrupt handler's limitations. > > [snip] > >> So, if you really need to use callout() in interrupt filter, we could >> disable interrupts before calling cpu_idleclock(), as you have told. But >> that is only a partial solution and you should be ready for the second >> half of the problems. Depending on your needs I am not sure it will >> satisfy you. > > I'm not using callouts from a swi in ath(4), at least not yet. I > haven't yet gone over all the drivers in sys/dev/ to see if any of > them are actually doing this. > I was just making an observation. All I've told above related only to filter interrupt handlers. Swi has no any problems from this point. Swi is alike to regular threaded interrupt handler, it has no this kind of limitations. If interrupt fires after cpu_idleclock() and schedules swi, sched_runnable() will return non-zero and sleep will be canceled. After that, when it is finally called, swi have updated time and allowed to use callouts as it wants to. -- Alexander Motin