From owner-freebsd-threads@FreeBSD.ORG Wed Jun 1 02:57:48 2005 Return-Path: X-Original-To: threads@freebsd.org Delivered-To: freebsd-threads@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C496416A41C; Wed, 1 Jun 2005 02:57:48 +0000 (GMT) (envelope-from anupamc@cs.rice.edu) Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id 84CD743D53; Wed, 1 Jun 2005 02:57:48 +0000 (GMT) (envelope-from anupamc@cs.rice.edu) Received: from localhost (calypso.cs.rice.edu [128.42.1.127]) by cs.rice.edu (Postfix) with ESMTP id D301E4A9AD; Tue, 31 May 2005 21:57:47 -0500 (CDT) Received: from cs.rice.edu ([128.42.1.30]) by localhost (calypso.cs.rice.edu [128.42.1.127]) (amavisd-new, port 10024) with LMTP id 05413-01-30; Tue, 31 May 2005 21:57:47 -0500 (CDT) Received: from frosty.cs.rice.edu (frosty.cs.rice.edu [128.42.1.20]) by cs.rice.edu (Postfix) with ESMTP id C5D9D4A9A2; Tue, 31 May 2005 21:57:46 -0500 (CDT) Received: from localhost (anupamc@localhost) by frosty.cs.rice.edu (8.9.3+Sun/8.9.0) with ESMTP id VAA06322; Tue, 31 May 2005 21:57:21 -0500 (CDT) X-Authentication-Warning: frosty.cs.rice.edu: anupamc owned process doing -bs Date: Tue, 31 May 2005 21:57:20 -0500 (CDT) From: Anupam Chanda To: threads@freebsd.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavis-2.2.1 at cs.rice.edu Cc: alc@freebsd.org, Alan Cox Subject: ITIMERs & pthreads X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2005 02:57:48 -0000 Hello, My platform is FreeBSD 5.4-PRERELEASE. I am trying to use itimers with programs using pthreads which use the scheduler activation based libpthread. Thought ITIMER_REAL/SIGALRM works fine, ITIMER_VIRTUAL/SIGVTALRM and ITIMER_PROF/SIGPROF are not being delivered to the process. The problem seems to be in the following function in kern/kern_clock.c which ignores itimers for scheduler activation-enabled processes. (I have annotated this line with /*********/). Can you please provide a fix to this problem. Thanks, Anupam void hardclock_process(frame) register struct clockframe *frame; { struct pstats *pstats; struct thread *td = curthread; struct proc *p = td->td_proc; /* * Run current process's virtual and profile time, as needed. */ mtx_lock_spin_flags(&sched_lock, MTX_QUIET); if (p->p_flag & P_SA) { /* XXXKSE What to do? */ /******************************************************************/ } else { pstats = p->p_stats; if (CLKF_USERMODE(frame) && timevalisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value) && itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL], tick) == 0) { p->p_sflag |= PS_ALRMPEND; td->td_flags |= TDF_ASTPENDING; } if (timevalisset(&pstats->p_timer[ITIMER_PROF].it_value) && itimerdecr(&pstats->p_timer[ITIMER_PROF], tick) == 0) { p->p_sflag |= PS_PROFPEND; td->td_flags |= TDF_ASTPENDING; } } mtx_unlock_spin_flags(&sched_lock, MTX_QUIET); }