From owner-freebsd-net@FreeBSD.ORG Mon Oct 31 20:40:36 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0B83E16A421; Mon, 31 Oct 2005 20:40:36 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 26FAB43D45; Mon, 31 Oct 2005 20:40:35 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from [10.50.41.234] (Not Verified[10.50.41.234]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Mon, 31 Oct 2005 15:57:27 -0500 From: John Baldwin To: freebsd-current@freebsd.org Date: Mon, 31 Oct 2005 15:47:05 -0500 User-Agent: KMail/1.8.2 References: <20051027233636.GA39380@dmw.hopto.org> <20051028105057.J20147@fledge.watson.org> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200510311547.07571.jhb@freebsd.org> Cc: freebsd , Vaibhave Agarwal , Robert Watson , current@freebsd.org Subject: Re: How to call a function in the kernel from Local APIC timer handler X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2005 20:40:36 -0000 On Friday 28 October 2005 07:39 pm, Vaibhave Agarwal wrote: > Hi, I need some help with the new local APIC functionality added in > FreeBSD 6.0 and above. > > All the code which I am writing is in FreeBSD kernel. > > I was using LAPIC one shot timer for scheduling some events in the kernel. > The problem is that I cannot call the function in my code, directly from > the APIC timer handler, because all the interrupts are disabled in the > APIC timer handler ( function is lapic_handle_timer() ), and my function > uses a sleep mutex to protect the kernel code I have written. > Therefore, I schedule a software interrupt thread, which calls my function > later in time. > Is there a way, I can call my function instantly from the > lapic_handle_timer, bcoz using the software interrupt thread, decreases > the accuracy of the scheduler i am using. You can use spin mutexes rather than sleep mutexes in the lapic_handle_timer() context. If you need msleep/wakeup() functionality you can provide that using the sleepq(9) interface directly. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org