From owner-freebsd-mips@FreeBSD.ORG  Wed Sep  1 07:07:38 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 A4EC810656AB
	for <freebsd-mips@freebsd.org>; Wed,  1 Sep 2010 07:07:38 +0000 (UTC)
	(envelope-from c.jayachandran@gmail.com)
Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54])
	by mx1.freebsd.org (Postfix) with ESMTP id 658958FC0C
	for <freebsd-mips@freebsd.org>; Wed,  1 Sep 2010 07:07:38 +0000 (UTC)
Received: by gwj23 with SMTP id 23so3368990gwj.13
	for <freebsd-mips@freebsd.org>; Wed, 01 Sep 2010 00:07:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:received:received:date:message-id
	:subject:from:to:content-type;
	bh=H0yAk4d9+2Cr6hWSut/PrQp3YJiyCpyQc6CSjzO1UrQ=;
	b=sgIq2i2NIMVYG5dWOK5xXqI/lO+UeTaU+hwjk/xee4yNeXC2wMHTKKwTZ2UVcIfP3n
	xrBxlqxPU1K8LTo2DqTycmjwt1AUsF+J90lKvtlKWkx7ROBRSQWJAXzgvePiMN2YLskD
	r/55bD65bVX9g5Xfexv+0cAatl2y+yrENUoec=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	b=TaT71n3UqEidwq0cgWdicPr42WH7EfOTq4+JNbl6H1AmNx2zHSwWpXj1K+aufqmHPO
	9fSY1MoRYB6XamXGy3lMHAOhSy8DxtmtzJEXUDYv3ndB4Q9j5zPR/DfhgSljyj6ZllNk
	AOPKihney7c/uoKSETx4w89R67qtq5Mk23mkY=
MIME-Version: 1.0
Received: by 10.150.200.3 with SMTP id x3mr3149832ybf.348.1283324857639; Wed,
	01 Sep 2010 00:07:37 -0700 (PDT)
Received: by 10.150.96.8 with HTTP; Wed, 1 Sep 2010 00:07:37 -0700 (PDT)
Date: Wed, 1 Sep 2010 12:37:37 +0530
Message-ID: <AANLkTimjmpOBOAncY9K9AhCodvp27t=XTQ9qZp4q8+vv@mail.gmail.com>
From: "Jayachandran C." <c.jayachandran@gmail.com>
To: freebsd-mips@freebsd.org
Content-Type: text/plain; charset=ISO-8859-1
Subject: busdma_machdep.c with more than 512M memory
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, 01 Sep 2010 07:07:38 -0000

I was looking at a few crashes I see with PCI drivers, and I think it
is caused by an issue in busdma_machdep.c where physical address is
directly converted using MIPS_PHYS_TO_KSEG1. I have not looked at it
in detail, but it looks obviously wrong.

Any suggestions on how to fix thiis is welcome, it probably needs an
uncached TLB entry. On 64bit we could use XKPHYS uncached.


---
 632         if (newmap->flags & DMAMAP_UNCACHEABLE) {
 633                 void *tmpaddr = (void *)*vaddr;
 634
 635                 if (tmpaddr) {
 636                         tmpaddr = (void
*)MIPS_PHYS_TO_KSEG1(vtophys(tmpaddr));
 637                         newmap->origbuffer = *vaddr;
 638                         newmap->allocbuffer = tmpaddr;
 639                         mips_dcache_wbinv_range((vm_offset_t)*vaddr,
 640                             dmat->maxsize);
 641                         *vaddr = tmpaddr;
 642                 }
---
1361                 bpage->busaddr = pmap_kextract(bpage->vaddr);
1362                 bpage->vaddr_nocache =
1363                     (vm_offset_t)MIPS_PHYS_TO_KSEG1(bpage->busaddr);
1364                 mtx_lock(&bounce_lock);

Thanks,
JC.

From owner-freebsd-mips@FreeBSD.ORG  Thu Sep  2 14:52:23 2010
Return-Path: <owner-freebsd-mips@FreeBSD.ORG>
Delivered-To: mips@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 865D810656C1;
	Thu,  2 Sep 2010 14:52:23 +0000 (UTC)
	(envelope-from tinderbox@freebsd.org)
Received: from freebsd-current.sentex.ca (freebsd-current.sentex.ca
	[64.7.128.98]) by mx1.freebsd.org (Postfix) with ESMTP id 47E318FC14;
	Thu,  2 Sep 2010 14:52:23 +0000 (UTC)
Received: from freebsd-current.sentex.ca (localhost [127.0.0.1])
	by freebsd-current.sentex.ca (8.14.4/8.14.3) with ESMTP id
	o82EqMkj032251; Thu, 2 Sep 2010 10:52:22 -0400 (EDT)
	(envelope-from tinderbox@freebsd.org)
Received: (from tinderbox@localhost)
	by freebsd-current.sentex.ca (8.14.4/8.14.3/Submit) id o82EqMt0032250; 
	Thu, 2 Sep 2010 14:52:22 GMT (envelope-from tinderbox@freebsd.org)
Date: Thu, 2 Sep 2010 14:52:22 GMT
Message-Id: <201009021452.o82EqMt0032250@freebsd-current.sentex.ca>
X-Authentication-Warning: freebsd-current.sentex.ca: tinderbox set sender to
	FreeBSD Tinderbox <tinderbox@freebsd.org> using -f
Sender: FreeBSD Tinderbox <tinderbox@freebsd.org>
From: FreeBSD Tinderbox <tinderbox@freebsd.org>
To: FreeBSD Tinderbox <tinderbox@freebsd.org>, <stable@freebsd.org>,
	<mips@freebsd.org>
Precedence: bulk
Cc: 
Subject: [releng_8_0 tinderbox] failure on mips/mips
X-BeenThere: freebsd-mips@freebsd.org
X-Mailman-Version: 2.1.5
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: Thu, 02 Sep 2010 14:52:23 -0000

TB --- 2010-09-02 14:12:31 - tinderbox 2.6 running on freebsd-current.sentex.ca
TB --- 2010-09-02 14:12:31 - starting RELENG_8_0 tinderbox run for mips/mips
TB --- 2010-09-02 14:12:31 - cleaning the object tree
TB --- 2010-09-02 14:12:46 - cvsupping the source tree
TB --- 2010-09-02 14:12:46 - /usr/bin/csup -z -r 3 -g -L 1 -h cvsup.sentex.ca /tinderbox/RELENG_8_0/mips/mips/supfile
TB --- 2010-09-02 14:52:22 - WARNING: /usr/bin/csup returned exit code  1 
TB --- 2010-09-02 14:52:22 - ERROR: unable to cvsup the source tree
TB --- 2010-09-02 14:52:22 - 0.55 user 12.10 system 2390.79 real


http://tinderbox.freebsd.org/tinderbox-releng_8-RELENG_8_0-mips-mips.full

From owner-freebsd-mips@FreeBSD.ORG  Thu Sep  2 16:03:19 2010
Return-Path: <owner-freebsd-mips@FreeBSD.ORG>
Delivered-To: mips@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 58424106572B;
	Thu,  2 Sep 2010 16:03:19 +0000 (UTC)
	(envelope-from tinderbox@freebsd.org)
Received: from freebsd-current.sentex.ca (freebsd-current.sentex.ca
	[64.7.128.98]) by mx1.freebsd.org (Postfix) with ESMTP id 157348FC14;
	Thu,  2 Sep 2010 16:03:18 +0000 (UTC)
Received: from freebsd-current.sentex.ca (localhost [127.0.0.1])
	by freebsd-current.sentex.ca (8.14.4/8.14.3) with ESMTP id
	o82G3IQJ032538; Thu, 2 Sep 2010 12:03:18 -0400 (EDT)
	(envelope-from tinderbox@freebsd.org)
Received: (from tinderbox@localhost)
	by freebsd-current.sentex.ca (8.14.4/8.14.3/Submit) id o82G3IJY032537; 
	Thu, 2 Sep 2010 16:03:18 GMT (envelope-from tinderbox@freebsd.org)
Date: Thu, 2 Sep 2010 16:03:18 GMT
Message-Id: <201009021603.o82G3IJY032537@freebsd-current.sentex.ca>
X-Authentication-Warning: freebsd-current.sentex.ca: tinderbox set sender to
	FreeBSD Tinderbox <tinderbox@freebsd.org> using -f
Sender: FreeBSD Tinderbox <tinderbox@freebsd.org>
From: FreeBSD Tinderbox <tinderbox@freebsd.org>
To: FreeBSD Tinderbox <tinderbox@freebsd.org>, <stable@freebsd.org>,
	<mips@freebsd.org>
Precedence: bulk
Cc: 
Subject: [releng_8_1 tinderbox] failure on mips/mips
X-BeenThere: freebsd-mips@freebsd.org
X-Mailman-Version: 2.1.5
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: Thu, 02 Sep 2010 16:03:19 -0000

TB --- 2010-09-02 15:26:03 - tinderbox 2.6 running on freebsd-current.sentex.ca
TB --- 2010-09-02 15:26:03 - starting RELENG_8_1 tinderbox run for mips/mips
TB --- 2010-09-02 15:26:03 - cleaning the object tree
TB --- 2010-09-02 15:26:09 - cvsupping the source tree
TB --- 2010-09-02 15:26:09 - /usr/bin/csup -z -r 3 -g -L 1 -h cvsup.sentex.ca /tinderbox/RELENG_8_1/mips/mips/supfile
TB --- 2010-09-02 16:03:18 - WARNING: /usr/bin/csup returned exit code  1 
TB --- 2010-09-02 16:03:18 - ERROR: unable to cvsup the source tree
TB --- 2010-09-02 16:03:18 - 0.30 user 4.59 system 2235.22 real


http://tinderbox.freebsd.org/tinderbox-releng_8-RELENG_8_1-mips-mips.full

From owner-freebsd-mips@FreeBSD.ORG  Thu Sep  2 17:11:41 2010
Return-Path: <owner-freebsd-mips@FreeBSD.ORG>
Delivered-To: mips@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D8FD410657E1;
	Thu,  2 Sep 2010 17:11:41 +0000 (UTC)
	(envelope-from tinderbox@freebsd.org)
Received: from freebsd-current.sentex.ca (freebsd-current.sentex.ca
	[64.7.128.98]) by mx1.freebsd.org (Postfix) with ESMTP id 9BD2A8FC19;
	Thu,  2 Sep 2010 17:11:41 +0000 (UTC)
Received: from freebsd-current.sentex.ca (localhost [127.0.0.1])
	by freebsd-current.sentex.ca (8.14.4/8.14.3) with ESMTP id
	o82HBeqj032808; Thu, 2 Sep 2010 13:11:40 -0400 (EDT)
	(envelope-from tinderbox@freebsd.org)
Received: (from tinderbox@localhost)
	by freebsd-current.sentex.ca (8.14.4/8.14.3/Submit) id o82HBeXj032807; 
	Thu, 2 Sep 2010 17:11:40 GMT (envelope-from tinderbox@freebsd.org)
Date: Thu, 2 Sep 2010 17:11:40 GMT
Message-Id: <201009021711.o82HBeXj032807@freebsd-current.sentex.ca>
X-Authentication-Warning: freebsd-current.sentex.ca: tinderbox set sender to
	FreeBSD Tinderbox <tinderbox@freebsd.org> using -f
Sender: FreeBSD Tinderbox <tinderbox@freebsd.org>
From: FreeBSD Tinderbox <tinderbox@freebsd.org>
To: FreeBSD Tinderbox <tinderbox@freebsd.org>, <stable@freebsd.org>,
	<mips@freebsd.org>
Precedence: bulk
Cc: 
Subject: [releng_8 tinderbox] failure on mips/mips
X-BeenThere: freebsd-mips@freebsd.org
X-Mailman-Version: 2.1.5
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: Thu, 02 Sep 2010 17:11:42 -0000

TB --- 2010-09-02 16:38:08 - tinderbox 2.6 running on freebsd-current.sentex.ca
TB --- 2010-09-02 16:38:08 - starting RELENG_8 tinderbox run for mips/mips
TB --- 2010-09-02 16:38:08 - cleaning the object tree
TB --- 2010-09-02 16:38:15 - cvsupping the source tree
TB --- 2010-09-02 16:38:15 - /usr/bin/csup -z -r 3 -g -L 1 -h cvsup.sentex.ca /tinderbox/RELENG_8/mips/mips/supfile
TB --- 2010-09-02 17:11:40 - WARNING: /usr/bin/csup returned exit code  1 
TB --- 2010-09-02 17:11:40 - ERROR: unable to cvsup the source tree
TB --- 2010-09-02 17:11:40 - 0.27 user 4.62 system 2012.45 real


http://tinderbox.freebsd.org/tinderbox-releng_8-RELENG_8-mips-mips.full

From owner-freebsd-mips@FreeBSD.ORG  Fri Sep  3 15:32:26 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 EB8D21065867
	for <freebsd-mips@freebsd.org>; Fri,  3 Sep 2010 15:32:25 +0000 (UTC)
	(envelope-from PHeyman@adaranet.com)
Received: from barracuda.adaranet.com (smtp.adaranet.com [72.5.229.2])
	by mx1.freebsd.org (Postfix) with ESMTP id CC8D28FC08
	for <freebsd-mips@freebsd.org>; Fri,  3 Sep 2010 15:32:25 +0000 (UTC)
X-ASG-Debug-ID: 1283527037-5061bcf80001-1gY7mK
Received: from SJ-EXCH-1.adaranet.com ([10.10.1.29]) by barracuda.adaranet.com
	with ESMTP id 9gF2sJ4uQpEaIKhK; Fri, 03 Sep 2010 08:17:17 -0700 (PDT)
X-Barracuda-Envelope-From: PHeyman@adaranet.com
Received: from SJ-EXCH-1.adaranet.com ([fe80::7042:d8c2:5973:c523]) by
	SJ-EXCH-1.adaranet.com ([fe80::7042:d8c2:5973:c523%14]) with mapi;
	Fri, 3 Sep 2010 08:17:17 -0700
From: Paul Heyman <PHeyman@adaranet.com>
X-Barracuda-BBL-IP: fe80::7042:d8c2:5973:c523
X-Barracuda-RBL-IP: fe80::7042:d8c2:5973:c523
To: "jmallett@FreeBSD.org" <jmallett@FreeBSD.org>, Patrick Mahan
	<PMahan@adaranet.com>
Date: Fri, 3 Sep 2010 08:17:16 -0700
X-ASG-Orig-Subj: RE: Re: Now partially booting on our CN58XX eval board
Thread-Topic: Re: Now partially booting on our CN58XX eval board
Thread-Index: ActLdII+EePiKSS2TsWePfTLUJgQvwAADo6k
Message-ID: <32AB5C9615CC494997D9ABB1DB12783C024C8C5A64@SJ-EXCH-1.adaranet.com>
References: <4C81066B.9040902@multi-media-tech.com>
In-Reply-To: <4C81066B.9040902@multi-media-tech.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
acceptlanguage: en-US
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Barracuda-Connect: UNKNOWN[10.10.1.29]
X-Barracuda-Start-Time: 1283527037
X-Barracuda-URL: http://172.16.10.203:8000/cgi-mod/mark.cgi
X-Virus-Scanned: by bsmtpd at adaranet.com
Cc: "freebsd-mips@freebsd.org" <freebsd-mips@freebsd.org>
Subject: RE: Re: Now partially booting on our CN58XX eval board
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: Fri, 03 Sep 2010 15:32:26 -0000

Juli

Thanks for the pointer regarding limiting the bootmem to 512M. I modified w=
hat gets passed to cvmx_bootmem_phy_alloc in the max_addr parameter.

That gets us past the panic and brings the kernel up to a prompt.
No failure conditions observed on the console
>From the shell prompt all seems well.

But when we try and ping in or out we seem to get a panic from the ethernet=
 controller.
It does not happen all of the time. It usually take 50 - 200 pings to cause=
 the problem.
I have isolated it to a few places in cvm_oct_tasklet_rx function in ethern=
et-rx.c.

1. At line 293 . it looks like the entire packet is stored in the work entr=
y. I can see the panic in the code, but on the console it also indicates a =
NULL ptr being passed to cvmx_phys_to_ptr. Not sure if the NULL pointer is =
caused by the panic. This is what is on the console

root@-2-/root# WARNING:
cvmx_phys_to_ptr() passed a zero address
panic: cvm_oct_tasklet_rx: not yet implemented; copy in small packet.
KDB: enter: panic
[ thread pid 0 tid 100016 ]
Stopped at      kdb_enter+0x50: lui     at,0x8358
db>

2. At line 406 of the same file. Calling cvm_oct_mem_fill_fpa results in a =
TLB miss (store).



Any ideas

Thanks for your help

Paul Heyman
pheyman@adaranetworks.com


-------- Original Message --------
Subject:        Re: Now partially booting on our CN58XX eval board
Date:   Fri, 27 Aug 2010 12:57:18 -0700
From:   Juli Mallett <jmallett@FreeBSD.org><mailto:jmallett@FreeBSD.org>
To:     Patrick Mahan <pmahan@adaranet.com><mailto:pmahan@adaranet.com>
CC:     freebsd-mips@freebsd.org<mailto:freebsd-mips@freebsd.org> <freebsd-=
mips@freebsd.org><mailto:freebsd-mips@freebsd.org>



On Fri, Aug 27, 2010 at 11:16, Patrick Mahan <pmahan@adaranet.com><mailto:p=
mahan@adaranet.com> wrote:
> I have an engineer that thinks this would be fun to resolve, so I am lett=
ing
> him run with this for now.  Is this an address coming from the mii layer?

I looked at the code and Warner's output a few weeks ago and it seems
to be an address coming from the command queue code
(cvmx-cmd-queue.{c,h} in the Simple Executive) or maybe it was the FPA
code.  I think I told Warner that it was happening because mbufs are
put into the FPA and we don't have a way to create an ephemeral
mapping given a physical address that is not direct-mappable.  Making
it so that your system won't allocate mbufs above 0x2.... is a quick
hack to test that theory and a reasonable workaround for o32 (since
Octeon really makes more sense with n64 kernels, at minimum) so I'd
suggest modifying the memory setup code in octeon_machdep.c to not add
any memory above 512M or whatever.

If you have an engineer with some time, though, I'd suggest having
them work on COMPAT_FREEBSD32 for o32, which should be around a day or
two worth of work and would let you use an n64 kernel.  :)

Juli.
_______________________________________________
freebsd-mips@freebsd.org<mailto:freebsd-mips@freebsd.org> mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-mips
To unsubscribe, send any mail to "freebsd-mips-unsubscribe@freebsd.org"<mai=
lto:freebsd-mips-unsubscribe@freebsd.org>



From owner-freebsd-mips@FreeBSD.ORG  Fri Sep  3 18:38:27 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 9FE4C10656A6
	for <freebsd-mips@freebsd.org>; Fri,  3 Sep 2010 18:38:27 +0000 (UTC)
	(envelope-from stas@FreeBSD.org)
Received: from mx0.deglitch.com (backbone.deglitch.com [78.110.53.255])
	by mx1.freebsd.org (Postfix) with ESMTP id 207358FC18
	for <freebsd-mips@freebsd.org>; Fri,  3 Sep 2010 18:38:26 +0000 (UTC)
Received: from sputnik.SpringDaemons.com (c-98-234-104-113.hsd1.ca.comcast.net
	[98.234.104.113])
	by mx0.deglitch.com (Postfix) with ESMTPA id B62828FC4E;
	Fri,  3 Sep 2010 22:13:18 +0400 (MSD)
Received: from sputnik.SpringDaemons.com (localhost [127.0.0.1])
	by sputnik.SpringDaemons.com (Postfix) with SMTP id C05D2B8F3;
	Fri,  3 Sep 2010 11:21:33 -0700 (PDT)
Date: Fri, 3 Sep 2010 11:21:33 -0700
From: Stanislav Sedov <stas@FreeBSD.org>
To: Paul Heyman <PHeyman@adaranet.com>
Message-Id: <20100903112133.dfcae3e5.stas@FreeBSD.org>
In-Reply-To: <32AB5C9615CC494997D9ABB1DB12783C024C8C5A64@SJ-EXCH-1.adaranet.com>
References: <4C81066B.9040902@multi-media-tech.com>
	<32AB5C9615CC494997D9ABB1DB12783C024C8C5A64@SJ-EXCH-1.adaranet.com>
Organization: The FreeBSD Project
X-XMPP: ssedov@jabber.ru
X-Voice: +7 916 849 20 23
X-PGP-Fingerprin: F21E D6CC 5626 9609 6CE2  A385 2BF5 5993 EB26 9581
X-Mailer: carrier-pigeon
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Cc: "jmallett@FreeBSD.org" <jmallett@FreeBSD.org>,
	Patrick Mahan <PMahan@adaranet.com>,
	"freebsd-mips@freebsd.org" <freebsd-mips@freebsd.org>
Subject: Re: Now partially booting on our CN58XX eval board
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: Fri, 03 Sep 2010 18:38:27 -0000

On Fri, 3 Sep 2010 08:17:16 -0700
Paul Heyman <PHeyman@adaranet.com> mentioned:

> Juli
> 
> Thanks for the pointer regarding limiting the bootmem to 512M. I modified what gets passed to cvmx_bootmem_phy_alloc in the max_addr parameter.
> 
> That gets us past the panic and brings the kernel up to a prompt.
> No failure conditions observed on the console
> >From the shell prompt all seems well.
> 
> But when we try and ping in or out we seem to get a panic from the ethernet controller.
> It does not happen all of the time. It usually take 50 - 200 pings to cause the problem.
> I have isolated it to a few places in cvm_oct_tasklet_rx function in ethernet-rx.c.
> 
> 1. At line 293 . it looks like the entire packet is stored in the work entry. I can see the panic in the code, but on the console it also indicates a NULL ptr being passed to cvmx_phys_to_ptr. Not sure if the NULL pointer is caused by the panic. This is what is on the console
> 
> root@-2-/root# WARNING:
> cvmx_phys_to_ptr() passed a zero address
> panic: cvm_oct_tasklet_rx: not yet implemented; copy in small packet.
> KDB: enter: panic
> [ thread pid 0 tid 100016 ]
> Stopped at      kdb_enter+0x50: lui     at,0x8358
> db>
> 
> 2. At line 406 of the same file. Calling cvm_oct_mem_fill_fpa results in a TLB miss (store).
> 

Hey, Paul!

Try the following patch.
It fixed the problem for me, but I had
no time to commit it yet.

Index: sys/mips/cavium/octe/cavium-ethernet.h
===================================================================
--- sys/mips/cavium/octe/cavium-ethernet.h	(revision 208288)
+++ sys/mips/cavium/octe/cavium-ethernet.h	(working copy)
@@ -119,6 +119,8 @@
 
 	struct ifmedia media;
 	int if_flags;
+
+	struct mtx tx_mtx;
 } cvm_oct_private_t;
 
 
Index: sys/mips/cavium/octe/octe.c
===================================================================
--- sys/mips/cavium/octe/octe.c	(revision 208288)
+++ sys/mips/cavium/octe/octe.c	(working copy)
@@ -78,6 +78,9 @@
 
 #include "miibus_if.h"
 
+#define	OCTE_TX_LOCK(priv)	mtx_lock(&(priv)->tx_mtx)
+#define	OCTE_TX_UNLOCK(priv)	mtx_unlock(&(priv)->tx_mtx)
+
 static int		octe_probe(device_t);
 static int		octe_attach(device_t);
 static int		octe_detach(device_t);
@@ -174,6 +177,8 @@
 
 	priv->if_flags = ifp->if_flags;
 
+	mtx_init(&priv->tx_mtx, ifp->if_xname, "octe tx send queue", MTX_DEF);
+
 	for (qos = 0; qos < 16; qos++) {
 		mtx_init(&priv->tx_free_queue[qos].ifq_mtx, ifp->if_xname, "octe tx free queue", MTX_DEF);
 		IFQ_SET_MAXLEN(&priv->tx_free_queue[qos], MAX_OUT_QUEUE_DEPTH);
@@ -181,9 +186,11 @@
 
 	ether_ifattach(ifp, priv->mac);
 
+	OCTE_TX_LOCK(priv);
 	IFQ_SET_MAXLEN(&ifp->if_snd, MAX_OUT_QUEUE_DEPTH);
 	ifp->if_snd.ifq_drv_maxlen = MAX_OUT_QUEUE_DEPTH;
 	IFQ_SET_READY(&ifp->if_snd);
+	OCTE_TX_UNLOCK(priv);
 
 	return (0);
 }
@@ -280,8 +287,11 @@
 	if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING)
 		return;
 
+	OCTE_TX_LOCK(priv);
 	while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
 		IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
+		if (m == NULL)
+			break;
 
 		/*
 		 * XXX
@@ -301,17 +311,21 @@
 		 * (3) do the collapse here.
 		 */
 
+		OCTE_TX_UNLOCK(priv);
 		if (priv->queue != -1) {
 			error = cvm_oct_xmit(m, ifp);
 		} else {
 			error = cvm_oct_xmit_pow(m, ifp);
 		}
 
+		OCTE_TX_LOCK(priv);
 		if (error != 0) {
 			ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+			OCTE_TX_UNLOCK(priv);
 			return;
 		}
 	}
+	OCTE_TX_UNLOCK(priv);
 }
 
 static int

-- 
Stanislav Sedov
ST4096-RIPE