From owner-freebsd-mips@FreeBSD.ORG  Wed Aug 18 14:45:48 2010
Return-Path: <owner-freebsd-mips@FreeBSD.ORG>
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 61A2C1065670;
	Wed, 18 Aug 2010 14:45:48 +0000 (UTC)
	(envelope-from c.jayachandran@gmail.com)
Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com
	[209.85.213.182])
	by mx1.freebsd.org (Postfix) with ESMTP id E05F68FC0C;
	Wed, 18 Aug 2010 14:45:47 +0000 (UTC)
Received: by yxe42 with SMTP id 42so265529yxe.13
	for <multiple recipients>; Wed, 18 Aug 2010 07:45:47 -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=Mrv18y64/3GtTs2Nmpt2p52GeSJuAft6V4cReCZJdcE=;
	b=JbbV2vGuw/PHnbgTRCnmBOYyqq+GxxKHFSw8pXkDsbQkqFRM7s+5ZD3eQ8Ef1pzJy2
	DijIWUw3KVCJw4Ag25qkuZIEmng8XrykM04qRXQub++RarGDoLESI3P5vvCMc+jtlbXz
	qQsWsH1fT1kGxEwG5LktcPz4rCQPE6KEltzak=
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=AtQiziY1zknvjSRu86gdVtbkJXPyB8o8MiD3Q8ETHqkvGauwl4yDCT7v6uNkQu+RiD
	6039F8H8wK1h/61756DUkWv6mbFhOUXFtXOogapPR/7/HoKFoWLSUyJXxxd1SBhnr31t
	tlG4iUahh2yNrI+siXFRJ0ymVA+xU7SZfQjkY=
MIME-Version: 1.0
Received: by 10.151.62.37 with SMTP id p37mr365888ybk.275.1282142747110; Wed,
	18 Aug 2010 07:45:47 -0700 (PDT)
Received: by 10.150.58.10 with HTTP; Wed, 18 Aug 2010 07:45:46 -0700 (PDT)
In-Reply-To: <4C5977BC.1060104@FreeBSD.org>
References: <4C41A248.8090605@FreeBSD.org>
	<AANLkTilKYw4UqmfEee9zHGosEDzy4hiFob1d8R9jcB25@mail.gmail.com>
	<4C41B4CF.6080409@FreeBSD.org>
	<AANLkTik8_NGm7nKYXT1d1E4Vj6vYQPWHnnLDi78YnvQD@mail.gmail.com>
	<4C4205CC.6080700@FreeBSD.org>
	<AANLkTikUpqLeogkqxqWzzejp=7FstHX2wVRWNrYoWGCp@mail.gmail.com>
	<4C4ED247.80701@FreeBSD.org>
	<AANLkTiktMt87V5jXV0+nagHjpfTkBQ8Fu6CK7HqNXff3@mail.gmail.com>
	<AANLkTinH1itTauurEFCZVyz+W4T02niPV1jQeNART1Gm@mail.gmail.com>
	<4C555CF7.5080101@FreeBSD.org>
	<AANLkTimqAitBoFyKT-8bE+S6+1wjnso569E3exrY6EWB@mail.gmail.com>
	<4C5977BC.1060104@FreeBSD.org>
Date: Wed, 18 Aug 2010 20:15:46 +0530
Message-ID: <AANLkTimWc1-X=thdqu=Mk4h7pBwNmC4xooH9XcQz-UeL@mail.gmail.com>
From: "Jayachandran C." <c.jayachandran@gmail.com>
To: Alexander Motin <mav@freebsd.org>, Neel Natu <neelnatu@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Cc: Randall Stewart <rrs@freebsd.org>, 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 <freebsd-mips.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-mips>,
	<mailto:freebsd-mips-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-mips>
List-Post: <mailto:freebsd-mips@freebsd.org>
List-Help: <mailto:freebsd-mips-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-mips>,
	<mailto:freebsd-mips-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 18 Aug 2010 14:45:48 -0000

On Wed, Aug 4, 2010 at 7:52 PM, Alexander Motin <mav@freebsd.org> wrote:
> Neel Natu wrote:
>> Thanks for taking the time to review the patch. Here is the updated patch:
>> http://people.freebsd.org/~neel/tick_diff.txt
>
> Seems fine.
>
>> On Sun, Aug 1, 2010 at 4:39 AM, Alexander Motin <mav@freebsd.org> wrote:
>>> "t_upper++;" there looks a bit strange, as it is not written back. The
>>> wrapping stuff won't work if this timer interrupts were not used.
>>
>> This part is intentional.
>>
>> I wanted only clock_intr() to update the cached values of
>> 'counter_upper' and 'counter_lower_last' and tick_ticker() to sample a
>> consistent snapshot of the tuple and then operate on it.
>>
>> I have added an XXX comment to describe the dependency. We can revisit
>> this if we change the default timer in mips.
>
> It's not about default timer, but about having any other timer. But if
> you wish so, it should be enough for now.

I'm seeing a problem with the timer code on XLR, when I run ping:

xlrboard# ping 192.168.30.1
PING 192.168.30.1 (192.168.30.1): 56 data bytes
64 bytes from 192.168.30.1: icmp_seq=0 ttl=64 time=0.649 ms
64 bytes from 192.168.30.1: icmp_seq=1 ttl=64 time=362.624 ms
64 bytes from 192.168.30.1: icmp_seq=2 ttl=64 time=0.219 ms
64 bytes from 192.168.30.1: icmp_seq=3 ttl=64 time=362.631 ms
64 bytes from 192.168.30.1: icmp_seq=4 ttl=64 time=-362.168 ms
64 bytes from 192.168.30.1: icmp_seq=5 ttl=64 time=362.628 ms
64 bytes from 192.168.30.1: icmp_seq=6 ttl=64 time=0.234 ms
64 bytes from 192.168.30.1: icmp_seq=7 ttl=64 time=362.631 ms
64 bytes from 192.168.30.1: icmp_seq=8 ttl=64 time=0.483 ms

This happens with the current XLR code, and even after updating it
from mips/mips/tick.c (to take in Neel's changes).

Due to the way our network driver works, there is a likely that the
ping packets are received by different CPUs every time, but having the
negative time there seems to indicate some issue.  Also on XLR the
count registers are not synchronized across cores, so the values will
be different for each CPU.

 I will look at some more, but meanwhile, any clue on what might be
wrong would be helpful.  I still haven't done the PIC timer based
timecount, that might fix it, if it is due to the count registers
being out of sync.

Thanks,
JC.