From owner-freebsd-mips@FreeBSD.ORG Thu Jul 22 16:01:39 2010 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0263106566B; Thu, 22 Jul 2010 16:01:39 +0000 (UTC) (envelope-from neelnatu@gmail.com) Received: from mail-px0-f182.google.com (mail-px0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id 9F0F28FC12; Thu, 22 Jul 2010 16:01:39 +0000 (UTC) Received: by pxi8 with SMTP id 8so3753940pxi.13 for ; Thu, 22 Jul 2010 09:01:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=n/8G0oW2i3E27Noy1GSorE5UyRaOHrzAEcsWai/odQc=; b=ow30u+sWiiKre1ZeDqH0Ytf2cu7BLomPFkEzXRdikWw/DEdD6b1vaE7eMSH14/7VhA pPFFjfDZ4vsyff7k5znbHltMUk5XGKU2YNU3L/JcOupmVZ4ZZyB879qCOkaiVp+UnzWr 4Nvqz9Awk7cYfA0C1xGk3ki+erH4khsgoec7g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=f0EJY6Dt13vH1mWjYDu7a6nP5oSnHCZYO1oMqKmWXR6O2H6fNV7wL1MyBWrXL8Xilz RgZ0U9FzKA1TXvZKZu2kan8V5Pwx2HqydOx13OBaGoJxUSbmGPrpyzJn7B4WYsYQcwfZ Qi3AFXicZm96vlL9XszTJKi6QBA6u6HH7nIE0= MIME-Version: 1.0 Received: by 10.142.204.17 with SMTP id b17mr2545794wfg.109.1279814498925; Thu, 22 Jul 2010 09:01:38 -0700 (PDT) Received: by 10.142.139.19 with HTTP; Thu, 22 Jul 2010 09:01:38 -0700 (PDT) In-Reply-To: <4C48089C.1010503@FreeBSD.org> References: <4C41A248.8090605@FreeBSD.org> <4C4698D6.2090104@FreeBSD.org> <4C47D8CD.7020209@FreeBSD.org> <4C48089C.1010503@FreeBSD.org> Date: Thu, 22 Jul 2010 09:01:38 -0700 Message-ID: From: Neel Natu To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-mips@freebsd.org Subject: Re: [RFC] Event timers on MIPS X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jul 2010 16:01:39 -0000 Hi Alexander, On Thu, Jul 22, 2010 at 2:00 AM, Alexander Motin wrote: > Neel Natu wrote: >> On Wed, Jul 21, 2010 at 10:36 PM, Alexander Motin wrote: >>> New patch: http://people.freebsd.org/~mav/timers_mips3.patch >> >> In clock_intr() it would seem that the last 'et_event_cb()' should be >> called conditionally only if (cycles_per_tick > 0). Of course, this is >> necessary only if my explanation about spurious clock_intr() >> invocations is correct. > > cycles_per_tick == 0 except spurious interrupt may also mean one-shot > timer operation mode. In such case callback should be called on > interrupt, but timer should be stopped after that. To protect from > counter still running after stop (if needed) - probably we need one more > variable, or define some specific cycles_per_tick value. > > I am not actually sure if writing 0xffffffff stops timer. I've just seen > it somewhere else. What is the proper way there to really stop the timer > to avoid spurious interrupt? > Writing 0xffffffff to compare register does not stop the timer nor the timer compare interrupt.The only way to stop the timer interrupt is to mask it in the status register. Having said that I cannot see why we would ever call clock_stop() for the mips timer. I think you should commit the code you have right now and then we can work offline to see if the spurious clock interrupt is really a problem in practice or just a theoretical possibility. best Neel >> I have tested the latest patch on the Sibyte as well and it works correctly. > > Thanks. > > -- > Alexander Motin >